summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/chrome/browser')
-rw-r--r--chromium/chrome/browser/BUILD.gn1
-rw-r--r--chromium/chrome/browser/android/vr/BUILD.gn1
-rw-r--r--chromium/chrome/browser/devtools/chrome_devtools_session.cc4
-rw-r--r--chromium/chrome/browser/extensions/api/management/management_apitest.cc73
-rw-r--r--chromium/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc24
-rw-r--r--chromium/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc9
-rw-r--r--chromium/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc5
-rw-r--r--chromium/chrome/browser/flag-metadata.json10
-rw-r--r--chromium/chrome/browser/resources/management/management_browser_proxy.js11
-rw-r--r--chromium/chrome/browser/resources/management/management_ui.html20
-rw-r--r--chromium/chrome/browser/resources/management/management_ui.js7
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/BUILD.gn7
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/blocking_request_manager.html2
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/blocking_request_manager.js40
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/passwords_export_dialog.html3
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/passwords_export_dialog.js20
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/passwords_section.html22
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/passwords_section.js51
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/show_password_behavior.html4
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/show_password_behavior.js26
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_config.js6
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.html1
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.js51
-rw-r--r--chromium/chrome/browser/resources/settings/os_settings_resources.grd23
-rw-r--r--chromium/chrome/browser/resources/settings/settings_resources.grd23
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_localized_strings_provider.cc25
-rw-r--r--chromium/chrome/browser/ui/webui/management_ui_browsertest.cc10
-rw-r--r--chromium/chrome/browser/ui/webui/management_ui_handler.cc294
-rw-r--r--chromium/chrome/browser/ui/webui/management_ui_handler.h15
-rw-r--r--chromium/chrome/browser/ui/webui/management_ui_handler_unittest.cc360
-rw-r--r--chromium/chrome/browser/ui/webui/ntp_tiles_internals_ui.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/settings/about_handler.cc17
-rw-r--r--chromium/chrome/browser/ui/webui/sync_internals_browsertest.js5
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/nux_helper.cc25
34 files changed, 740 insertions, 456 deletions
diff --git a/chromium/chrome/browser/BUILD.gn b/chromium/chrome/browser/BUILD.gn
index ed687fdfb15..600fe26a3f3 100644
--- a/chromium/chrome/browser/BUILD.gn
+++ b/chromium/chrome/browser/BUILD.gn
@@ -2743,6 +2743,7 @@ jumbo_split_static_library("browser") {
"//services/proxy_resolver:lib",
"//third_party/android_opengl/etc1",
"//third_party/android_sdk:cpu_features",
+ "//third_party/crashpad/crashpad/client:client",
"//third_party/libaddressinput:util",
"//third_party/libphonenumber",
"//third_party/smhasher:murmurhash2",
diff --git a/chromium/chrome/browser/android/vr/BUILD.gn b/chromium/chrome/browser/android/vr/BUILD.gn
index dcb6b173e88..9400d1cfafd 100644
--- a/chromium/chrome/browser/android/vr/BUILD.gn
+++ b/chromium/chrome/browser/android/vr/BUILD.gn
@@ -194,6 +194,7 @@ loadable_module("vr_ui_dummy_lib") {
"ui_dummy.cc",
"ui_dummy.h",
]
+ no_default_deps = true
}
android_library("ar_java") {
diff --git a/chromium/chrome/browser/devtools/chrome_devtools_session.cc b/chromium/chrome/browser/devtools/chrome_devtools_session.cc
index eff328b8b95..119f43f4283 100644
--- a/chromium/chrome/browser/devtools/chrome_devtools_session.cc
+++ b/chromium/chrome/browser/devtools/chrome_devtools_session.cc
@@ -54,9 +54,7 @@ void ChromeDevToolsSession::sendProtocolResponse(
}
static bool EnableInternalDevToolsBinaryProtocol() {
- static bool disabled = base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableInternalDevToolsBinaryProtocol);
- return !disabled;
+ return false;
}
void ChromeDevToolsSession::HandleCommand(
diff --git a/chromium/chrome/browser/extensions/api/management/management_apitest.cc b/chromium/chrome/browser/extensions/api/management/management_apitest.cc
index 1616369c7ed..8c68561345b 100644
--- a/chromium/chrome/browser/extensions/api/management/management_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/management/management_apitest.cc
@@ -24,6 +24,7 @@
#include "extensions/browser/extension_system.h"
#include "extensions/browser/test_management_policy.h"
#include "extensions/common/manifest.h"
+#include "extensions/common/switches.h"
#include "extensions/test/extension_test_message_listener.h"
#include "extensions/test/result_catcher.h"
#include "extensions/test/test_extension_dir.h"
@@ -162,9 +163,17 @@ class InstallReplacementWebAppApiTest : public ExtensionManagementApiTest {
ASSERT_TRUE(https_test_server_.Start());
}
+ void SetUpCommandLine(base::CommandLine* command_line) override {
+ ExtensionManagementApiTest::SetUpCommandLine(command_line);
+ command_line->AppendSwitchASCII(
+ extensions::switches::kWhitelistedExtensionID,
+ "odfeghegfpmohakomgihhcnoboeecemb");
+ }
+
void RunTest(const char* web_app_path,
const char* background_script,
- bool from_webstore) {
+ bool from_webstore,
+ bool whitelisted) {
static constexpr char kManifest[] =
R"({
"name": "Management API Test",
@@ -173,19 +182,56 @@ class InstallReplacementWebAppApiTest : public ExtensionManagementApiTest {
"background": { "scripts": ["background.js"] },
"replacement_web_app": "%s"
})";
+
+ static constexpr char kPem[] =
+ "-----BEGIN PRIVATE KEY-----"
+ "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCs5ycnzJEUSwlN"
+ "U7yAuywl8vro4dXew7Eijdd+gYwHAtaQyKxpeJHy09eusWKTfHEaOdqfqssqPMnl"
+ "XqoC+Tyt/24xM6rw6uSyAV78DRSAl7AxiyemxTh5P2rzaN4ytJayLpZDzwi38zeZ"
+ "QJC4TcSk04bclB2zfLFmMe8W53oxdE8vV6Xa2TPFigR6PV0FcRE40cCPHFhRTDwz"
+ "C04b/qW30Ceix2AeLPT4+qsGroq5kLt7zTgvaA+QToKeZNX41snk1w2u/IhOXG+J"
+ "0jyZnFU1lgnA9ScMW0laA+Ba2WXB5tLPgyRyyABRRaT5oiJCxRLQc+HFnMdUftGK"
+ "D4MKnf+/AgMBAAECggEADJ+/8x7zhMjJwBSaEcgYvBiWi0RZ6i7dkwlKL5lj0Os7"
+ "IU0VkYnVFiaze7TF3sDaPTD2Lmw48zeHAjE8NoVeEdIxiHQeSgLMedaxybNmyNDK"
+ "c4OWfI2vxuKDe4wvlQIscowGOqM2HsAqUg0tw9chwWsUUKyb0owLI8wHieOSv2OA"
+ "w8UlhflqkXLBUc4Mx3iqkIwAyrxQXT/vlA0M8/QvikK/zfeZYZ4f8tg23m3T0fV3"
+ "HC4k/Q09MFyUvURVYNpbPHrL83/ZbaHBniEjy+qBX4POO4xrKhow77tr/znB8bsA"
+ "T3mRwrEnYoIZmkwxlAdOMNxSYcAKZh4jPWOut0VQ0QKBgQDk341ysCaNzRq7nscR"
+ "RzDtpAA+UPcS2vcssXKDRjhsTp31qsUsVsYjTX+O/sv2uyb4HikYiFZOe3iPIfOl"
+ "ni7ZfhYFMMIZFjjP0cjQ7C/+ArxGb96DcTbRf7SNTDOLTtZy1jZSgIRek+2vvcr1"
+ "a/xPUMCxLEZdUPu+AVhKYHKHOQKBgQDBZVr04r4s5/BygRR3NhFgquI8ffdPHZzC"
+ "riEO1X/YOucTs+F+qwTvr25kRozpEjFsZJUibJTDngX9OziatAQdnjt5CtabOXd/"
+ "1rSgUadWEvRrcy/aaouCE1J+1unX6Kk5RHmIsK1YP3wC6JrHmqfnEVq9kaoUubTC"
+ "WHZfgjQGtwKBgF3B0nD8Bh8quVvIlGXYkwuWll7wzfYUaxMM8gsi1fRQVFcSCMm8"
+ "FljZ43pRmH5PdoxH1q/tEeX+oImJ8ASVgz2ncB/aNHkQaF+B4dDsIFDfD/+Ozkls"
+ "NHen5+/GGotj1WefpwsvCIqx8LmAd0cIYIihXP53U6/gf+/7Hw8A6YnJAoGAEbhs"
+ "xiWEkW7LLGLBck7k9ruRsUNFht1KwNfdtZNAfJqhE8AWuFmJQUEM12lTfgOpvanV"
+ "tGrIksgG+nYTsLEv81rNTkD8+wof9fnBYTM6Jvvjo3jReKzsjYWhuHeOw7bQ0quA"
+ "i1LM/1oJzeZsUD/OhLClZNtU/0Mo2enrJsMyay8CgYEApCQ8BDMYewQj2MCM92Vw"
+ "DWDzqQpfaGIG/eDAeEtdicbfdih3zUWfhEVOpnvf7s7nS8bMVpAo9pGW6sT/s8eX"
+ "POGiP9efxb2uHsX06pkAYZm9nddIliWnm0/eDBmSSXPymAZaNYFrex4wxMII20K/"
+ "ZX1nuseC+Lx0yzxa/c+iCWg="
+ "-----END PRIVATE KEY-----";
+
extensions::TestExtensionDir extension_dir;
extension_dir.WriteManifest(base::StringPrintf(
kManifest, https_test_server_.GetURL(web_app_path).spec().c_str()));
extension_dir.WriteFile(FILE_PATH_LITERAL("background.js"),
background_script);
+
+ base::FilePath crx;
+ if (whitelisted)
+ crx = extension_dir.PackWithPem(kPem);
+ else
+ crx = extension_dir.Pack();
+
extensions::ResultCatcher catcher;
if (from_webstore) {
// |expected_change| is the expected change in the number of installed
// extensions.
- ASSERT_TRUE(InstallExtensionFromWebstore(extension_dir.UnpackedPath(),
- 1 /* expected_change */));
+ ASSERT_TRUE(InstallExtensionFromWebstore(crx, 1 /* expected_change */));
} else {
- ASSERT_TRUE(LoadExtension(extension_dir.UnpackedPath()));
+ ASSERT_TRUE(LoadExtension(crx));
}
ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
@@ -194,6 +240,16 @@ class InstallReplacementWebAppApiTest : public ExtensionManagementApiTest {
net::EmbeddedTestServer https_test_server_;
};
+IN_PROC_BROWSER_TEST_F(InstallReplacementWebAppApiTest, NotWhitelisted) {
+ static constexpr char kBackground[] = R"(
+ chrome.test.assertEq(undefined, chrome.management.installReplacementWebApp);
+ chrome.test.notifyPass();
+ )";
+
+ RunTest("/management/install_replacement_web_app/good_web_app/index.html",
+ kBackground, true /* from_webstore */, false /* whitelisted */);
+}
+
IN_PROC_BROWSER_TEST_F(InstallReplacementWebAppApiTest, NotWebstore) {
static constexpr char kBackground[] = R"(
chrome.management.installReplacementWebApp(function() {
@@ -203,7 +259,7 @@ IN_PROC_BROWSER_TEST_F(InstallReplacementWebAppApiTest, NotWebstore) {
});)";
RunTest("/management/install_replacement_web_app/good_web_app/index.html",
- kBackground, false /* from_webstore */);
+ kBackground, false /* from_webstore */, true /* whitelisted */);
}
IN_PROC_BROWSER_TEST_F(InstallReplacementWebAppApiTest, NoGesture) {
@@ -215,7 +271,7 @@ IN_PROC_BROWSER_TEST_F(InstallReplacementWebAppApiTest, NoGesture) {
});)";
RunTest("/management/install_replacement_web_app/good_web_app/index.html",
- kBackground, true /* from_webstore */);
+ kBackground, true /* from_webstore */, true /* whitelisted */);
}
IN_PROC_BROWSER_TEST_F(InstallReplacementWebAppApiTest, NotInstallableWebApp) {
@@ -229,7 +285,7 @@ IN_PROC_BROWSER_TEST_F(InstallReplacementWebAppApiTest, NotInstallableWebApp) {
});)";
RunTest("/management/install_replacement_web_app/bad_web_app/index.html",
- kBackground, true /* from_webstore */);
+ kBackground, true /* from_webstore */, true /* whitelisted */);
}
IN_PROC_BROWSER_TEST_F(InstallReplacementWebAppApiTest, InstallableWebApp) {
@@ -261,7 +317,8 @@ IN_PROC_BROWSER_TEST_F(InstallReplacementWebAppApiTest, InstallableWebApp) {
EXPECT_FALSE(extensions::BookmarkOrHostedAppInstalled(browser()->profile(),
good_web_app_url));
- RunTest(kGoodWebAppURL, kBackground, true /* from_webstore */);
+ RunTest(kGoodWebAppURL, kBackground, true /* from_webstore */,
+ true /* whitelisted */);
EXPECT_TRUE(extensions::BookmarkOrHostedAppInstalled(browser()->profile(),
good_web_app_url));
chrome::SetAutoAcceptPWAInstallConfirmationForTesting(false);
diff --git a/chromium/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc b/chromium/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
index 0d620192ef6..524ae75a6b3 100644
--- a/chromium/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
+++ b/chromium/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
@@ -31,6 +31,10 @@
#include "chrome/browser/password_manager/password_manager_util_win.h"
#elif defined(OS_MACOSX)
#include "chrome/browser/password_manager/password_manager_util_mac.h"
+#elif defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/login/quick_unlock/auth_token.h"
+#include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h"
+#include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h"
#endif
namespace {
@@ -41,6 +45,14 @@ const char kExportInProgress[] = "in-progress";
// The error message returned to the UI when the user fails to reauthenticate.
const char kReauthenticationFailed[] = "reauth-failed";
+#if defined(OS_CHROMEOS)
+constexpr static base::TimeDelta kShowPasswordAuthTokenLifetime =
+ base::TimeDelta::FromSeconds(
+ PasswordAccessAuthenticator::kAuthValidityPeriodSeconds);
+constexpr static base::TimeDelta kExportPasswordsAuthTokenLifetime =
+ base::TimeDelta::FromSeconds(5);
+#endif
+
// Map password_manager::ExportProgressStatus to
// extensions::api::passwords_private::ExportProgressStatus.
extensions::api::passwords_private::ExportProgressStatus ConvertStatus(
@@ -204,6 +216,18 @@ bool PasswordsPrivateDelegateImpl::OsReauthCall(
web_contents_->GetTopLevelNativeWindow(), purpose);
#elif defined(OS_MACOSX)
return password_manager_util_mac::AuthenticateUser(purpose);
+#elif defined(OS_CHROMEOS)
+ chromeos::quick_unlock::QuickUnlockStorage* quick_unlock_storage =
+ chromeos::quick_unlock::QuickUnlockFactory::GetForProfile(profile_);
+ const chromeos::quick_unlock::AuthToken* auth_token =
+ quick_unlock_storage->GetAuthToken();
+ if (!auth_token || !auth_token->GetAge())
+ return false;
+ const base::TimeDelta auth_token_lifespan =
+ (purpose == password_manager::ReauthPurpose::EXPORT)
+ ? kExportPasswordsAuthTokenLifetime
+ : kShowPasswordAuthTokenLifetime;
+ return auth_token->GetAge() <= auth_token_lifespan;
#else
return true;
#endif
diff --git a/chromium/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc b/chromium/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc
index d09e42c33d2..0d37fecd99d 100644
--- a/chromium/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc
+++ b/chromium/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc
@@ -7,6 +7,7 @@
#include "ash/public/cpp/window_properties.h"
#include "ash/public/interfaces/window_pin_type.mojom.h"
#include "base/metrics/histogram_macros.h"
+#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
#include "chrome/browser/chromeos/arc/arc_session_manager.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
#include "chrome/browser/ui/ash/chrome_screenshot_grabber.h"
@@ -25,6 +26,14 @@ namespace tabs_util {
void SetLockedFullscreenState(Browser* browser, bool locked) {
UMA_HISTOGRAM_BOOLEAN("Extensions.LockedFullscreenStateRequest", locked);
+ // Disable ChromeVox before entering locked fullscreen. Quickfix for
+ // crbug.com/957950.
+ auto* const accessibility_manager = chromeos::AccessibilityManager::Get();
+ if (locked && accessibility_manager &&
+ accessibility_manager->IsSpokenFeedbackEnabled()) {
+ accessibility_manager->EnableSpokenFeedback(false);
+ }
+
aura::Window* window = browser->window()->GetNativeWindow();
// TRUSTED_PINNED is used here because that one locks the window fullscreen
// without allowing the user to exit (as opposed to regular PINNED).
diff --git a/chromium/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc b/chromium/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
index 183514c8fb5..6ab810e59fa 100644
--- a/chromium/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
@@ -243,6 +243,11 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, ServerRedirect) {
<< message_;
}
+IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, FormSubmission) {
+ ASSERT_TRUE(StartEmbeddedTestServer());
+ ASSERT_TRUE(RunExtensionTest("webnavigation/formSubmission")) << message_;
+}
+
IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, Download) {
ASSERT_TRUE(StartEmbeddedTestServer());
content::DownloadManager* download_manager =
diff --git a/chromium/chrome/browser/flag-metadata.json b/chromium/chrome/browser/flag-metadata.json
index 680b312bcab..d03a24a94ac 100644
--- a/chromium/chrome/browser/flag-metadata.json
+++ b/chromium/chrome/browser/flag-metadata.json
@@ -2463,11 +2463,21 @@
"expiry_milestone": 76
},
{
+ "name": "omnibox-group-suggestions-by-search-vs-url",
+ "owners": [ "krb", "chrome-omnibox-team@google.com" ],
+ "expiry_milestone": 80
+ },
+ {
"name": "omnibox-material-design-weather-icons",
"owners": [ "manukh", "chromium-omnibox-team" ],
"expiry_milestone": 76
},
{
+ "name": "omnibox-max-url-matches",
+ "owners": [ "krb", "chromium-omnibox-team" ],
+ "expiry_milestone": 80
+ },
+ {
"name": "omnibox-new-answer-layout",
"owners": [ "chrome-omnibox-team@google.com" ],
"expiry_milestone": 76
diff --git a/chromium/chrome/browser/resources/management/management_browser_proxy.js b/chromium/chrome/browser/resources/management/management_browser_proxy.js
index cdbda1f96f8..8d234df0008 100644
--- a/chromium/chrome/browser/resources/management/management_browser_proxy.js
+++ b/chromium/chrome/browser/resources/management/management_browser_proxy.js
@@ -30,18 +30,7 @@ management.BrowserReportingResponse;
/**
* @typedef {{
- * overview: string,
- * setup: string,
- * data: string,
- * }}
- */
-management.ManagedInfo;
-
-/**
- * @typedef {{
- * accountManagedInfo: ?management.ManagedInfo,
* browserManagementNotice: string,
- * deviceManagedInfo: ?management.ManagedInfo,
* extensionReportingTitle: string,
* pageSubtitle: string,
* managed: boolean,
diff --git a/chromium/chrome/browser/resources/management/management_ui.html b/chromium/chrome/browser/resources/management/management_ui.html
index a46ab2232a0..98ee40d924d 100644
--- a/chromium/chrome/browser/resources/management/management_ui.html
+++ b/chromium/chrome/browser/resources/management/management_ui.html
@@ -181,30 +181,12 @@
[[subtitle_]]
</h2>
</section>
- <section class="overview-section">
+ <section class="overview-section" hidden="[[!managementOverview_]]">
<if expr="not chromeos">
<div inner-h-t-m-l="[[managementNoticeHtml_]]"></div>
</if>
<if expr="chromeos">
<div>[[managementOverview_]]</div>
- <div>[[deviceManagedInfo_.overview]]</div>
- <ul class="overview-messages"
- hidden="[[!deviceManagedInfo_]]">
- <li>
- [[deviceManagedInfo_.setup]]
- <a href="$i18nRaw{managementDeviceLearnMoreUrl}"
- target="_blank">$i18n{learnMore}</a>
- </li>
- <li>[[deviceManagedInfo_.data]]</li>
- </ul>
- <div>[[accountManagedInfo_.overview]]</div>
- <ul class="overview-messages" hidden="[[!accountManagedInfo_]]">
- <li>[[accountManagedInfo_.setup]]
- <a href="$i18nRaw{managementAccountLearnMoreUrl}"
- target="_blank">$i18n{learnMore}</a>
- </li>
- <li>[[accountManagedInfo_.data]]</li>
- </ul>
</if>
</section>
<if expr="chromeos">
diff --git a/chromium/chrome/browser/resources/management/management_ui.js b/chromium/chrome/browser/resources/management/management_ui.js
index 13f177d9076..5b605220965 100644
--- a/chromium/chrome/browser/resources/management/management_ui.js
+++ b/chromium/chrome/browser/resources/management/management_ui.js
@@ -48,13 +48,8 @@ Polymer({
/** @private */
managementOverview_: String,
- /** @private {?management.ManagedInfo} */
- deviceManagedInfo_: Object,
// </if>
- /** @private {?management.ManagedInfo} */
- accountManagedInfo_: Object,
-
/** @private */
subtitle_: String,
@@ -249,10 +244,8 @@ Polymer({
this.managed_ = data.managed;
this.extensionReportingSubtitle_ = data.extensionReportingTitle;
this.subtitle_ = data.pageSubtitle;
- this.accountManagedInfo_ = data.accountManagedInfo;
// <if expr="chromeos">
this.managementOverview_ = data.overview;
- this.deviceManagedInfo_ = data.deviceManagedInfo;
// </if>
// <if expr="not chromeos">
this.managementNoticeHtml_ = data.browserManagementNotice;
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/BUILD.gn b/chromium/chrome/browser/resources/settings/autofill_page/BUILD.gn
index c40261fd353..84a9f949cac 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/BUILD.gn
+++ b/chromium/chrome/browser/resources/settings/autofill_page/BUILD.gn
@@ -9,6 +9,7 @@ js_type_check("closure_compile") {
":address_edit_dialog",
":autofill_page",
":autofill_section",
+ ":blocking_request_manager",
":credit_card_edit_dialog",
":credit_card_list",
":credit_card_list_entry",
@@ -50,6 +51,9 @@ js_library("autofill_section") {
externs_list = [ "$externs_path/autofill_private.js" ]
}
+js_library("blocking_request_manager") {
+}
+
js_library("payments_section") {
deps = [
":credit_card_edit_dialog",
@@ -134,5 +138,8 @@ js_library("password_edit_dialog") {
}
js_library("show_password_behavior") {
+ deps = [
+ ":blocking_request_manager",
+ ]
externs_list = [ "$externs_path/passwords_private.js" ]
}
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/blocking_request_manager.html b/chromium/chrome/browser/resources/settings/autofill_page/blocking_request_manager.html
new file mode 100644
index 00000000000..12f53887d68
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/autofill_page/blocking_request_manager.html
@@ -0,0 +1,2 @@
+<link rel="import" href="chrome://resources/html/cr.html">
+<script src="blocking_request_manager.js"></script>
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/blocking_request_manager.js b/chromium/chrome/browser/resources/settings/autofill_page/blocking_request_manager.js
new file mode 100644
index 00000000000..69d4eb60818
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/autofill_page/blocking_request_manager.js
@@ -0,0 +1,40 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview Helper class for making blocking requests that are resolved
+ * elsewhere in the DOM.
+ */
+cr.define('settings', function() {
+ class BlockingRequestManager {
+ /** @param {Function} makeRequest Function to initiate flow for request. */
+ constructor(makeRequest) {
+ this.makeRequest_ = makeRequest;
+ /**
+ * @private {Function} callback Provided in requests and called when the
+ * request is resolved.
+ */
+ this.callback_ = null;
+ }
+
+ /**
+ * Make a blocking request.
+ * @param {Function} callback Function to be called if/when the request is
+ * successfully resolved.
+ */
+ request(callback) {
+ this.callback_ = callback;
+ this.makeRequest_();
+ }
+
+ /** Called if/when request is resolved successfully. */
+ resolve() {
+ this.callback_();
+ }
+ }
+
+ return {
+ BlockingRequestManager: BlockingRequestManager,
+ };
+});
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/passwords_export_dialog.html b/chromium/chrome/browser/resources/settings/autofill_page/passwords_export_dialog.html
index bc044b56f64..ab305896fc3 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/passwords_export_dialog.html
+++ b/chromium/chrome/browser/resources/settings/autofill_page/passwords_export_dialog.html
@@ -6,6 +6,9 @@
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-progress/paper-progress.html">
<link rel="import" href="../settings_shared_css.html">
+<if expr="chromeos">
+<link rel="import" href="blocking_request_manager.html">
+</if>
<dom-module id="passwords-export-dialog">
<template>
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/passwords_export_dialog.js b/chromium/chrome/browser/resources/settings/autofill_page/passwords_export_dialog.js
index 094f607d633..d57d44916c2 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/passwords_export_dialog.js
+++ b/chromium/chrome/browser/resources/settings/autofill_page/passwords_export_dialog.js
@@ -52,6 +52,11 @@ Polymer({
/** @private */
showErrorDialog_: Boolean,
+
+ // <if expr="chromeos">
+ /** @type settings.BlockingRequestManager */
+ tokenRequestManager: Object
+ // </if>
},
listeners: {
@@ -177,11 +182,22 @@ Polymer({
this.async(() => this.fire('passwords-export-dialog-close'));
},
+ /** @private */
+ onExportTap_: function() {
+ // <if expr="chromeos">
+ this.tokenRequestManager.request(this.exportPasswords_.bind(this));
+ // </if>
+ // <if expr="not chromeos">
+ this.exportPasswords_();
+ // </if>
+ },
+
/**
- * Fires an event that should trigger the password export process.
+ * Tells the PasswordsPrivate API to export saved passwords in a .csv pending
+ * security checks.
* @private
*/
- onExportTap_: function() {
+ exportPasswords_: function() {
this.passwordManager_.exportPasswords(() => {
if (chrome.runtime.lastError &&
chrome.runtime.lastError.message == 'in-progress') {
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.html b/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.html
index 74cd237e755..2f65256cce8 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.html
+++ b/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.html
@@ -23,6 +23,10 @@
<link rel="import" href="passwords_shared_css.html">
<link rel="import" href="password_list_item.html">
<link rel="import" href="password_manager_proxy.html">
+<if expr="chromeos">
+<link rel="import" href="../controls/password_prompt_dialog.html">
+<link rel="import" href="blocking_request_manager.html">
+</if>
<dom-module id="passwords-section">
<template>
@@ -106,6 +110,9 @@
scroll-target="[[subpageScrollTarget]]" risk-selection>
<template>
<password-list-item item="[[item]]" tabindex$="[[tabIndex]]"
+<if expr="chromeos">
+ token-request-manager="[[tokenRequestManager_]]"
+</if>
first$="[[!index]]" iron-list-tab-index="[[tabIndex]]"
last-focused="{{lastFocused_}}" list-blurred="{{listBlurred_}}">
</password-list-item>
@@ -134,14 +141,27 @@
</cr-action-menu>
<template is="dom-if" if="[[showPasswordsExportDialog_]]" restamp>
<passwords-export-dialog
- on-passwords-export-dialog-close="onPasswordsExportDialogClosed_">
+<if expr="chromeos">
+ token-request-manager="[[tokenRequestManager_]]"
+</if>
+ on-passwords-export-dialog-close="onPasswordsExportDialogClosed_">
</passwords-export-dialog>
</template>
<template is="dom-if" if="[[showPasswordEditDialog_]]" restamp>
<password-edit-dialog on-close="onPasswordEditDialogClosed_"
+<if expr="chromeos">
+ token-request-manager="[[tokenRequestManager_]]"
+</if>
item="[[activePassword.item]]">
</password-edit-dialog>
</template>
+<if expr="chromeos">
+ <template is="dom-if" if="[[showPasswordPromptDialog_]]" restamp>
+ <settings-password-prompt-dialog auth-token="{{authToken_}}"
+ on-close="onPasswordPromptClosed_">
+ </settings-password-prompt-dialog>
+ </template>
+</if>
<cr-toast id="undoToast" duration="[[toastDuration_]]">
<div id="undoLabel">$i18n{passwordDeleted}</div>
<paper-button on-click="onUndoButtonTap_">
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.js b/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.js
index 2dc5b59bacb..1603dc8b370 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.js
+++ b/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.js
@@ -122,11 +122,28 @@ Polymer({
/** @private */
listBlurred_: Boolean,
+
+ // <if expr="chromeos">
+ /**
+ * Auth token for retrieving passwords if required by OS.
+ * @private
+ */
+ authToken_: {
+ type: String,
+ value: '',
+ observer: 'onAuthTokenChanged_',
+ },
+
+ /** @private */
+ showPasswordPromptDialog_: Boolean,
+
+ /** @private {settings.BlockingRequestManager} */
+ tokenRequestManager_: Object
+ // </if>
},
listeners: {
'password-menu-tap': 'onPasswordMenuTap_',
- 'export-passwords': 'onExportPasswords_',
},
keyBindings: {
@@ -184,6 +201,11 @@ Polymer({
// Set the manager. These can be overridden by tests.
this.passwordManager_ = PasswordManagerImpl.getInstance();
+ // <if expr="chromeos">
+ this.tokenRequestManager_ = new settings.BlockingRequestManager(
+ () => this.showPasswordPromptDialog_ = true);
+ // </if>
+
// Request initial data.
this.passwordManager_.getSavedPasswordList(setSavedPasswordsListener);
this.passwordManager_.getExceptionList(setPasswordExceptionsListener);
@@ -219,6 +241,33 @@ Polymer({
}
},
+ // <if expr="chromeos">
+ /**
+ * When |authToken_| changes to a new non-empty value, it means that the
+ * password-prompt-dialog succeeded in creating a fresh token in the
+ * quickUnlockPrivate API. Because new tokens can only ever be created
+ * immediately following a GAIA password check, the passwordsPrivate API can
+ * now safely grant requests for secure data (i.e. saved passwords) for a
+ * limited time. This observer resolves the request, triggering a callback
+ * that requires a fresh auth token to succeed and that was provided to the
+ * BlockingRequestManager by another DOM element seeking secure data.
+ *
+ * @param {string} newToken The newly created auth token. Note that its
+ * precise value is not relevant here, only the facts that it changed and
+ * that it is non-empty (i.e. not expired).
+ * @private
+ */
+ onAuthTokenChanged_: function(newToken) {
+ if (newToken) {
+ this.tokenRequestManager_.resolve();
+ }
+ },
+
+ onPasswordPromptClosed_: function() {
+ this.showPasswordPromptDialog_ = false;
+ },
+ // </if>
+
/**
* Shows the edit password dialog.
* @param {!Event} e
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/show_password_behavior.html b/chromium/chrome/browser/resources/settings/autofill_page/show_password_behavior.html
index 73ee8c03754..f9787f2abb6 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/show_password_behavior.html
+++ b/chromium/chrome/browser/resources/settings/autofill_page/show_password_behavior.html
@@ -1,2 +1,6 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<if expr="chromeos">
+<link rel="import" href="blocking_request_manager.html">
+</if>
+
<script src="show_password_behavior.js"></script>
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/show_password_behavior.js b/chromium/chrome/browser/resources/settings/autofill_page/show_password_behavior.js
index 097bdb2f0c6..4f73b4d1e1b 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/show_password_behavior.js
+++ b/chromium/chrome/browser/resources/settings/autofill_page/show_password_behavior.js
@@ -16,6 +16,11 @@ const ShowPasswordBehavior = {
* @type {!ShowPasswordBehavior.UiEntryWithPassword}
*/
item: Object,
+
+ // <if expr="chromeos">
+ /** @type settings.BlockingRequestManager */
+ tokenRequestManager: Object
+ // </if>
},
/**
@@ -69,13 +74,22 @@ const ShowPasswordBehavior = {
onShowPasswordButtonTap_: function() {
if (this.item.password) {
this.set('item.password', '');
- } else {
- PasswordManagerImpl.getInstance()
- .getPlaintextPassword(this.item.entry.id)
- .then(password => {
- this.set('item.password', password);
- });
+ return;
}
+ PasswordManagerImpl.getInstance()
+ .getPlaintextPassword(this.item.entry.id)
+ .then(password => {
+ if (password) {
+ this.set('item.password', password);
+ }
+ // <if expr="chromeos">
+ if (!password) {
+ // If no password was found, refresh auth token and retry.
+ this.tokenRequestManager.request(
+ this.onShowPasswordButtonTap_.bind(this));
+ }
+ // </if>
+ });
},
};
diff --git a/chromium/chrome/browser/resources/settings/internet_page/internet_config.js b/chromium/chrome/browser/resources/settings/internet_page/internet_config.js
index 3110ed73c5a..59ab7f234e9 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/internet_config.js
+++ b/chromium/chrome/browser/resources/settings/internet_page/internet_config.js
@@ -122,6 +122,12 @@ Polymer({
* @private
*/
getDialogTitle_: function() {
+ // If no properties are available yet, wait until they are set as part of
+ // open().
+ if (!this.managedProperties_) {
+ return '';
+ }
+
const name = /** @type {string} */ (
CrOnc.getActiveValue(this.managedProperties_.Name));
if (name) {
diff --git a/chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.html b/chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.html
index e178d57addd..480ec02a983 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.html
+++ b/chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.html
@@ -179,6 +179,7 @@
if="[[showAutoConnect_(networkProperties_, globalPolicy,
managedNetworkAvailable)]]">
<settings-toggle-button
+ id="autoConnectToggle"
pref="{{autoConnect_}}"
label="[[getAutoConnectToggleLabel_(networkProperties_)]]">
</settings-toggle-button>
diff --git a/chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.js b/chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.js
index 40d882c4de9..3a2685ec7d5 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.js
+++ b/chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.js
@@ -90,7 +90,7 @@ Polymer({
globalPolicy: {
type: Object,
value: null,
- observer: 'updateAutoConnectPref_'
+ observer: 'globalPolicyChanged_',
},
/**
@@ -278,6 +278,12 @@ Polymer({
});
},
+ /** @param {!chrome.networkingPrivate.GlobalPolicy} globalPolicy */
+ globalPolicyChanged_: function(globalPolicy) {
+ this.updateAutoConnectPref_(
+ !!(this.autoConnect_ && this.autoConnect_.value), globalPolicy);
+ },
+
/** @private */
networkPropertiesChanged_: function() {
if (!this.networkProperties_) {
@@ -285,13 +291,8 @@ Polymer({
}
// Update autoConnect if it has changed. Default value is false.
- const autoConnect = CrOnc.getAutoConnect(this.networkProperties_);
- if (this.autoConnect_ === undefined) {
- this.updateAutoConnectPref_();
- }
- if (autoConnect != this.autoConnect_.value) {
- this.autoConnect_.value = autoConnect;
- }
+ this.updateAutoConnectPref_(
+ CrOnc.getAutoConnect(this.networkProperties_), this.globalPolicy);
// Update preferNetwork if it has changed. Default value is false.
const priority = /** @type {number} */ (
@@ -340,18 +341,36 @@ Polymer({
this.setNetworkProperties_(onc);
},
- /** @private */
- updateAutoConnectPref_: function() {
+ /**
+ * Updates auto-connect pref value.
+ * @param {boolean} value
+ * @param {!chrome.networkingPrivate.GlobalPolicy|undefined} globalPolicy
+ * @private
+ */
+ updateAutoConnectPref_: function(value, globalPolicy) {
+ let enforcement;
+ let controlledBy;
+
+ if (this.isAutoConnectEnforcedByPolicy(
+ this.networkProperties_, globalPolicy)) {
+ enforcement = chrome.settingsPrivate.Enforcement.ENFORCED;
+ controlledBy = chrome.settingsPrivate.ControlledBy.DEVICE_POLICY;
+ }
+
+ if (this.autoConnect_ && this.autoConnect_.value == value &&
+ enforcement == this.autoConnect_.enforcement &&
+ controlledBy == this.autoConnect_.controlledBy) {
+ return;
+ }
+
const newPrefValue = {
key: 'fakeAutoConnectPref',
- value: !!this.autoConnect_ && !!this.autoConnect_.value,
+ value: value,
type: chrome.settingsPrivate.PrefType.BOOLEAN,
};
- if (this.isAutoConnectEnforcedByPolicy(
- this.networkProperties_, this.globalPolicy)) {
- newPrefValue.controlledBy =
- chrome.settingsPrivate.ControlledBy.DEVICE_POLICY;
- newPrefValue.enforcement = chrome.settingsPrivate.Enforcement.ENFORCED;
+ if (enforcement) {
+ newPrefValue.enforcement = enforcement;
+ newPrefValue.controlledBy = controlledBy;
}
this.autoConnect_ = newPrefValue;
diff --git a/chromium/chrome/browser/resources/settings/os_settings_resources.grd b/chromium/chrome/browser/resources/settings/os_settings_resources.grd
index 71961bb6878..954acb49036 100644
--- a/chromium/chrome/browser/resources/settings/os_settings_resources.grd
+++ b/chromium/chrome/browser/resources/settings/os_settings_resources.grd
@@ -665,12 +665,22 @@
<structure name="IDR_OS_SETTINGS_ADDRESS_EDIT_DIALOG_JS"
file="autofill_page/address_edit_dialog.js"
type="chrome_html" />
+ <if expr="chromeos">
+ <structure name="IDR_OS_SETTINGS_BLOCKING_REQUEST_MANAGER_HTML"
+ file="autofill_page/blocking_request_manager.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_BLOCKING_REQUEST_MANAGER_JS"
+ file="autofill_page/blocking_request_manager.js"
+ type="chrome_html" />
+ </if>
<structure name="IDR_OS_SETTINGS_SHOW_PASSWORD_BEHAVIOR_HTML"
file="autofill_page/show_password_behavior.html"
- type="chrome_html" />
+ type="chrome_html"
+ preprocess="true" />
<structure name="IDR_OS_SETTINGS_SHOW_PASSWORD_BEHAVIOR_JS"
file="autofill_page/show_password_behavior.js"
- type="chrome_html" />
+ type="chrome_html"
+ preprocess="true" />
<structure name="IDR_OS_SETTINGS_PASSWORD_LIST_ITEM_HTML"
file="autofill_page/password_list_item.html"
type="chrome_html"
@@ -686,7 +696,8 @@
type="chrome_html" />
<structure name="IDR_OS_SETTINGS_PASSWORDS_SECTION_HTML"
file="autofill_page/passwords_section.html"
- type="chrome_html" />
+ type="chrome_html"
+ preprocess="true" />
<structure name="IDR_OS_SETTINGS_PASSWORDS_SECTION_JS"
file="autofill_page/passwords_section.js"
type="chrome_html"
@@ -700,10 +711,12 @@
type="chrome_html" />
<structure name="IDR_OS_SETTINGS_PASSWORDS_EXPORT_DIALOG_HTML"
file="autofill_page/passwords_export_dialog.html"
- type="chrome_html" />
+ type="chrome_html"
+ preprocess="true" />
<structure name="IDR_OS_SETTINGS_PASSWORDS_EXPORT_DIALOG_JS"
file="autofill_page/passwords_export_dialog.js"
- type="chrome_html" />
+ type="chrome_html"
+ preprocess="true" />
<structure name="IDR_OS_SETTINGS_PAYMENTS_SECTION_HTML"
file="autofill_page/payments_section.html"
type="chrome_html" />
diff --git a/chromium/chrome/browser/resources/settings/settings_resources.grd b/chromium/chrome/browser/resources/settings/settings_resources.grd
index fa4b6f251d1..15e671a49c7 100644
--- a/chromium/chrome/browser/resources/settings/settings_resources.grd
+++ b/chromium/chrome/browser/resources/settings/settings_resources.grd
@@ -736,12 +736,22 @@
<structure name="IDR_SETTINGS_ADDRESS_EDIT_DIALOG_JS"
file="autofill_page/address_edit_dialog.js"
type="chrome_html" />
+ <if expr="chromeos">
+ <structure name="IDR_SETTINGS_BLOCKING_REQUEST_MANAGER_HTML"
+ file="autofill_page/blocking_request_manager.html"
+ type="chrome_html" />
+ <structure name="IDR_SETTINGS_BLOCKING_REQUEST_MANAGER_JS"
+ file="autofill_page/blocking_request_manager.js"
+ type="chrome_html" />
+ </if>
<structure name="IDR_SETTINGS_SHOW_PASSWORD_BEHAVIOR_HTML"
file="autofill_page/show_password_behavior.html"
- type="chrome_html" />
+ type="chrome_html"
+ preprocess="true" />
<structure name="IDR_SETTINGS_SHOW_PASSWORD_BEHAVIOR_JS"
file="autofill_page/show_password_behavior.js"
- type="chrome_html" />
+ type="chrome_html"
+ preprocess="true" />
<structure name="IDR_SETTINGS_PASSWORD_LIST_ITEM_HTML"
file="autofill_page/password_list_item.html"
type="chrome_html"
@@ -757,7 +767,8 @@
type="chrome_html" />
<structure name="IDR_SETTINGS_PASSWORDS_SECTION_HTML"
file="autofill_page/passwords_section.html"
- type="chrome_html" />
+ type="chrome_html"
+ preprocess="true" />
<structure name="IDR_SETTINGS_PASSWORDS_SECTION_JS"
file="autofill_page/passwords_section.js"
type="chrome_html"
@@ -771,10 +782,12 @@
type="chrome_html" />
<structure name="IDR_SETTINGS_PASSWORDS_EXPORT_DIALOG_HTML"
file="autofill_page/passwords_export_dialog.html"
- type="chrome_html" />
+ type="chrome_html"
+ preprocess="true" />
<structure name="IDR_SETTINGS_PASSWORDS_EXPORT_DIALOG_JS"
file="autofill_page/passwords_export_dialog.js"
- type="chrome_html" />
+ type="chrome_html"
+ preprocess="true" />
<structure name="IDR_SETTINGS_PAYMENTS_SECTION_HTML"
file="autofill_page/payments_section.html"
type="chrome_html" />
diff --git a/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_localized_strings_provider.cc b/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_localized_strings_provider.cc
index 7d3874c5928..7a95459f913 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_localized_strings_provider.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_localized_strings_provider.cc
@@ -76,6 +76,9 @@ GetLocalizedStringsWithPlaceholders() {
localized_strings([] {
std::vector<LocalizedStringWithName> localized_strings;
+ // TODO(crbug.com/964547): Refactor so that any change to these strings
+ // will surface in both the OOBE and post-OOBE UIs without having to
+ // adjust both localization calls separately.
localized_strings.emplace_back(
"startSetupPageMessage",
l10n_util::GetStringFUTF16(
@@ -120,8 +123,26 @@ void AddLocalizedValuesToBuilder(::login::LocalizedValuesBuilder* builder) {
for (const auto& entry : kLocalizedStringsWithoutPlaceholders)
builder->Add(entry.name, entry.id);
- for (const auto& entry : GetLocalizedStringsWithPlaceholders())
- builder->Add(entry.name, entry.localized_string);
+ // TODO(crbug.com/964547): Refactor so that any change to these strings will
+ // surface in both the OOBE and post-OOBE UIs without having to adjust both
+ // localization calls separately.
+ builder->AddF(
+ "startSetupPageMessage", IDS_MULTIDEVICE_SETUP_START_SETUP_PAGE_MESSAGE,
+ base::ASCIIToUTF16(kFootnoteMarker),
+ base::UTF8ToUTF16(chromeos::multidevice_setup::
+ GetBoardSpecificBetterTogetherSuiteLearnMoreUrl()
+ .spec()));
+
+ builder->AddF("startSetupPageFootnote",
+ IDS_MULTIDEVICE_SETUP_START_SETUP_PAGE_FOOTNOTE,
+ base::ASCIIToUTF16(kFootnoteMarker));
+
+ builder->AddF(
+ "startSetupPageFeatureListAwm",
+ IDS_MULTIDEVICE_SETUP_START_SETUP_PAGE_AWM_DESCRIPTION,
+ base::UTF8ToUTF16(
+ chromeos::multidevice_setup::GetBoardSpecificMessagesLearnMoreUrl()
+ .spec()));
}
} // namespace multidevice_setup
diff --git a/chromium/chrome/browser/ui/webui/management_ui_browsertest.cc b/chromium/chrome/browser/ui/webui/management_ui_browsertest.cc
index efc934ad8b1..9884bdd170c 100644
--- a/chromium/chrome/browser/ui/webui/management_ui_browsertest.cc
+++ b/chromium/chrome/browser/ui/webui/management_ui_browsertest.cc
@@ -83,9 +83,6 @@ IN_PROC_BROWSER_TEST_F(ManagementUITest, ManagementStateChange) {
l10n_util::GetStringUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED)},
{"pageSubtitle",
l10n_util::GetStringUTF16(IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE)},
- {"accountManagedInfo.overview", base::string16()},
- {"accountManagedInfo.data", base::string16()},
- {"accountManagedInfo.setup", base::string16()},
};
VerifyTexts(unmanaged_value_ptr.get(), expected_unmanaged_values);
@@ -116,13 +113,6 @@ IN_PROC_BROWSER_TEST_F(ManagementUITest, ManagementStateChange) {
{"extensionReportingTitle",
l10n_util::GetStringUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED)},
{"pageSubtitle", l10n_util::GetStringUTF16(IDS_MANAGEMENT_SUBTITLE)},
- {"accountManagedInfo.overview",
- l10n_util::GetStringUTF16(
- IDS_MANAGEMENT_ACCOUNT_MANAGED_CLARIFICATION_UNKNOWN_DOMAIN)},
- {"accountManagedInfo.data",
- l10n_util::GetStringUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_DATA)},
- {"accountManagedInfo.setup",
- l10n_util::GetStringUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_SETUP)},
};
VerifyTexts(managed_value_ptr.get(), expected_managed_values);
diff --git a/chromium/chrome/browser/ui/webui/management_ui_handler.cc b/chromium/chrome/browser/ui/webui/management_ui_handler.cc
index d276f4c01e7..8256ce760e8 100644
--- a/chromium/chrome/browser/ui/webui/management_ui_handler.cc
+++ b/chromium/chrome/browser/ui/webui/management_ui_handler.cc
@@ -117,13 +117,11 @@ const char kManagementReportNetworkInterfaces[] =
"managementReportNetworkInterfaces";
const char kManagementReportUsers[] = "managementReportUsers";
const char kManagementPrinting[] = "managementPrinting";
+const char kOverview[] = "overview";
+const char kAccountManagedInfo[] = "accountManagedInfo";
const char kDeviceManagedInfo[] = "deviceManagedInfo";
#endif // defined(OS_CHROMEOS)
-const char kOverview[] = "overview";
-const char kAccountManagedInfo[] = "accountManagedInfo";
-const char kSetup[] = "setup";
-const char kData[] = "data";
namespace {
@@ -344,9 +342,10 @@ void ManagementUIHandler::InitializeInternal(content::WebUI* web_ui,
auto handler = std::make_unique<ManagementUIHandler>();
#if defined(OS_CHROMEOS)
- handler->managed_ = IsProfileManaged(profile) || IsDeviceManaged();
+ handler->account_managed_ = IsProfileManaged(profile);
+ handler->device_managed_ = IsDeviceManaged();
#else
- handler->managed_ = IsProfileManaged(profile) || IsBrowserManaged();
+ handler->account_managed_ = IsProfileManaged(profile) || IsBrowserManaged();
#endif // defined(OS_CHROMEOS)
web_ui->AddMessageHandler(std::move(handler));
@@ -484,19 +483,20 @@ void ManagementUIHandler::AddExtensionReportingInfo(
}
base::DictionaryValue ManagementUIHandler::GetContextualManagedData(
- Profile* profile) const {
+ Profile* profile) {
base::DictionaryValue response;
-
#if defined(OS_CHROMEOS)
- policy::BrowserPolicyConnectorChromeOS* connector =
- g_browser_process->platform_part()->browser_policy_connector_chromeos();
- std::string management_domain = connector->GetEnterpriseDisplayDomain();
- if (management_domain.empty())
- management_domain = connector->GetRealm();
+ std::string management_domain = GetDeviceDomain();
if (management_domain.empty())
management_domain = GetAccountDomain(profile);
#else
std::string management_domain = GetAccountDomain(profile);
+
+ response.SetString("browserManagementNotice",
+ l10n_util::GetStringFUTF16(
+ managed_() ? IDS_MANAGEMENT_BROWSER_NOTICE
+ : IDS_MANAGEMENT_NOT_MANAGED_NOTICE,
+ base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
#endif
if (management_domain.empty()) {
@@ -505,24 +505,20 @@ base::DictionaryValue ManagementUIHandler::GetContextualManagedData(
l10n_util::GetStringUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED));
#if !defined(OS_CHROMEOS)
- response.SetString("browserManagementNotice",
- l10n_util::GetStringFUTF16(
- managed_ ? IDS_MANAGEMENT_BROWSER_NOTICE
- : IDS_MANAGEMENT_NOT_MANAGED_NOTICE,
- base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
response.SetString("pageSubtitle",
l10n_util::GetStringUTF16(
- managed_ ? IDS_MANAGEMENT_SUBTITLE
- : IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE));
+ managed_() ? IDS_MANAGEMENT_SUBTITLE
+ : IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE));
#else
const auto device_type = ui::GetChromeOSDeviceTypeResourceId();
- response.SetString("pageSubtitle",
- managed_ ? l10n_util::GetStringFUTF16(
- IDS_MANAGEMENT_SUBTITLE_MANAGED,
- l10n_util::GetStringUTF16(device_type))
- : l10n_util::GetStringFUTF16(
- IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE,
- l10n_util::GetStringUTF16(device_type)));
+ response.SetString(
+ "pageSubtitle",
+ managed_()
+ ? l10n_util::GetStringFUTF16(IDS_MANAGEMENT_SUBTITLE_MANAGED,
+ l10n_util::GetStringUTF16(device_type))
+ : l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE,
+ l10n_util::GetStringUTF16(device_type)));
#endif // !defined(OS_CHROMEOS)
} else {
@@ -533,33 +529,25 @@ base::DictionaryValue ManagementUIHandler::GetContextualManagedData(
#if !defined(OS_CHROMEOS)
response.SetString(
- "browserManagementNotice",
- managed_ ? l10n_util::GetStringFUTF16(
- IDS_MANAGEMENT_MANAGEMENT_BY_NOTICE,
- base::UTF8ToUTF16(management_domain),
- base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl))
- : l10n_util::GetStringFUTF16(
- IDS_MANAGEMENT_NOT_MANAGED_NOTICE,
- base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
- response.SetString(
"pageSubtitle",
- managed_
+ managed_()
? l10n_util::GetStringFUTF16(IDS_MANAGEMENT_SUBTITLE_MANAGED_BY,
base::UTF8ToUTF16(management_domain))
: l10n_util::GetStringUTF16(IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE));
#else
const auto device_type = ui::GetChromeOSDeviceTypeResourceId();
- response.SetString("pageSubtitle",
- managed_ ? l10n_util::GetStringFUTF16(
- IDS_MANAGEMENT_SUBTITLE_MANAGED_BY,
- l10n_util::GetStringUTF16(device_type),
- base::UTF8ToUTF16(management_domain))
- : l10n_util::GetStringFUTF16(
- IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE,
- l10n_util::GetStringUTF16(device_type)));
+ response.SetString(
+ "pageSubtitle",
+ managed_()
+ ? l10n_util::GetStringFUTF16(IDS_MANAGEMENT_SUBTITLE_MANAGED_BY,
+ l10n_util::GetStringUTF16(device_type),
+ base::UTF8ToUTF16(management_domain))
+ : l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE,
+ l10n_util::GetStringUTF16(device_type)));
#endif // !defined(OS_CHROMEOS)
}
- response.SetBoolean("managed", managed_);
+ response.SetBoolean("managed", managed_());
GetManagementStatus(profile, &response);
return response;
}
@@ -578,170 +566,80 @@ const extensions::Extension* ManagementUIHandler::GetEnabledExtension(
}
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
-#if defined(OS_CHROMEOS)
-void AddStatusDeviceManagedInfo(base::Value* status,
- const std::string& device_domain) {
- base::Value info(base::Value::Type::DICTIONARY);
- info.SetKey(kOverview, base::Value(l10n_util::GetStringFUTF16(
- IDS_MANAGEMENT_DEVICE_MANAGED_CLARIFICATION,
- base::UTF8ToUTF16(device_domain))));
- info.SetKey(kSetup, base::Value(l10n_util::GetStringUTF16(
- IDS_MANAGEMENT_DEVICE_MANAGED_SETUP)));
- info.SetKey(kData, base::Value(l10n_util::GetStringUTF16(
- IDS_MANAGEMENT_DEVICE_MANAGED_DATA)));
- status->SetKey(kDeviceManagedInfo, std::move(info));
-}
-
-void AddStatusDeviceAndAccountManagedInfo(
- base::Value* status,
- const std::string& device_and_account_domain) {
- base::Value info(base::Value::Type::DICTIONARY);
- info.SetKey(kOverview,
- base::Value(l10n_util::GetStringFUTF16(
- IDS_MANAGEMENT_DEVICE_AND_ACCOUNT_MANAGED_CLARIFICATION,
- base::UTF8ToUTF16(device_and_account_domain))));
- info.SetKey(kSetup, base::Value(l10n_util::GetStringUTF16(
- IDS_MANAGEMENT_DEVICE_AND_ACCOUNT_MANAGED_SETUP)));
- info.SetKey(kData, base::Value(l10n_util::GetStringUTF16(
- IDS_MANAGEMENT_DEVICE_AND_ACCOUNT_MANAGED_DATA)));
- status->SetKey(kDeviceManagedInfo, std::move(info));
-}
-#endif // defined(OS_CHROMEOS)
-
-void AddStatusAccountManagedInfo(base::Value* status,
- const std::string& account_domain) {
- base::Value info(base::Value::Type::DICTIONARY);
- if (account_domain.empty()) {
- info.SetKey(
- kOverview,
- base::Value(l10n_util::GetStringUTF16(
- IDS_MANAGEMENT_ACCOUNT_MANAGED_CLARIFICATION_UNKNOWN_DOMAIN)));
- } else {
- info.SetKey(kOverview, base::Value(l10n_util::GetStringFUTF16(
- IDS_MANAGEMENT_ACCOUNT_MANAGED_CLARIFICATION,
- base::UTF8ToUTF16(account_domain))));
- }
- info.SetKey(kSetup, base::Value(l10n_util::GetStringUTF16(
- IDS_MANAGEMENT_ACCOUNT_MANAGED_SETUP)));
- info.SetKey(kData, base::Value(l10n_util::GetStringUTF16(
- IDS_MANAGEMENT_ACCOUNT_MANAGED_DATA)));
- status->SetKey(kAccountManagedInfo, std::move(info));
-}
#if defined(OS_CHROMEOS)
void AddStatusOverviewManagedDeviceAndAccount(
base::Value* status,
+ bool device_managed,
+ bool account_managed,
const std::string& device_domain,
const std::string& account_domain) {
- status->SetKey(kOverview,
- base::Value(l10n_util::GetStringFUTF16(
- IDS_MANAGEMENT_DEVICE_MANAGED_BY_ACCOUNT_MANAGED_BY,
- base::UTF8ToUTF16(device_domain),
- base::UTF8ToUTF16(account_domain))));
- AddStatusDeviceManagedInfo(status, device_domain);
- AddStatusAccountManagedInfo(status, account_domain);
-}
+ if (device_managed && account_managed &&
+ (account_domain.empty() || account_domain == device_domain)) {
+ status->SetKey(kOverview, base::Value(l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_DEVICE_AND_ACCOUNT_MANAGED_BY,
+ base::UTF8ToUTF16(device_domain))));
-void AddStatusOverviewManagedDeviceAndAccount(
- base::Value* status,
- const std::string& device_and_account_domain) {
- status->SetKey(kOverview, base::Value(l10n_util::GetStringFUTF16(
- IDS_MANAGEMENT_DEVICE_AND_ACCOUNT_MANAGED_BY,
- base::UTF8ToUTF16(device_and_account_domain))));
- AddStatusDeviceAndAccountManagedInfo(status, device_and_account_domain);
- status->SetKey(kAccountManagedInfo, base::Value());
-}
-
-void AddStatusOverviewManagedDevice(base::Value* status,
- const std::string& device_domain) {
- status->SetKey(kOverview, base::Value(l10n_util::GetStringFUTF16(
- IDS_MANAGEMENT_DEVICE_MANAGED_BY,
- base::UTF8ToUTF16(device_domain))));
- AddStatusDeviceManagedInfo(status, device_domain);
- status->SetKey(kAccountManagedInfo, base::Value());
-}
-
-#endif // defined(OS_CHROMEOS)
+ return;
+ }
-void AddStatusOverviewManagedAccount(base::Value* status,
- const std::string& account_domain) {
-#if defined(OS_CHROMEOS)
- status->SetKey(kOverview, base::Value(l10n_util::GetStringFUTF16(
- IDS_MANAGEMENT_ACCOUNT_MANAGED_BY,
- base::UTF8ToUTF16(account_domain))));
- status->SetKey(kDeviceManagedInfo, base::Value());
-#endif // defined(OS_CHROMEOS)
- AddStatusAccountManagedInfo(status, account_domain);
-}
+ if (account_managed && !account_domain.empty()) {
+ status->SetKey(kOverview, base::Value(l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_ACCOUNT_MANAGED_BY,
+ base::UTF8ToUTF16(account_domain))));
+ }
-#if defined(OS_CHROMEOS)
-void AddStatusOverviewNotManaged(base::Value* status) {
- status->SetKey(kOverview, base::Value(l10n_util::GetStringUTF16(
- IDS_MANAGEMENT_DEVICE_NOT_MANAGED)));
- status->SetKey(kAccountManagedInfo, base::Value());
- status->SetKey(kDeviceManagedInfo, base::Value());
+ if (account_managed && device_managed && !account_domain.empty() &&
+ account_domain != device_domain) {
+ status->SetKey(kOverview,
+ base::Value(l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_DEVICE_MANAGED_BY_ACCOUNT_MANAGED_BY,
+ base::UTF8ToUTF16(device_domain),
+ base::UTF8ToUTF16(account_domain))));
+ }
}
-#endif // defined(OS_CHROMEOS)
-
-void ManagementUIHandler::GetManagementStatus(Profile* profile,
- base::Value* status) const {
- const std::string account_domain = GetAccountDomain(profile);
-#if defined(OS_CHROMEOS)
- const bool account_managed = IsProfileManaged(profile);
- const bool profile_associated_with_gaia_account =
- chromeos::IsProfileAssociatedWithGaiaAccount(profile);
+const std::string ManagementUIHandler::GetDeviceDomain() const {
std::string device_domain;
policy::BrowserPolicyConnectorChromeOS* connector =
g_browser_process->platform_part()->browser_policy_connector_chromeos();
- const bool device_managed = connector->IsEnterpriseManaged();
- if (device_managed)
+ if (device_managed_)
device_domain = connector->GetEnterpriseDisplayDomain();
if (device_domain.empty() && connector->IsActiveDirectoryManaged())
device_domain = connector->GetRealm();
+ return device_domain;
+}
- bool primary_user_managed = false;
- std::string primary_user_account_domain;
- auto* primary_user = user_manager::UserManager::Get()->GetPrimaryUser();
- if (primary_user) {
- auto* primary_profile =
- chromeos::ProfileHelper::Get()->GetProfileByUser(primary_user);
- if (primary_profile) {
- primary_user_managed = IsProfileManaged(primary_profile);
- primary_user_account_domain = GetAccountDomain(primary_profile);
- }
- }
+#endif // defined(OS_CHROMEOS)
- if (device_managed) {
- DCHECK(!device_domain.empty());
- if (account_managed) {
- if (device_domain == account_domain ||
- !profile_associated_with_gaia_account) {
- AddStatusOverviewManagedDeviceAndAccount(status, device_domain);
- return;
- }
- DCHECK(!account_domain.empty());
- AddStatusOverviewManagedDeviceAndAccount(status, device_domain,
- account_domain);
- return;
- }
- AddStatusOverviewManagedDevice(status, device_domain);
+void ManagementUIHandler::GetManagementStatus(Profile* profile,
+ base::Value* status) const {
+#if defined(OS_CHROMEOS)
+ status->SetKey(kDeviceManagedInfo, base::Value());
+ status->SetKey(kAccountManagedInfo, base::Value());
+ status->SetKey(kOverview, base::Value());
+ if (!managed_()) {
+ status->SetKey(kOverview, base::Value(l10n_util::GetStringUTF16(
+ IDS_MANAGEMENT_DEVICE_NOT_MANAGED)));
return;
}
+ std::string account_domain = GetAccountDomain(profile);
+ auto* primary_user = user_manager::UserManager::Get()->GetPrimaryUser();
+ auto* primary_profile =
+ primary_user
+ ? chromeos::ProfileHelper::Get()->GetProfileByUser(primary_user)
+ : nullptr;
+ const bool primary_user_managed =
+ primary_profile ? IsProfileManaged(primary_profile) : false;
- if (primary_user_managed) {
- AddStatusOverviewManagedAccount(status, primary_user_account_domain);
- return;
- }
-#endif // defined(OS_CHROMEOS)
+ if (primary_user_managed)
+ account_domain = GetAccountDomain(primary_profile);
- if (managed_) {
- AddStatusOverviewManagedAccount(status, account_domain);
- return;
- }
+ std::string device_domain = GetDeviceDomain();
-#if defined(OS_CHROMEOS)
- AddStatusOverviewNotManaged(status);
+ AddStatusOverviewManagedDeviceAndAccount(
+ status, device_managed_, account_managed_ || primary_user_managed,
+ device_domain, account_domain);
#endif // defined(OS_CHROMEOS)
}
@@ -837,27 +735,29 @@ void ManagementUIHandler::OnExtensionUnloaded(
}
}
-void ManagementUIHandler::OnManagedStateChanged() {
+void ManagementUIHandler::UpdateManagedState() {
auto* profile = Profile::FromWebUI(web_ui());
+ bool managed_state_changed = false;
#if defined(OS_CHROMEOS)
- bool managed = IsProfileManaged(profile) || IsDeviceManaged();
+ managed_state_changed |= account_managed_ != IsProfileManaged(profile);
+ managed_state_changed |= device_managed_ != IsDeviceManaged();
+ account_managed_ = IsProfileManaged(profile);
+ device_managed_ = IsDeviceManaged();
#else
- bool managed = IsProfileManaged(profile) || IsBrowserManaged();
+ managed_state_changed |=
+ account_managed_ != (IsProfileManaged(profile) || IsBrowserManaged());
+ account_managed_ = IsProfileManaged(profile) || IsBrowserManaged();
#endif // defined(OS_CHROMEOS)
- if (managed == managed_)
- return;
-
- managed_ = managed;
-
- FireWebUIListener("managed_state_changed");
+ if (managed_state_changed)
+ FireWebUIListener("managed_data_changed");
}
void ManagementUIHandler::OnPolicyUpdated(
const policy::PolicyNamespace& /*ns*/,
const policy::PolicyMap& /*previous*/,
const policy::PolicyMap& /*current*/) {
- OnManagedStateChanged();
+ UpdateManagedState();
NotifyBrowserReportingInfoUpdated();
}
@@ -878,7 +778,7 @@ void ManagementUIHandler::AddObservers() {
pref_registrar_.Add(
prefs::kSupervisedUserId,
- base::BindRepeating(&ManagementUIHandler::OnManagedStateChanged,
+ base::BindRepeating(&ManagementUIHandler::UpdateManagedState,
base::Unretained(this)));
}
diff --git a/chromium/chrome/browser/ui/webui/management_ui_handler.h b/chromium/chrome/browser/ui/webui/management_ui_handler.h
index daca8ea6eb1..76bebbd81c9 100644
--- a/chromium/chrome/browser/ui/webui/management_ui_handler.h
+++ b/chromium/chrome/browser/ui/webui/management_ui_handler.h
@@ -98,7 +98,8 @@ class ManagementUIHandler : public content::WebUIMessageHandler {
// content::WebUIMessageHandler implementation.
void RegisterMessages() override;
- void SetManagedForTesting(bool managed) { managed_ = managed; }
+ void SetAccountManagedForTesting(bool managed) { account_managed_ = managed; }
+ void SetDeviceManagedForTesting(bool managed) { device_managed_ = managed; }
static std::string GetAccountDomain(Profile* profile);
@@ -113,12 +114,16 @@ class ManagementUIHandler : public content::WebUIMessageHandler {
Profile* profile);
void AddExtensionReportingInfo(base::Value* report_sources);
- base::DictionaryValue GetContextualManagedData(Profile* profile) const;
+ base::DictionaryValue GetContextualManagedData(Profile* profile);
virtual policy::PolicyService* GetPolicyService() const;
virtual const extensions::Extension* GetEnabledExtension(
const std::string& extensionId) const;
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
+#if defined(OS_CHROMEOS)
+ // Protected for testing.
+ virtual const std::string GetDeviceDomain() const;
+#endif // defined(OS_CHROMEOS)
private:
void GetManagementStatus(Profile* profile, base::Value* status) const;
@@ -145,7 +150,7 @@ class ManagementUIHandler : public content::WebUIMessageHandler {
const extensions::Extension* extension,
extensions::UnloadedExtensionReason reason) override;
- void OnManagedStateChanged();
+ void UpdateManagedState();
// policy::PolicyService::Observer
void OnPolicyUpdated(const policy::PolicyNamespace& ns,
@@ -155,10 +160,12 @@ class ManagementUIHandler : public content::WebUIMessageHandler {
void AddObservers();
void RemoveObservers();
+ bool managed_() const { return account_managed_ || device_managed_; }
+ bool account_managed_ = false;
+ bool device_managed_ = false;
// To avoid double-removing the observers, which would cause a DCHECK()
// failure.
bool has_observers_ = false;
- bool managed_ = false;
std::string web_ui_data_source_name_;
PrefChangeRegistrar pref_registrar_;
diff --git a/chromium/chrome/browser/ui/webui/management_ui_handler_unittest.cc b/chromium/chrome/browser/ui/webui/management_ui_handler_unittest.cc
index f081a564856..ea976960a7e 100644
--- a/chromium/chrome/browser/ui/webui/management_ui_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/management_ui_handler_unittest.cc
@@ -34,11 +34,12 @@ using testing::ReturnRef;
struct ContextualManagementSourceUpdate {
base::string16* extension_reporting_title;
- base::string16* browser_management_notice;
base::string16* subtitle;
+#if defined(OS_CHROMEOS)
base::string16* management_overview;
- base::string16* management_overview_data_notice;
- base::string16* management_overview_setup_notice;
+#else
+ base::string16* browser_management_notice;
+#endif // defined(OS_CHROMEOS)
bool* managed;
};
@@ -53,8 +54,7 @@ class TestManagementUIHandler : public ManagementUIHandler {
cloud_reporting_extension_exists_ = enable;
}
- base::DictionaryValue GetContextualManagedDataForTesting(
- Profile* profile) const {
+ base::DictionaryValue GetContextualManagedDataForTesting(Profile* profile) {
return GetContextualManagedData(profile);
}
@@ -75,18 +75,27 @@ class TestManagementUIHandler : public ManagementUIHandler {
return nullptr;
}
+#if defined(OS_CHROMEOS)
+ const std::string GetDeviceDomain() const override { return device_domain; }
+ void SetDeviceDomain(const std::string& domain) { device_domain = domain; }
+#endif // defined(OS_CHROMEOS)
+
private:
bool cloud_reporting_extension_exists_ = false;
policy::PolicyService* policy_service_ = nullptr;
+ std::string device_domain = "devicedomain.com";
};
class ManagementUIHandlerTests : public testing::Test {
public:
- ManagementUIHandlerTests() : handler_(&policy_service_) {
+ ManagementUIHandlerTests()
+ : handler_(&policy_service_),
+ device_domain_(base::UTF8ToUTF16("devicedomain.com")) {
ON_CALL(policy_service_, GetPolicies(_))
.WillByDefault(ReturnRef(empty_policy_map_));
}
+ base::string16 device_domain() { return device_domain_; }
void EnablePolicy(const char* policy_key, policy::PolicyMap& policies) {
policies.Set(policy_key, policy::POLICY_LEVEL_MANDATORY,
policy::POLICY_SCOPE_MACHINE, policy::POLICY_SOURCE_CLOUD,
@@ -98,15 +107,13 @@ class ManagementUIHandlerTests : public testing::Test {
const ContextualManagementSourceUpdate& extracted) {
data.GetString("extensionReportingTitle",
extracted.extension_reporting_title);
+ data.GetString("pageSubtitle", extracted.subtitle);
+#if defined(OS_CHROMEOS)
+ data.GetString("overview", extracted.management_overview);
+#else
data.GetString("browserManagementNotice",
extracted.browser_management_notice);
- data.GetString("pageSubtitle", extracted.subtitle);
- data.GetString("accountManagedInfo.overview",
- extracted.management_overview);
- data.GetString("accountManagedInfo.data",
- extracted.management_overview_data_notice);
- data.GetString("accountManagedInfo.setup",
- extracted.management_overview_setup_notice);
+#endif // defined(OS_CHROMEOS)
data.GetBoolean("managed", extracted.managed);
}
@@ -115,6 +122,7 @@ class ManagementUIHandlerTests : public testing::Test {
content::TestBrowserThreadBundle thread_bundle_;
policy::MockPolicyService policy_service_;
policy::PolicyMap empty_policy_map_;
+ base::string16 device_domain_;
};
#if !defined(OS_CHROMEOS)
@@ -123,21 +131,14 @@ TEST_F(ManagementUIHandlerTests,
auto profile = TestingProfile::Builder().Build();
base::string16 extension_reporting_title;
- base::string16 browser_management_notice;
base::string16 subtitle;
- base::string16 management_overview;
- base::string16 management_overview_data_notice;
- base::string16 management_overview_setup_notice;
+ base::string16 browser_management_notice;
bool managed;
- ContextualManagementSourceUpdate extracted{&extension_reporting_title,
- &browser_management_notice,
- &subtitle,
- &management_overview,
- &management_overview_data_notice,
- &management_overview_setup_notice,
- &managed};
-
- handler_.SetManagedForTesting(false);
+ ContextualManagementSourceUpdate extracted{
+ &extension_reporting_title, &subtitle, &browser_management_notice,
+ &managed};
+
+ handler_.SetAccountManagedForTesting(false);
auto data = handler_.GetContextualManagedDataForTesting(profile.get());
ExtractContextualSourceUpdate(data, extracted);
@@ -150,9 +151,6 @@ TEST_F(ManagementUIHandlerTests,
base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
EXPECT_EQ(subtitle,
l10n_util::GetStringUTF16(IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE));
- EXPECT_EQ(management_overview, base::string16());
- EXPECT_EQ(management_overview_data_notice, base::string16());
- EXPECT_EQ(management_overview_setup_notice, base::string16());
}
TEST_F(ManagementUIHandlerTests,
@@ -160,25 +158,18 @@ TEST_F(ManagementUIHandlerTests,
auto profile = TestingProfile::Builder().Build();
base::string16 extension_reporting_title;
- base::string16 browser_management_notice;
base::string16 subtitle;
- base::string16 management_overview;
- base::string16 management_overview_data_notice;
- base::string16 management_overview_setup_notice;
+ base::string16 browser_management_notice;
bool managed;
- ContextualManagementSourceUpdate extracted{&extension_reporting_title,
- &browser_management_notice,
- &subtitle,
- &management_overview,
- &management_overview_data_notice,
- &management_overview_setup_notice,
- &managed};
-
- handler_.SetManagedForTesting(true);
+ ContextualManagementSourceUpdate extracted{
+ &extension_reporting_title, &subtitle, &browser_management_notice,
+ &managed};
+
+ handler_.SetAccountManagedForTesting(true);
auto data = handler_.GetContextualManagedDataForTesting(profile.get());
ExtractContextualSourceUpdate(data, extracted);
- EXPECT_EQ(data.DictSize(), 5u);
+ EXPECT_EQ(data.DictSize(), 4u);
EXPECT_EQ(extension_reporting_title,
l10n_util::GetStringUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED));
EXPECT_EQ(browser_management_notice,
@@ -186,13 +177,6 @@ TEST_F(ManagementUIHandlerTests,
IDS_MANAGEMENT_BROWSER_NOTICE,
base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
EXPECT_EQ(subtitle, l10n_util::GetStringUTF16(IDS_MANAGEMENT_SUBTITLE));
- EXPECT_EQ(management_overview,
- l10n_util::GetStringUTF16(
- IDS_MANAGEMENT_ACCOUNT_MANAGED_CLARIFICATION_UNKNOWN_DOMAIN));
- EXPECT_EQ(management_overview_data_notice,
- l10n_util::GetStringUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_DATA));
- EXPECT_EQ(management_overview_setup_notice,
- l10n_util::GetStringUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_SETUP));
EXPECT_TRUE(managed);
}
@@ -203,25 +187,17 @@ TEST_F(ManagementUIHandlerTests,
auto profile = builder.Build();
base::string16 extensions_installed;
- base::string16 browser_management_notice;
base::string16 subtitle;
- base::string16 management_overview;
- base::string16 management_overview_data_notice;
- base::string16 management_overview_setup_notice;
+ base::string16 browser_management_notice;
bool managed;
- ContextualManagementSourceUpdate extracted{&extensions_installed,
- &browser_management_notice,
- &subtitle,
- &management_overview,
- &management_overview_data_notice,
- &management_overview_setup_notice,
- &managed};
-
- handler_.SetManagedForTesting(true);
+ ContextualManagementSourceUpdate extracted{
+ &extensions_installed, &subtitle, &browser_management_notice, &managed};
+
+ handler_.SetAccountManagedForTesting(true);
auto data = handler_.GetContextualManagedDataForTesting(profile.get());
ExtractContextualSourceUpdate(data, extracted);
- EXPECT_EQ(data.DictSize(), 5u);
+ EXPECT_EQ(data.DictSize(), 4u);
EXPECT_EQ(extensions_installed,
l10n_util::GetStringUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED));
EXPECT_EQ(browser_management_notice,
@@ -229,13 +205,6 @@ TEST_F(ManagementUIHandlerTests,
IDS_MANAGEMENT_BROWSER_NOTICE,
base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
EXPECT_EQ(subtitle, l10n_util::GetStringUTF16(IDS_MANAGEMENT_SUBTITLE));
- EXPECT_EQ(management_overview,
- l10n_util::GetStringUTF16(
- IDS_MANAGEMENT_ACCOUNT_MANAGED_CLARIFICATION_UNKNOWN_DOMAIN));
- EXPECT_EQ(management_overview_data_notice,
- l10n_util::GetStringUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_DATA));
- EXPECT_EQ(management_overview_setup_notice,
- l10n_util::GetStringUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_SETUP));
EXPECT_TRUE(managed);
}
@@ -246,21 +215,14 @@ TEST_F(ManagementUIHandlerTests,
auto profile = builder.Build();
base::string16 extension_reporting_title;
- base::string16 browser_management_notice;
base::string16 subtitle;
- base::string16 management_overview;
- base::string16 management_overview_data_notice;
- base::string16 management_overview_setup_notice;
+ base::string16 browser_management_notice;
bool managed;
- ContextualManagementSourceUpdate extracted{&extension_reporting_title,
- &browser_management_notice,
- &subtitle,
- &management_overview,
- &management_overview_data_notice,
- &management_overview_setup_notice,
- &managed};
+ ContextualManagementSourceUpdate extracted{
+ &extension_reporting_title, &subtitle, &browser_management_notice,
+ &managed};
- handler_.SetManagedForTesting(false);
+ handler_.SetAccountManagedForTesting(false);
auto data = handler_.GetContextualManagedDataForTesting(profile.get());
ExtractContextualSourceUpdate(data, extracted);
@@ -275,9 +237,6 @@ TEST_F(ManagementUIHandlerTests,
base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
EXPECT_EQ(subtitle,
l10n_util::GetStringUTF16(IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE));
- EXPECT_EQ(management_overview, base::string16());
- EXPECT_EQ(management_overview_data_notice, base::string16());
- EXPECT_EQ(management_overview_setup_notice, base::string16());
EXPECT_FALSE(managed);
}
@@ -288,21 +247,14 @@ TEST_F(ManagementUIHandlerTests,
auto profile = builder.Build();
base::string16 extension_reporting_title;
- base::string16 browser_management_notice;
base::string16 subtitle;
- base::string16 management_overview;
- base::string16 management_overview_data_notice;
- base::string16 management_overview_setup_notice;
+ base::string16 browser_management_notice;
bool managed;
- ContextualManagementSourceUpdate extracted{&extension_reporting_title,
- &browser_management_notice,
- &subtitle,
- &management_overview,
- &management_overview_data_notice,
- &management_overview_setup_notice,
- &managed};
+ ContextualManagementSourceUpdate extracted{
+ &extension_reporting_title, &subtitle, &browser_management_notice,
+ &managed};
- handler_.SetManagedForTesting(false);
+ handler_.SetAccountManagedForTesting(false);
auto data = handler_.GetContextualManagedDataForTesting(profile.get());
ExtractContextualSourceUpdate(data, extracted);
@@ -316,9 +268,6 @@ TEST_F(ManagementUIHandlerTests,
base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
EXPECT_EQ(subtitle,
l10n_util::GetStringUTF16(IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE));
- EXPECT_EQ(management_overview, base::string16());
- EXPECT_EQ(management_overview_data_notice, base::string16());
- EXPECT_EQ(management_overview_setup_notice, base::string16());
EXPECT_FALSE(managed);
}
@@ -329,44 +278,29 @@ TEST_F(ManagementUIHandlerTests,
auto profile = builder.Build();
base::string16 extension_reporting_title;
- base::string16 browser_management_notice;
base::string16 subtitle;
- base::string16 management_overview;
- base::string16 management_overview_data_notice;
- base::string16 management_overview_setup_notice;
+ base::string16 browser_management_notice;
bool managed;
- ContextualManagementSourceUpdate extracted{&extension_reporting_title,
- &browser_management_notice,
- &subtitle,
- &management_overview,
- &management_overview_data_notice,
- &management_overview_setup_notice,
- &managed};
-
- handler_.SetManagedForTesting(true);
+ ContextualManagementSourceUpdate extracted{
+ &extension_reporting_title, &subtitle, &browser_management_notice,
+ &managed};
+
+ handler_.SetAccountManagedForTesting(true);
+ handler_.SetDeviceManagedForTesting(false);
auto data = handler_.GetContextualManagedDataForTesting(profile.get());
ExtractContextualSourceUpdate(data, extracted);
- EXPECT_EQ(data.DictSize(), 5u);
+ EXPECT_EQ(data.DictSize(), 4u);
EXPECT_EQ(extension_reporting_title,
l10n_util::GetStringFUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED_BY,
base::UTF8ToUTF16("manager.com")));
- EXPECT_EQ(
- browser_management_notice,
- l10n_util::GetStringFUTF16(
- IDS_MANAGEMENT_MANAGEMENT_BY_NOTICE, base::UTF8ToUTF16("manager.com"),
- base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
+ EXPECT_EQ(browser_management_notice,
+ l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_BROWSER_NOTICE,
+ base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
EXPECT_EQ(subtitle,
l10n_util::GetStringFUTF16(IDS_MANAGEMENT_SUBTITLE_MANAGED_BY,
base::UTF8ToUTF16("manager.com")));
- EXPECT_EQ(
- management_overview,
- l10n_util::GetStringFUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_CLARIFICATION,
- base::UTF8ToUTF16("manager.com")));
- EXPECT_EQ(management_overview_data_notice,
- l10n_util::GetStringUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_DATA));
- EXPECT_EQ(management_overview_setup_notice,
- l10n_util::GetStringUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_SETUP));
EXPECT_TRUE(managed);
}
@@ -380,29 +314,152 @@ TEST_F(ManagementUIHandlerTests,
auto profile = builder.Build();
const auto device_type = ui::GetChromeOSDeviceTypeResourceId();
- base::string16 extensions_installed;
- base::string16 browser_management_notice;
+ base::string16 extension_reporting_title;
base::string16 subtitle;
base::string16 management_overview;
- base::string16 management_overview_data_notice;
- base::string16 management_overview_setup_notice;
bool managed;
- ContextualManagementSourceUpdate extracted{&extensions_installed,
- &browser_management_notice,
- &subtitle,
- &management_overview,
- &management_overview_data_notice,
- &management_overview_setup_notice,
- &managed};
-
- handler_.SetManagedForTesting(true);
+ ContextualManagementSourceUpdate extracted{
+ &extension_reporting_title, &subtitle, &management_overview, &managed};
+
+ handler_.SetAccountManagedForTesting(true);
+ handler_.SetDeviceManagedForTesting(false);
+ handler_.SetDeviceDomain("");
auto data = handler_.GetContextualManagedDataForTesting(profile.get());
ExtractContextualSourceUpdate(data, extracted);
+ EXPECT_EQ(extension_reporting_title,
+ l10n_util::GetStringFUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED_BY,
+ base::UTF8ToUTF16("manager.com")));
EXPECT_EQ(subtitle,
l10n_util::GetStringFUTF16(IDS_MANAGEMENT_SUBTITLE_MANAGED_BY,
l10n_util::GetStringUTF16(device_type),
base::UTF8ToUTF16("manager.com")));
+ EXPECT_EQ(management_overview,
+ l10n_util::GetStringFUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_BY,
+ base::UTF8ToUTF16("manager.com")));
+ EXPECT_TRUE(managed);
+}
+
+TEST_F(ManagementUIHandlerTests,
+ ManagementContextualSourceUpdateManagedAccountUnknownDomain) {
+ TestingProfile::Builder builder;
+ auto profile = builder.Build();
+ const auto device_type = ui::GetChromeOSDeviceTypeResourceId();
+
+ base::string16 extension_reporting_title;
+ base::string16 subtitle;
+ base::string16 management_overview;
+ bool managed;
+ ContextualManagementSourceUpdate extracted{
+ &extension_reporting_title, &subtitle, &management_overview, &managed};
+
+ handler_.SetAccountManagedForTesting(true);
+ handler_.SetDeviceManagedForTesting(false);
+ handler_.SetDeviceDomain("");
+ auto data = handler_.GetContextualManagedDataForTesting(profile.get());
+ ExtractContextualSourceUpdate(data, extracted);
+
+ EXPECT_EQ(extension_reporting_title,
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED));
+ EXPECT_EQ(subtitle,
+ l10n_util::GetStringFUTF16(IDS_MANAGEMENT_SUBTITLE_MANAGED,
+ l10n_util::GetStringUTF16(device_type)));
+ EXPECT_EQ(management_overview, base::string16());
+ EXPECT_TRUE(managed);
+}
+
+TEST_F(ManagementUIHandlerTests,
+ ManagementContextualSourceUpdateManagedDevice) {
+ TestingProfile::Builder builder;
+ builder.SetProfileName("managed@manager.com");
+ auto profile = builder.Build();
+ const auto device_type = ui::GetChromeOSDeviceTypeResourceId();
+
+ base::string16 extension_reporting_title;
+ base::string16 subtitle;
+ base::string16 management_overview;
+ bool managed;
+ ContextualManagementSourceUpdate extracted{
+ &extension_reporting_title, &subtitle, &management_overview, &managed};
+
+ handler_.SetAccountManagedForTesting(false);
+ handler_.SetDeviceManagedForTesting(true);
+ auto data = handler_.GetContextualManagedDataForTesting(profile.get());
+ ExtractContextualSourceUpdate(data, extracted);
+
+ EXPECT_EQ(subtitle,
+ l10n_util::GetStringFUTF16(IDS_MANAGEMENT_SUBTITLE_MANAGED_BY,
+ l10n_util::GetStringUTF16(device_type),
+ device_domain()));
+ EXPECT_EQ(extension_reporting_title,
+ l10n_util::GetStringFUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED_BY,
+ device_domain()));
+ EXPECT_EQ(management_overview, base::string16());
+ EXPECT_TRUE(managed);
+}
+
+TEST_F(ManagementUIHandlerTests,
+ ManagementContextualSourceUpdateManagedDeviceAndAccount) {
+ TestingProfile::Builder builder;
+ builder.SetProfileName("managed@devicedomain.com");
+ auto profile = builder.Build();
+ const auto device_type = ui::GetChromeOSDeviceTypeResourceId();
+
+ base::string16 extension_reporting_title;
+ base::string16 subtitle;
+ base::string16 management_overview;
+ bool managed;
+ ContextualManagementSourceUpdate extracted{
+ &extension_reporting_title, &subtitle, &management_overview, &managed};
+
+ handler_.SetAccountManagedForTesting(true);
+ handler_.SetDeviceManagedForTesting(true);
+ auto data = handler_.GetContextualManagedDataForTesting(profile.get());
+ ExtractContextualSourceUpdate(data, extracted);
+
+ EXPECT_EQ(subtitle,
+ l10n_util::GetStringFUTF16(IDS_MANAGEMENT_SUBTITLE_MANAGED_BY,
+ l10n_util::GetStringUTF16(device_type),
+ device_domain()));
+ EXPECT_EQ(extension_reporting_title,
+ l10n_util::GetStringFUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED_BY,
+ device_domain()));
+ EXPECT_EQ(management_overview,
+ l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_DEVICE_AND_ACCOUNT_MANAGED_BY, device_domain()));
+ EXPECT_TRUE(managed);
+}
+
+TEST_F(ManagementUIHandlerTests,
+ ManagementContextualSourceUpdateManagedDeviceAndAccountMultipleDomains) {
+ TestingProfile::Builder builder;
+ builder.SetProfileName("managed@manager.com");
+ auto profile = builder.Build();
+ const auto device_type = ui::GetChromeOSDeviceTypeResourceId();
+
+ base::string16 extension_reporting_title;
+ base::string16 subtitle;
+ base::string16 management_overview;
+ bool managed;
+ ContextualManagementSourceUpdate extracted{
+ &extension_reporting_title, &subtitle, &management_overview, &managed};
+
+ handler_.SetAccountManagedForTesting(true);
+ handler_.SetDeviceManagedForTesting(true);
+ auto data = handler_.GetContextualManagedDataForTesting(profile.get());
+ ExtractContextualSourceUpdate(data, extracted);
+
+ EXPECT_EQ(subtitle,
+ l10n_util::GetStringFUTF16(IDS_MANAGEMENT_SUBTITLE_MANAGED_BY,
+ l10n_util::GetStringUTF16(device_type),
+ device_domain()));
+ EXPECT_EQ(extension_reporting_title,
+ l10n_util::GetStringFUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED_BY,
+ device_domain()));
+ EXPECT_EQ(management_overview,
+ l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_DEVICE_MANAGED_BY_ACCOUNT_MANAGED_BY,
+ device_domain(), base::UTF8ToUTF16("manager.com")));
EXPECT_TRUE(managed);
}
@@ -411,26 +468,23 @@ TEST_F(ManagementUIHandlerTests, ManagementContextualSourceUpdateUnmanaged) {
const auto device_type = ui::GetChromeOSDeviceTypeResourceId();
base::string16 extension_reporting_title;
- base::string16 browser_management_notice;
base::string16 subtitle;
base::string16 management_overview;
- base::string16 management_overview_data_notice;
- base::string16 management_overview_setup_notice;
bool managed;
- ContextualManagementSourceUpdate extracted{&extension_reporting_title,
- &browser_management_notice,
- &subtitle,
- &management_overview,
- &management_overview_data_notice,
- &management_overview_setup_notice,
- &managed};
-
- handler_.SetManagedForTesting(false);
+ ContextualManagementSourceUpdate extracted{
+ &extension_reporting_title, &subtitle, &management_overview, &managed};
+
+ handler_.SetAccountManagedForTesting(false);
+ handler_.SetDeviceDomain("");
auto data = handler_.GetContextualManagedDataForTesting(profile.get());
ExtractContextualSourceUpdate(data, extracted);
EXPECT_EQ(subtitle,
l10n_util::GetStringFUTF16(IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE,
l10n_util::GetStringUTF16(device_type)));
+ EXPECT_EQ(extension_reporting_title,
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED));
+ EXPECT_EQ(management_overview,
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_DEVICE_NOT_MANAGED));
EXPECT_FALSE(managed);
}
#endif
diff --git a/chromium/chrome/browser/ui/webui/ntp_tiles_internals_ui.cc b/chromium/chrome/browser/ui/webui/ntp_tiles_internals_ui.cc
index 82ed17f9101..95eb3572e8b 100644
--- a/chromium/chrome/browser/ui/webui/ntp_tiles_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/ntp_tiles_internals_ui.cc
@@ -87,6 +87,7 @@ bool ChromeNTPTilesInternalsMessageHandlerClient::DoesSourceExist(
return false;
#endif
case ntp_tiles::TileSource::CUSTOM_LINKS:
+ case ntp_tiles::TileSource::SEARCH_PAGE:
#if !defined(OS_ANDROID)
return true;
#else
diff --git a/chromium/chrome/browser/ui/webui/settings/about_handler.cc b/chromium/chrome/browser/ui/webui/settings/about_handler.cc
index 2ae0eb80edd..cbf766eaff5 100644
--- a/chromium/chrome/browser/ui/webui/settings/about_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/about_handler.cc
@@ -96,11 +96,19 @@ struct RegulatoryLabel {
const std::string image_url;
};
-bool ShouldShowSafetyInfo() {
+// Returns the link to the safety info for the device (if it exists).
+std::string GetSafetyInfoLink() {
const std::vector<std::string> board =
base::SplitString(base::SysInfo::GetLsbReleaseBoard(), "-",
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
- return board[0] == "nocturne";
+ if (board[0] == "nocturne") {
+ return chrome::kChromeUISafetyPixelSlateURL;
+ }
+ if (board[0] == "eve" || board[0] == "atlas") {
+ return chrome::kChromeUISafetyPixelbookURL;
+ }
+
+ return std::string();
}
// Returns message that informs user that for update it's better to
@@ -329,13 +337,14 @@ AboutHandler* AboutHandler::Create(content::WebUIDataSource* html_source,
#endif
#if defined(OS_CHROMEOS)
- html_source->AddBoolean("shouldShowSafetyInfo", ShouldShowSafetyInfo());
+ std::string safetyInfoLink = GetSafetyInfoLink();
+ html_source->AddBoolean("shouldShowSafetyInfo", !safetyInfoLink.empty());
#if defined(GOOGLE_CHROME_BUILD)
html_source->AddString(
"aboutProductSafety",
l10n_util::GetStringUTF16(IDS_ABOUT_SAFETY_INFORMATION));
html_source->AddString("aboutProductSafetyURL",
- base::UTF8ToUTF16(chrome::kChromeUISafetyURL));
+ base::UTF8ToUTF16(safetyInfoLink));
#endif
base::string16 os_license = l10n_util::GetStringFUTF16(
diff --git a/chromium/chrome/browser/ui/webui/sync_internals_browsertest.js b/chromium/chrome/browser/ui/webui/sync_internals_browsertest.js
index ede567340a8..9a179ff2576 100644
--- a/chromium/chrome/browser/ui/webui/sync_internals_browsertest.js
+++ b/chromium/chrome/browser/ui/webui/sync_internals_browsertest.js
@@ -260,8 +260,9 @@ GEN('#else');
// set.
TEST_F('SyncInternalsWebUITest', 'SyncDisabledByDefault', function() {
expectTrue(this.hasInDetails(true, 'Transport State', 'Disabled'));
- expectTrue(
- this.hasInDetails(true, 'Disable Reasons', 'Not signed in, User choice'));
+ // TODO(crbug.com/906034,crbug.com/973770): Sort out the proper default value
+ // for IsSyncRequested() and possibly add the "User choice" disable reason.
+ expectTrue(this.hasInDetails(true, 'Disable Reasons', 'Not signed in'));
expectTrue(this.hasInDetails(true, 'Username', ''));
});
diff --git a/chromium/chrome/browser/ui/webui/welcome/nux_helper.cc b/chromium/chrome/browser/ui/webui/welcome/nux_helper.cc
index a79c297bd7c..393671cfd3e 100644
--- a/chromium/chrome/browser/ui/webui/welcome/nux_helper.cc
+++ b/chromium/chrome/browser/ui/webui/welcome/nux_helper.cc
@@ -80,6 +80,20 @@ bool CanShowSigninModule(const policy::PolicyMap& policies) {
policy::BrowserSigninMode::kDisabled;
}
+#if defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)
+// These feature flags are used to tie our experiment to specific studies.
+// go/navi-app-variation for details.
+// TODO(hcarmona): find a solution that scales better.
+const base::Feature kNaviControlEnabled = {"NaviControlEnabled",
+ base::FEATURE_DISABLED_BY_DEFAULT};
+const base::Feature kNaviAppVariationEnabled = {
+ "NaviAppVariationEnabled", base::FEATURE_DISABLED_BY_DEFAULT};
+const base::Feature kNaviNTPVariationEnabled = {
+ "NaviNTPVariationEnabled", base::FEATURE_DISABLED_BY_DEFAULT};
+const base::Feature kNaviShortcutVariationEnabled = {
+ "NaviShortcutVariationEnabled", base::FEATURE_DISABLED_BY_DEFAULT};
+#endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)
+
// This feature flag is used to force the feature to be turned on for non-win
// and non-branded builds, like with tests or development on other platforms.
const base::Feature kNuxOnboardingForceEnabled = {
@@ -164,6 +178,17 @@ bool IsNuxOnboardingEnabled(Profile* profile) {
ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial(
"NaviOnboardingSynthetic", onboard_group);
+ // Check for feature based on onboarding group.
+ // TODO(hcarmona): find a solution that scales better.
+ if (onboard_group.compare("ControlSynthetic-008") == 0)
+ base::FeatureList::IsEnabled(kNaviControlEnabled);
+ else if (onboard_group.compare("AppVariationSynthetic-008") == 0)
+ base::FeatureList::IsEnabled(kNaviAppVariationEnabled);
+ else if (onboard_group.compare("NTPVariationSynthetic-008") == 0)
+ base::FeatureList::IsEnabled(kNaviNTPVariationEnabled);
+ else if (onboard_group.compare("ShortcutVariationSynthetic-008") == 0)
+ base::FeatureList::IsEnabled(kNaviShortcutVariationEnabled);
+
if (base::FeatureList::IsEnabled(nux::kNuxOnboardingFeature)) {
return true;
}