summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/ui/webui/settings
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/chrome/browser/ui/webui/settings')
-rw-r--r--chromium/chrome/browser/ui/webui/settings/about_handler.cc24
-rw-r--r--chromium/chrome/browser/ui/webui/settings/appearance_handler.cc47
-rw-r--r--chromium/chrome/browser/ui/webui/settings/appearance_handler.h14
-rw-r--r--chromium/chrome/browser/ui/webui/settings/change_password_handler.cc27
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chrome_cleanup_handler_win.cc11
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chrome_cleanup_handler_win_unittest.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/accessibility_handler.cc9
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/accessibility_handler.h5
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.cc44
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h3
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/android_apps_handler.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/android_apps_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/app_management/OWNERS4
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.cc55
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.h45
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc32
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h9
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc11
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler_unittest.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc11
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/date_time_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/device_pointer_handler.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.cc86
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.h24
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.cc5
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.cc16
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/internet_handler.cc87
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/internet_handler.h31
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler.cc34
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler.h3
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler_unittest.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.cc62
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.h13
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/parental_controls_handler.cc42
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/parental_controls_handler.h3
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/plugin_vm_handler.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/plugin_vm_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/wallpaper_handler.cc67
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/wallpaper_handler.h56
-rw-r--r--chromium/chrome/browser/ui/webui/settings/downloads_handler_unittest.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/settings/metrics_reporting_handler_unittest.cc16
-rw-r--r--chromium/chrome/browser/ui/webui/settings/on_startup_handler_unittest.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/settings/people_handler.cc31
-rw-r--r--chromium/chrome/browser/ui/webui/settings/people_handler.h1
-rw-r--r--chromium/chrome/browser/ui/webui/settings/people_handler_unittest.cc20
-rw-r--r--chromium/chrome/browser/ui/webui/settings/profile_info_handler_unittest.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/settings/reset_settings_handler.cc10
-rw-r--r--chromium/chrome/browser/ui/webui/settings/reset_settings_handler_unittest.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/settings/search_engines_handler.cc8
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.cc32
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.h9
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_import_data_handler.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc231
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_manage_profile_handler_unittest.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.cc284
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.h61
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_ui.cc81
-rw-r--r--chromium/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc22
-rw-r--r--chromium/chrome/browser/ui/webui/settings/tts_handler.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/settings/tts_handler.h2
68 files changed, 1252 insertions, 529 deletions
diff --git a/chromium/chrome/browser/ui/webui/settings/about_handler.cc b/chromium/chrome/browser/ui/webui/settings/about_handler.cc
index 517f2c413cb..7245f9a91e3 100644
--- a/chromium/chrome/browser/ui/webui/settings/about_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/about_handler.cc
@@ -25,6 +25,7 @@
#include "base/task/post_task.h"
#include "base/time/time.h"
#include "base/values.h"
+#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_content_browser_client.h"
@@ -325,7 +326,7 @@ AboutHandler* AboutHandler::Create(content::WebUIDataSource* html_source,
html_source->AddString("aboutObsoleteSystemURL",
ObsoleteSystem::GetLinkURL());
-#if defined(GOOGLE_CHROME_BUILD)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
base::string16 tos = l10n_util::GetStringFUTF16(
IDS_ABOUT_TERMS_OF_SERVICE, base::UTF8ToUTF16(chrome::kChromeUITermsURL));
html_source->AddString("aboutProductTos", tos);
@@ -334,7 +335,7 @@ AboutHandler* AboutHandler::Create(content::WebUIDataSource* html_source,
#if defined(OS_CHROMEOS)
std::string safetyInfoLink = GetSafetyInfoLink();
html_source->AddBoolean("shouldShowSafetyInfo", !safetyInfoLink.empty());
-#if defined(GOOGLE_CHROME_BUILD)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
html_source->AddString(
"aboutProductSafety",
l10n_util::GetStringUTF16(IDS_ABOUT_SAFETY_INFORMATION));
@@ -450,9 +451,9 @@ void AboutHandler::RegisterMessages() {
void AboutHandler::OnJavascriptAllowed() {
apply_changes_from_upgrade_observer_ = true;
version_updater_.reset(VersionUpdater::Create(web_ui()->GetWebContents()));
- policy_registrar_.reset(new policy::PolicyChangeRegistrar(
+ policy_registrar_ = std::make_unique<policy::PolicyChangeRegistrar>(
g_browser_process->policy_service(),
- policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string())));
+ policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string()));
policy_registrar_->Observe(
policy::key::kDeviceAutoUpdateDisabled,
base::Bind(&AboutHandler::OnDeviceAutoUpdatePolicyChanged,
@@ -604,8 +605,9 @@ void AboutHandler::HandleGetVersionInfo(const base::ListValue* args) {
std::string callback_id;
CHECK(args->GetString(0, &callback_id));
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
+ base::PostTaskAndReplyWithResult(
+ FROM_HERE,
+ {base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE},
base::Bind(&GetVersionInfo),
base::Bind(&AboutHandler::OnGetVersionInfoReady,
weak_factory_.GetWeakPtr(), callback_id));
@@ -622,8 +624,9 @@ void AboutHandler::HandleGetRegulatoryInfo(const base::ListValue* args) {
std::string callback_id;
CHECK(args->GetString(0, &callback_id));
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
+ base::PostTaskAndReplyWithResult(
+ FROM_HERE,
+ {base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE},
base::Bind(&FindRegulatoryLabelDir),
base::Bind(&AboutHandler::OnRegulatoryLabelDirFound,
weak_factory_.GetWeakPtr(), callback_id));
@@ -801,8 +804,9 @@ void AboutHandler::OnRegulatoryLabelDirFound(
return;
}
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
+ base::PostTaskAndReplyWithResult(
+ FROM_HERE,
+ {base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE},
base::Bind(&ReadRegulatoryLabelText, label_dir_path),
base::Bind(&AboutHandler::OnRegulatoryLabelTextRead,
weak_factory_.GetWeakPtr(), callback_id, label_dir_path));
diff --git a/chromium/chrome/browser/ui/webui/settings/appearance_handler.cc b/chromium/chrome/browser/ui/webui/settings/appearance_handler.cc
index 86695044727..4fceb887f1c 100644
--- a/chromium/chrome/browser/ui/webui/settings/appearance_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/appearance_handler.cc
@@ -12,10 +12,6 @@
#include "chrome/browser/themes/theme_service_factory.h"
#include "content/public/browser/web_ui.h"
-#if defined(OS_CHROMEOS)
-#include "chrome/browser/ui/ash/wallpaper_controller_client.h"
-#endif
-
namespace settings {
AppearanceHandler::AppearanceHandler(content::WebUI* webui)
@@ -37,22 +33,6 @@ void AppearanceHandler::RegisterMessages() {
base::BindRepeating(&AppearanceHandler::HandleUseSystemTheme,
base::Unretained(this)));
#endif
-#if defined(OS_CHROMEOS)
- web_ui()->RegisterMessageCallback(
- "openWallpaperManager",
- base::BindRepeating(&AppearanceHandler::HandleOpenWallpaperManager,
- base::Unretained(this)));
-
- web_ui()->RegisterMessageCallback(
- "isWallpaperSettingVisible",
- base::BindRepeating(&AppearanceHandler::IsWallpaperSettingVisible,
- base::Unretained(this)));
-
- web_ui()->RegisterMessageCallback(
- "isWallpaperPolicyControlled",
- base::BindRepeating(&AppearanceHandler::IsWallpaperPolicyControlled,
- base::Unretained(this)));
-#endif
}
void AppearanceHandler::HandleUseDefaultTheme(const base::ListValue* args) {
@@ -68,31 +48,4 @@ void AppearanceHandler::HandleUseSystemTheme(const base::ListValue* args) {
}
#endif
-#if defined(OS_CHROMEOS)
-void AppearanceHandler::IsWallpaperSettingVisible(const base::ListValue* args) {
- CHECK_EQ(args->GetSize(), 1U);
- bool result = WallpaperControllerClient::Get()->ShouldShowWallpaperSetting();
- ResolveCallback(args->GetList()[0], result);
-}
-
-void AppearanceHandler::IsWallpaperPolicyControlled(
- const base::ListValue* args) {
- CHECK_EQ(args->GetSize(), 1U);
- bool result = WallpaperControllerClient::Get()
- ->IsActiveUserWallpaperControlledByPolicy();
- ResolveCallback(args->GetList()[0], result);
-}
-
-void AppearanceHandler::HandleOpenWallpaperManager(
- const base::ListValue* args) {
- WallpaperControllerClient::Get()->OpenWallpaperPickerIfAllowed();
-}
-
-void AppearanceHandler::ResolveCallback(const base::Value& callback_id,
- bool result) {
- AllowJavascript();
- ResolveJavascriptCallback(callback_id, base::Value(result));
-}
-#endif
-
} // namespace settings
diff --git a/chromium/chrome/browser/ui/webui/settings/appearance_handler.h b/chromium/chrome/browser/ui/webui/settings/appearance_handler.h
index dabbd53601d..961e16eec2d 100644
--- a/chromium/chrome/browser/ui/webui/settings/appearance_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/appearance_handler.h
@@ -41,20 +41,6 @@ class AppearanceHandler : public SettingsPageUIHandler {
void HandleUseSystemTheme(const base::ListValue* args);
#endif
-#if defined(OS_CHROMEOS)
- // Whether the wallpaper setting should be shown.
- void IsWallpaperSettingVisible(const base::ListValue* args);
-
- // Whether the wallpaper is policy controlled.
- void IsWallpaperPolicyControlled(const base::ListValue* args);
-
- // Open the wallpaper manager app.
- void HandleOpenWallpaperManager(const base::ListValue* args);
-
- // Helper function to resolve the Javascript callback.
- void ResolveCallback(const base::Value& callback_id, bool result);
-#endif
-
Profile* profile_; // Weak pointer.
base::WeakPtrFactory<AppearanceHandler> weak_ptr_factory_{this};
diff --git a/chromium/chrome/browser/ui/webui/settings/change_password_handler.cc b/chromium/chrome/browser/ui/webui/settings/change_password_handler.cc
index 7047d2983da..b34815f9c76 100644
--- a/chromium/chrome/browser/ui/webui/settings/change_password_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/change_password_handler.cc
@@ -7,8 +7,9 @@
#include "base/bind.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/chrome_password_protection_service.h"
-#include "components/password_manager/core/browser/password_manager_metrics_util.h"
#include "components/prefs/pref_service.h"
+#include "components/safe_browsing/password_protection/metrics_util.h"
+#include "components/safe_browsing/proto/csd.pb.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
@@ -16,6 +17,8 @@ namespace settings {
using password_manager::metrics_util::PasswordType;
using safe_browsing::ChromePasswordProtectionService;
+using safe_browsing::LoginReputationClientResponse;
+using safe_browsing::RequestOutcome;
ChangePasswordHandler::ChangePasswordHandler(
Profile* profile,
@@ -40,7 +43,7 @@ void ChangePasswordHandler::RegisterMessages() {
void ChangePasswordHandler::OnJavascriptAllowed() {
pref_registrar_.Init(profile_->GetPrefs());
pref_registrar_.Add(
- prefs::kSafeBrowsingUnhandledSyncPasswordReuses,
+ prefs::kSafeBrowsingUnhandledGaiaPasswordReuses,
base::Bind(&ChangePasswordHandler::UpdateChangePasswordCardVisibility,
base::Unretained(this)));
}
@@ -55,18 +58,24 @@ void ChangePasswordHandler::HandleInitialize(const base::ListValue* args) {
}
void ChangePasswordHandler::HandleChangePassword(const base::ListValue* args) {
- service_->OnUserAction(web_ui()->GetWebContents(),
- PasswordType::PRIMARY_ACCOUNT_PASSWORD,
- safe_browsing::WarningUIType::CHROME_SETTINGS,
- safe_browsing::WarningAction::CHANGE_PASSWORD);
+ service_->OnUserAction(
+ web_ui()->GetWebContents(),
+ service_->reused_password_account_type_for_last_shown_warning(),
+ RequestOutcome::UNKNOWN,
+ LoginReputationClientResponse::VERDICT_TYPE_UNSPECIFIED, "unused_token",
+ safe_browsing::WarningUIType::CHROME_SETTINGS,
+ safe_browsing::WarningAction::CHANGE_PASSWORD);
}
void ChangePasswordHandler::UpdateChangePasswordCardVisibility() {
FireWebUIListener(
"change-password-visibility",
- base::Value(service_->IsWarningEnabled() &&
- safe_browsing::ChromePasswordProtectionService::
- ShouldShowChangePasswordSettingUI(profile_)));
+ base::Value(
+ service_->IsWarningEnabled(
+ service_
+ ->reused_password_account_type_for_last_shown_warning()) &&
+ safe_browsing::ChromePasswordProtectionService::
+ ShouldShowChangePasswordSettingUI(profile_)));
}
} // namespace settings
diff --git a/chromium/chrome/browser/ui/webui/settings/chrome_cleanup_handler_win.cc b/chromium/chrome/browser/ui/webui/settings/chrome_cleanup_handler_win.cc
index d7a9cd51101..37f8b056c86 100644
--- a/chromium/chrome/browser/ui/webui/settings/chrome_cleanup_handler_win.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chrome_cleanup_handler_win.cc
@@ -18,6 +18,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/lock.h"
#include "base/values.h"
+#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -119,7 +120,7 @@ void ChromeCleanupHandler::GetExtensionNamesFromIds(
Profile* profile,
const std::set<base::string16>& extension_ids,
std::set<base::string16>* extension_names) {
-#if defined(GOOGLE_CHROME_BUILD)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
extensions::ExtensionRegistry* extension_registry =
extensions::ExtensionRegistry::Get(profile);
for (const base::string16& extension_id : extension_ids) {
@@ -303,16 +304,16 @@ void ChromeCleanupHandler::HandleNotifyChromeCleanupLearnMoreClicked(
void ChromeCleanupHandler::HandleGetMoreItemsPluralString(
const base::ListValue* args) {
-#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
+#if defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
GetPluralString(IDS_SETTINGS_RESET_CLEANUP_DETAILS_MORE, args);
-#endif // defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
+#endif // defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
}
void ChromeCleanupHandler::HandleGetItemsToRemovePluralString(
const base::ListValue* args) {
-#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
+#if defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
GetPluralString(IDS_SETTINGS_RESET_CLEANUP_DETAILS_ITEMS_TO_BE_REMOVED, args);
-#endif // defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
+#endif // defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
}
void ChromeCleanupHandler::GetPluralString(int id,
diff --git a/chromium/chrome/browser/ui/webui/settings/chrome_cleanup_handler_win_unittest.cc b/chromium/chrome/browser/ui/webui/settings/chrome_cleanup_handler_win_unittest.cc
index a9fb0bb1553..cff17fb6870 100644
--- a/chromium/chrome/browser/ui/webui/settings/chrome_cleanup_handler_win_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chrome_cleanup_handler_win_unittest.cc
@@ -4,12 +4,13 @@
#include "chrome/browser/ui/webui/settings/chrome_cleanup_handler_win.h"
+#include "build/branding_buildflags.h"
#include "chrome/browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_process_win.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h"
-#include "content/public/test/test_browser_thread_bundle.h"
+#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
@@ -19,7 +20,7 @@ namespace settings {
using safe_browsing::MockChromeCleanerProcess;
TEST(ChromeCleanupHandlerTest, GetExtensionsNamesFromIds) {
- content::TestBrowserThreadBundle test_browser_thread_bundle_;
+ content::BrowserTaskEnvironment task_environment_;
TestingProfileManager profile_manager_(TestingBrowserProcess::GetGlobal());
// Set up the testing profile to get the extensions registry from it.
@@ -35,7 +36,7 @@ TEST(ChromeCleanupHandlerTest, GetExtensionsNamesFromIds) {
};
std::set<base::string16> expected_names = {
-#if defined(GOOGLE_CHROME_BUILD)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
// Extension names are only available in Google-branded builds.
MockChromeCleanerProcess::kInstalledExtensionName1,
MockChromeCleanerProcess::kInstalledExtensionName2,
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/accessibility_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/accessibility_handler.cc
index 56f573121d0..34dbb5b6fac 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/accessibility_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/accessibility_handler.cc
@@ -35,10 +35,6 @@ void AccessibilityHandler::RegisterMessages() {
&AccessibilityHandler::HandleShowSelectToSpeakSettings,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
- "showSwitchAccessSettings",
- base::BindRepeating(&AccessibilityHandler::HandleShowSwitchAccessSettings,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
"getStartupSoundEnabled",
base::BindRepeating(&AccessibilityHandler::HandleGetStartupSoundEnabled,
base::Unretained(this)));
@@ -58,11 +54,6 @@ void AccessibilityHandler::HandleShowSelectToSpeakSettings(
OpenExtensionOptionsPage(extension_misc::kSelectToSpeakExtensionId);
}
-void AccessibilityHandler::HandleShowSwitchAccessSettings(
- const base::ListValue* args) {
- OpenExtensionOptionsPage(extension_misc::kSwitchAccessExtensionId);
-}
-
void AccessibilityHandler::HandleGetStartupSoundEnabled(
const base::ListValue* args) {
AllowJavascript();
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/accessibility_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/accessibility_handler.h
index 26f284ad260..80d735832cb 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/accessibility_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/accessibility_handler.h
@@ -32,11 +32,10 @@ class AccessibilityHandler : public ::settings::SettingsPageUIHandler {
void OnJavascriptDisallowed() override {}
private:
- // Callback for the messages to show settings for ChromeVox,
- // Select To Speak, or Switch Access.
+ // Callback for the messages to show settings for ChromeVox or
+ // Select To Speak.
void HandleShowChromeVoxSettings(const base::ListValue* args);
void HandleShowSelectToSpeakSettings(const base::ListValue* args);
- void HandleShowSwitchAccessSettings(const base::ListValue* args);
void HandleGetStartupSoundEnabled(const base::ListValue* args);
void HandleSetStartupSoundEnabled(const base::ListValue* args);
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.cc
index e06d7205e11..3978c28d325 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.cc
@@ -101,8 +101,7 @@ AccountManagerUIHandler::AccountManagerUIHandler(
: account_manager_(account_manager),
identity_manager_(identity_manager),
account_manager_observer_(this),
- identity_manager_observer_(this),
- weak_factory_(this) {
+ identity_manager_observer_(this) {
DCHECK(account_manager_);
DCHECK(identity_manager_);
}
@@ -141,21 +140,18 @@ void AccountManagerUIHandler::HandleGetAccounts(const base::ListValue* args) {
AllowJavascript();
const auto& args_list = args->GetList();
- CHECK_EQ(args_list.size(), 2u);
+ CHECK_EQ(args_list.size(), 1u);
CHECK(args_list[0].is_string());
- CHECK(args_list[1].is_bool());
base::Value callback_id = args_list[0].Clone();
- bool include_images = args_list[1].GetBool();
- account_manager_->GetAccounts(base::BindOnce(
- &AccountManagerUIHandler::OnGetAccounts, weak_factory_.GetWeakPtr(),
- std::move(callback_id), include_images));
+ account_manager_->GetAccounts(
+ base::BindOnce(&AccountManagerUIHandler::OnGetAccounts,
+ weak_factory_.GetWeakPtr(), std::move(callback_id)));
}
void AccountManagerUIHandler::OnGetAccounts(
base::Value callback_id,
- bool include_images,
const std::vector<AccountManager::Account>& stored_accounts) {
base::ListValue accounts;
@@ -179,8 +175,9 @@ void AccountManagerUIHandler::OnGetAccounts(
account.SetBoolean("isDeviceAccount", false);
base::Optional<AccountInfo> maybe_account_info =
- identity_manager_->FindAccountInfoForAccountWithRefreshTokenByGaiaId(
- account_key.id);
+ identity_manager_
+ ->FindExtendedAccountInfoForAccountWithRefreshTokenByGaiaId(
+ account_key.id);
DCHECK(maybe_account_info.has_value());
account.SetBoolean(
@@ -189,20 +186,17 @@ void AccountManagerUIHandler::OnGetAccounts(
maybe_account_info->account_id));
account.SetString("fullName", maybe_account_info->full_name);
account.SetString("email", stored_account.raw_email);
- // Images can be large, so only send them if requested.
- if (include_images) {
- if (!maybe_account_info->account_image.IsEmpty()) {
- account.SetString("pic",
- webui::GetBitmapDataUrl(
- maybe_account_info->account_image.AsBitmap()));
- } else {
- gfx::ImageSkia default_icon =
- *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
- IDR_LOGIN_DEFAULT_USER);
- account.SetString(
- "pic", webui::GetBitmapDataUrl(
- default_icon.GetRepresentation(1.0f).GetBitmap()));
- }
+ if (!maybe_account_info->account_image.IsEmpty()) {
+ account.SetString("pic",
+ webui::GetBitmapDataUrl(
+ maybe_account_info->account_image.AsBitmap()));
+ } else {
+ gfx::ImageSkia default_icon =
+ *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
+ IDR_LOGIN_DEFAULT_USER);
+ account.SetString("pic",
+ webui::GetBitmapDataUrl(
+ default_icon.GetRepresentation(1.0f).GetBitmap()));
}
account.SetBoolean("unmigrated",
account_manager_->HasDummyGaiaToken(account_key));
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h
index 071c7cf9b22..c915a10cfa6 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h
@@ -64,7 +64,6 @@ class AccountManagerUIHandler : public ::settings::SettingsPageUIHandler,
// |AccountManager::GetAccounts| callback.
void OnGetAccounts(
base::Value callback_id,
- bool include_images,
const std::vector<AccountManager::Account>& stored_accounts);
// Refreshes the UI.
@@ -86,7 +85,7 @@ class AccountManagerUIHandler : public ::settings::SettingsPageUIHandler,
ScopedObserver<signin::IdentityManager, signin::IdentityManager::Observer>
identity_manager_observer_;
- base::WeakPtrFactory<AccountManagerUIHandler> weak_factory_;
+ base::WeakPtrFactory<AccountManagerUIHandler> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(AccountManagerUIHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/android_apps_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/android_apps_handler.cc
index 4cf92f5fcda..df482d3555e 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/android_apps_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/android_apps_handler.cc
@@ -20,8 +20,7 @@ namespace settings {
AndroidAppsHandler::AndroidAppsHandler(Profile* profile)
: arc_prefs_observer_(this),
arc_session_manager_observer_(this),
- profile_(profile),
- weak_ptr_factory_(this) {}
+ profile_(profile) {}
AndroidAppsHandler::~AndroidAppsHandler() {}
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/android_apps_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/android_apps_handler.h
index cb89bc38224..3a7d0549e7d 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/android_apps_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/android_apps_handler.h
@@ -60,7 +60,7 @@ class AndroidAppsHandler : public ::settings::SettingsPageUIHandler,
ScopedObserver<arc::ArcSessionManager, arc::ArcSessionManager::Observer>
arc_session_manager_observer_;
Profile* profile_; // unowned
- base::WeakPtrFactory<AndroidAppsHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<AndroidAppsHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(AndroidAppsHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/OWNERS b/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/OWNERS
new file mode 100644
index 00000000000..94b2e07d850
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/OWNERS
@@ -0,0 +1,4 @@
+dominickn@chromium.org
+jshikaram@chromium.org
+
+# COMPONENT: Platform>Apps>Foundation
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.cc
new file mode 100644
index 00000000000..8b3abcc9b50
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.cc
@@ -0,0 +1,55 @@
+// Copyright 2018 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.
+
+#include "chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.h"
+
+#include <memory>
+#include <utility>
+
+#include "base/bind.h"
+#include "base/feature_list.h"
+#include "chrome/browser/apps/app_service/app_icon_source.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/app_management/app_management_page_handler.h"
+#include "chrome/grit/browser_resources.h"
+#include "chrome/grit/chromium_strings.h"
+#include "chrome/grit/generated_resources.h"
+#include "components/prefs/pref_service.h"
+#include "content/public/browser/url_data_source.h"
+#include "content/public/browser/web_ui.h"
+#include "content/public/browser/web_ui_data_source.h"
+#include "ui/base/resource/resource_bundle.h"
+
+AppManagementPageHandlerFactory::AppManagementPageHandlerFactory(
+ Profile* profile)
+ : page_factory_binding_(this), profile_(profile) {}
+
+AppManagementPageHandlerFactory::~AppManagementPageHandlerFactory() = default;
+
+void AppManagementPageHandlerFactory::Bind(
+ app_management::mojom::PageHandlerFactoryRequest request) {
+ if (page_factory_binding_.is_bound()) {
+ page_factory_binding_.Unbind();
+ }
+
+ page_factory_binding_.Bind(std::move(request));
+}
+
+void AppManagementPageHandlerFactory::BindPageHandlerFactory(
+ app_management::mojom::PageHandlerFactoryRequest request) {
+ if (page_factory_binding_.is_bound()) {
+ page_factory_binding_.Unbind();
+ }
+
+ page_factory_binding_.Bind(std::move(request));
+}
+
+void AppManagementPageHandlerFactory::CreatePageHandler(
+ app_management::mojom::PagePtr page,
+ app_management::mojom::PageHandlerRequest request) {
+ DCHECK(page);
+
+ page_handler_ = std::make_unique<AppManagementPageHandler>(
+ std::move(request), std::move(page), profile_);
+}
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.h b/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.h
new file mode 100644
index 00000000000..3779071f093
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.h
@@ -0,0 +1,45 @@
+// 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.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_APP_MANAGEMENT_APP_MANAGEMENT_PAGE_HANDLER_FACTORY_H_
+#define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_APP_MANAGEMENT_APP_MANAGEMENT_PAGE_HANDLER_FACTORY_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "chrome/browser/ui/webui/app_management/app_management.mojom.h"
+#include "mojo/public/cpp/bindings/binding.h"
+
+class Profile;
+
+class AppManagementPageHandler;
+
+class AppManagementPageHandlerFactory
+ : public app_management::mojom::PageHandlerFactory {
+ public:
+ explicit AppManagementPageHandlerFactory(Profile* profile);
+ ~AppManagementPageHandlerFactory() override;
+
+ void Bind(app_management::mojom::PageHandlerFactoryRequest request);
+
+ private:
+ void BindPageHandlerFactory(
+ app_management::mojom::PageHandlerFactoryRequest request);
+
+ // app_management::mojom::PageHandlerFactory:
+ void CreatePageHandler(
+ app_management::mojom::PagePtr page,
+ app_management::mojom::PageHandlerRequest request) override;
+
+ std::unique_ptr<AppManagementPageHandler> page_handler_;
+
+ mojo::Binding<app_management::mojom::PageHandlerFactory>
+ page_factory_binding_;
+
+ Profile* profile_;
+
+ DISALLOW_COPY_AND_ASSIGN(AppManagementPageHandlerFactory);
+};
+
+#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_APP_MANAGEMENT_APP_MANAGEMENT_PAGE_HANDLER_FACTORY_H_
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc
index 3a2b3bc5b12..c548d8996f3 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc
@@ -6,12 +6,9 @@
#include <string>
#include <utility>
-#include <vector>
#include "base/bind.h"
#include "base/bind_helpers.h"
-#include "chrome/browser/chromeos/crostini/crostini_export_import.h"
-#include "chrome/browser/chromeos/crostini/crostini_manager.h"
#include "chrome/browser/chromeos/crostini/crostini_util.h"
#include "chrome/browser/chromeos/file_manager/path_util.h"
#include "chrome/browser/chromeos/guest_os/guest_os_share_path.h"
@@ -21,8 +18,7 @@
namespace chromeos {
namespace settings {
-CrostiniHandler::CrostiniHandler(Profile* profile)
- : profile_(profile), weak_ptr_factory_(this) {}
+CrostiniHandler::CrostiniHandler(Profile* profile) : profile_(profile) {}
CrostiniHandler::~CrostiniHandler() {
DisallowJavascript();
@@ -67,6 +63,11 @@ void CrostiniHandler::RegisterMessages() {
base::BindRepeating(
&CrostiniHandler::HandleCrostiniInstallerStatusRequest,
weak_ptr_factory_.GetWeakPtr()));
+ web_ui()->RegisterMessageCallback(
+ "requestCrostiniExportImportOperationStatus",
+ base::BindRepeating(
+ &CrostiniHandler::HandleCrostiniExportImportOperationStatusRequest,
+ weak_ptr_factory_.GetWeakPtr()));
}
void CrostiniHandler::OnJavascriptAllowed() {
@@ -75,6 +76,7 @@ void CrostiniHandler::OnJavascriptAllowed() {
if (chromeos::CrosUsbDetector::Get()) {
chromeos::CrosUsbDetector::Get()->AddUsbDeviceObserver(this);
}
+ crostini::CrostiniExportImport::GetForProfile(profile_)->AddObserver(this);
}
void CrostiniHandler::OnJavascriptDisallowed() {
@@ -86,6 +88,7 @@ void CrostiniHandler::OnJavascriptDisallowed() {
if (chromeos::CrosUsbDetector::Get()) {
chromeos::CrosUsbDetector::Get()->RemoveUsbDeviceObserver(this);
}
+ crostini::CrostiniExportImport::GetForProfile(profile_)->RemoveObserver(this);
}
void CrostiniHandler::HandleRequestCrostiniInstallerView(
@@ -130,7 +133,8 @@ void CrostiniHandler::HandleRemoveCrostiniSharedPath(
vm_name, base::FilePath(path),
/*unpersist=*/true,
base::BindOnce(
- [](const std::string& path, bool result, std::string failure_reason) {
+ [](const std::string& path, bool result,
+ const std::string& failure_reason) {
if (!result) {
LOG(ERROR) << "Error unsharing " << path << ": "
<< failure_reason;
@@ -225,6 +229,15 @@ void CrostiniHandler::HandleCrostiniInstallerStatusRequest(
OnCrostiniInstallerViewStatusChanged(status);
}
+void CrostiniHandler::HandleCrostiniExportImportOperationStatusRequest(
+ const base::ListValue* args) {
+ AllowJavascript();
+ CHECK_EQ(0U, args->GetSize());
+ bool in_progress = crostini::CrostiniExportImport::GetForProfile(profile_)
+ ->GetExportImportOperationStatus();
+ OnCrostiniExportImportOperationStatusChanged(in_progress);
+}
+
void CrostiniHandler::OnCrostiniInstallerViewStatusChanged(bool status) {
// It's technically possible for this to be called before Javascript is
// enabled, in which case we must not call FireWebUIListener
@@ -234,5 +247,12 @@ void CrostiniHandler::OnCrostiniInstallerViewStatusChanged(bool status) {
}
}
+void CrostiniHandler::OnCrostiniExportImportOperationStatusChanged(
+ bool in_progress) {
+ // Other side listens with cr.addWebUIListener
+ FireWebUIListener("crostini-export-import-operation-status-changed",
+ base::Value(in_progress));
+}
+
} // namespace settings
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h
index 97f4605f475..c5d4a353f6e 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h
@@ -8,6 +8,7 @@
#include <vector>
#include "base/memory/weak_ptr.h"
+#include "chrome/browser/chromeos/crostini/crostini_export_import.h"
#include "chrome/browser/chromeos/crostini/crostini_manager.h"
#include "chrome/browser/chromeos/usb/cros_usb_detector.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
@@ -23,6 +24,7 @@ namespace settings {
class CrostiniHandler : public ::settings::SettingsPageUIHandler,
public crostini::InstallerViewStatusObserver,
+ public crostini::CrostiniExportImport::Observer,
public chromeos::CrosUsbDeviceObserver {
public:
explicit CrostiniHandler(Profile* profile);
@@ -56,10 +58,15 @@ class CrostiniHandler : public ::settings::SettingsPageUIHandler,
void HandleCrostiniInstallerStatusRequest(const base::ListValue* args);
// Handle the CrostiniInstallerView opening/closing.
void OnCrostiniInstallerViewStatusChanged(bool open) override;
+ // Handle a request for the CrostiniExportImport operation status.
+ void HandleCrostiniExportImportOperationStatusRequest(
+ const base::ListValue* args);
+ // CrostiniExportImport::Observer:
+ void OnCrostiniExportImportOperationStatusChanged(bool in_progress) override;
Profile* profile_;
// weak_ptr_factory_ should always be last member.
- base::WeakPtrFactory<CrostiniHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<CrostiniHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(CrostiniHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
index b6021b75156..2f4c1749e9a 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
@@ -260,8 +260,7 @@ CupsPrintersHandler::CupsPrintersHandler(
printer_configurer_(std::move(printer_configurer)),
printers_manager_(printers_manager),
endpoint_resolver_(std::make_unique<local_discovery::EndpointResolver>()),
- printers_manager_observer_(this),
- weak_factory_(this) {}
+ printers_manager_observer_(this) {}
// static
std::unique_ptr<CupsPrintersHandler> CupsPrintersHandler::Create(
@@ -745,7 +744,8 @@ void CupsPrintersHandler::OnAddedOrEditedPrinterCommon(
UMA_HISTOGRAM_ENUMERATION("Printing.CUPS.PrinterAdded",
printer.GetProtocol(), Printer::kProtocolMax);
PRINTER_LOG(USER) << "Performing printer setup";
- printers_manager_->PrinterInstalled(printer, is_automatic);
+ printers_manager_->PrinterInstalled(printer, is_automatic,
+ PrinterSetupSource::kSettings);
printers_manager_->SavePrinter(printer);
if (printer.IsUsbProtocol()) {
// Record UMA for USB printer setup source.
@@ -945,8 +945,9 @@ void CupsPrintersHandler::FileSelected(const base::FilePath& path,
// VerifyPpdContents() in order to determine whether the file appears to be a
// PPD file. The task's priority is USER_BLOCKING because the this task
// updates the UI as a result of a direct user action.
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_BLOCKING},
+ base::PostTaskAndReplyWithResult(
+ FROM_HERE,
+ {base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_BLOCKING},
base::BindOnce(&ReadFileToStringWithMaxSize, path, kPpdMaxLineLength),
base::BindOnce(&CupsPrintersHandler::VerifyPpdContents,
weak_factory_.GetWeakPtr(), path));
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.h
index d2b16b0ec44..3fe1146c725 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.h
@@ -232,7 +232,7 @@ class CupsPrintersHandler : public ::settings::SettingsPageUIHandler,
ScopedObserver<CupsPrintersManager, CupsPrintersManager::Observer>
printers_manager_observer_;
- base::WeakPtrFactory<CupsPrintersHandler> weak_factory_;
+ base::WeakPtrFactory<CupsPrintersHandler> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(CupsPrintersHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler_unittest.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler_unittest.cc
index 3a0aa798540..c9c52df5e53 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler_unittest.cc
@@ -13,7 +13,7 @@
#include "chrome/test/base/testing_profile.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/debug_daemon_client.h"
-#include "content/public/test/test_browser_thread_bundle.h"
+#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_web_ui.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -78,7 +78,7 @@ class FakePpdProvider : public PpdProvider {
class CupsPrintersHandlerTest : public testing::Test {
public:
CupsPrintersHandlerTest()
- : thread_bundle_(content::TestBrowserThreadBundle::REAL_IO_THREAD),
+ : task_environment_(content::BrowserTaskEnvironment::REAL_IO_THREAD),
profile_(),
web_ui_(),
printers_handler_() {}
@@ -94,7 +94,7 @@ class CupsPrintersHandlerTest : public testing::Test {
protected:
// Must outlive |profile_|.
- content::TestBrowserThreadBundle thread_bundle_;
+ content::BrowserTaskEnvironment task_environment_;
TestingProfile profile_;
content::TestWebUI web_ui_;
std::unique_ptr<CupsPrintersHandler> printers_handler_;
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc
index 812cffcf10f..e2de1a94c72 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc
@@ -9,12 +9,14 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/logging.h"
+#include "base/time/time.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/child_accounts/parent_access_code/parent_access_service.h"
#include "chrome/browser/chromeos/set_time_dialog.h"
#include "chrome/browser/chromeos/system/timezone_resolver_manager.h"
#include "chrome/browser/chromeos/system/timezone_util.h"
+#include "chrome/common/chrome_features.h"
#include "chrome/common/pref_names.h"
#include "chromeos/constants/chromeos_switches.h"
#include "chromeos/dbus/system_clock/system_clock_client.h"
@@ -64,8 +66,7 @@ bool IsTimezoneAutomaticDetectionUserEditable() {
} // namespace
-DateTimeHandler::DateTimeHandler()
- : scoped_observer_(this), weak_ptr_factory_(this) {}
+DateTimeHandler::DateTimeHandler() : scoped_observer_(this) {}
DateTimeHandler::~DateTimeHandler() = default;
@@ -76,6 +77,9 @@ DateTimeHandler* DateTimeHandler::Create(
html_source->AddString(
"timeZoneID",
system::TimezoneSettings::GetInstance()->GetCurrentTimezoneID());
+ html_source->AddBoolean(
+ "timeActionsProtectedForChild",
+ base::FeatureList::IsEnabled(features::kParentAccessCodeForTimeChange));
return new DateTimeHandler;
}
@@ -165,7 +169,8 @@ void DateTimeHandler::HandleShowParentAccessForTimeZone(
user_manager::UserManager::Get()->GetActiveUser()->GetAccountId(),
base::BindRepeating(&DateTimeHandler::OnParentAccessValidation,
weak_ptr_factory_.GetWeakPtr()),
- ash::ParentAccessRequestReason::kChangeTimezone);
+ ash::ParentAccessRequestReason::kChangeTimezone, false /* extra_dimmer */,
+ base::Time());
}
void DateTimeHandler::OnParentAccessValidation(bool success) {
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/date_time_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/date_time_handler.h
index bd69d936bc8..2a3c44a9b29 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/date_time_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/date_time_handler.h
@@ -75,7 +75,7 @@ class DateTimeHandler : public ::settings::SettingsPageUIHandler,
ScopedObserver<SystemClockClient, SystemClockClient::Observer>
scoped_observer_;
- base::WeakPtrFactory<DateTimeHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<DateTimeHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(DateTimeHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.cc
index de342d5a55e..c38687e6415 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.cc
@@ -5,11 +5,11 @@
#include "chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.h"
#include "ash/public/cpp/keyboard_shortcut_viewer.h"
-#include "ash/public/interfaces/constants.mojom.h"
+#include "ash/public/cpp/tablet_mode.h"
+#include "ash/public/mojom/constants.mojom.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/values.h"
-#include "chrome/browser/ui/ash/tablet_mode_client.h"
#include "chromeos/constants/chromeos_switches.h"
#include "content/public/browser/web_ui.h"
#include "content/public/common/service_manager_connection.h"
@@ -114,8 +114,7 @@ void KeyboardHandler::HandleKeyboardChange(const base::ListValue* args) {
void KeyboardHandler::UpdateKeyboards() {
bool physical_keyboard = false;
// In tablet mode, physical keybards are disabled / ignored.
- if (!TabletModeClient::Get() ||
- !TabletModeClient::Get()->tablet_mode_enabled()) {
+ if (!ash::TabletMode::Get() || !ash::TabletMode::Get()->InTabletMode()) {
physical_keyboard = true;
}
if (!physical_keyboard) {
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/device_pointer_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/device_pointer_handler.cc
index 0f5933cc8a8..f9ac3140904 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/device_pointer_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/device_pointer_handler.cc
@@ -24,7 +24,8 @@ void PointerHandler::RegisterMessages() {
void PointerHandler::OnJavascriptAllowed() {
if (!pointer_device_observer_) {
- pointer_device_observer_.reset(new system::PointerDeviceObserver());
+ pointer_device_observer_ =
+ std::make_unique<system::PointerDeviceObserver>();
pointer_device_observer_->Init();
}
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.cc
index ca32d32706f..79feea807e9 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.cc
@@ -110,9 +110,7 @@ void PowerHandler::TestAPI::SetLidClosedBehavior(
}
PowerHandler::PowerHandler(PrefService* prefs)
- : prefs_(prefs),
- power_manager_client_observer_(this),
- weak_ptr_factory_(this) {}
+ : prefs_(prefs), power_manager_client_observer_(this) {}
PowerHandler::~PowerHandler() {}
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h
index 78869c7978e..a362dcd45be 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h
@@ -130,7 +130,7 @@ class PowerHandler : public ::settings::SettingsPageUIHandler,
bool last_lid_closed_controlled_ = false;
bool last_has_lid_ = true;
- base::WeakPtrFactory<PowerHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<PowerHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(PowerHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.cc
index cf9b1c9342e..b9737dc9919 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.cc
@@ -35,6 +35,7 @@
#include "chromeos/cryptohome/cryptohome_util.h"
#include "chromeos/dbus/cryptohome/cryptohome_client.h"
#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/disks/disk.h"
#include "components/arc/arc_features.h"
#include "components/arc/arc_prefs.h"
#include "components/arc/arc_service_manager.h"
@@ -49,6 +50,9 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/text/bytes_formatting.h"
+using chromeos::disks::Disk;
+using chromeos::disks::DiskMountManager;
+
namespace chromeos {
namespace settings {
namespace {
@@ -90,7 +94,7 @@ StorageHandler::StorageHandler(Profile* profile,
profile_(profile),
source_name_(html_source->GetSource()),
arc_observer_(this),
- weak_ptr_factory_(this) {
+ special_volume_path_pattern_("[a-z]+://.*") {
html_source->AddBoolean(
kAndroidEnabled,
base::FeatureList::IsEnabled(arc::kUsbStorageUIFeature) &&
@@ -98,6 +102,7 @@ StorageHandler::StorageHandler(Profile* profile,
}
StorageHandler::~StorageHandler() {
+ DiskMountManager::GetInstance()->RemoveObserver(this);
arc::ArcServiceManager::Get()
->arc_bridge_service()
->storage_manager()
@@ -126,6 +131,10 @@ void StorageHandler::RegisterMessages() {
"clearDriveCache",
base::BindRepeating(&StorageHandler::HandleClearDriveCache,
base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "updateExternalStorages",
+ base::BindRepeating(&StorageHandler::HandleUpdateExternalStorages,
+ base::Unretained(this)));
}
void StorageHandler::OnJavascriptAllowed() {
@@ -139,12 +148,18 @@ void StorageHandler::OnJavascriptAllowed() {
->arc_bridge_service()
->storage_manager()
->AddObserver(this);
+
+ // Start observing mount/unmount events to update the connected device list.
+ DiskMountManager::GetInstance()->AddObserver(this);
}
void StorageHandler::OnJavascriptDisallowed() {
// Ensure that pending callbacks do not complete and cause JS to be evaluated.
weak_ptr_factory_.InvalidateWeakPtrs();
+ // Stop observing mount/unmount events to update the connected device list.
+ DiskMountManager::GetInstance()->RemoveObserver(this);
+
// Stop observing the mojo connection so that OnConnectionReady() and
// OnConnectionClosed() that use FireWebUIListener() won't be called while JS
// is disabled.
@@ -202,6 +217,11 @@ void StorageHandler::HandleClearDriveCache(
weak_ptr_factory_.GetWeakPtr()));
}
+void StorageHandler::HandleUpdateExternalStorages(
+ const base::ListValue* unused_args) {
+ UpdateExternalStorages();
+}
+
void StorageHandler::OnClearDriveCacheDone(bool /*success*/) {
UpdateDriveCacheSize();
}
@@ -212,8 +232,9 @@ void StorageHandler::UpdateSizeStat() {
int64_t* total_size = new int64_t(0);
int64_t* available_size = new int64_t(0);
- base::PostTaskWithTraitsAndReply(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
+ base::PostTaskAndReply(
+ FROM_HERE,
+ {base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE},
base::Bind(&GetSizeStatBlocking, downloads_path, total_size,
available_size),
base::Bind(&StorageHandler::OnGetSizeStat, weak_ptr_factory_.GetWeakPtr(),
@@ -247,8 +268,9 @@ void StorageHandler::UpdateDownloadsSize() {
const base::FilePath downloads_path =
file_manager::util::GetDownloadsFolderForProfile(profile_);
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
+ base::PostTaskAndReplyWithResult(
+ FROM_HERE,
+ {base::ThreadPool(), base::MayBlock(), base::TaskPriority::BEST_EFFORT},
base::Bind(&base::ComputeDirectorySize, downloads_path),
base::Bind(&StorageHandler::OnGetDownloadsSize,
weak_ptr_factory_.GetWeakPtr()));
@@ -300,7 +322,7 @@ void StorageHandler::UpdateBrowsingDataSize() {
if (!site_data_size_collector_.get()) {
content::StoragePartition* storage_partition =
content::BrowserContext::GetDefaultStoragePartition(profile_);
- site_data_size_collector_.reset(new SiteDataSizeCollector(
+ site_data_size_collector_ = std::make_unique<SiteDataSizeCollector>(
storage_partition->GetPath(),
new BrowsingDataCookieHelper(storage_partition),
new BrowsingDataDatabaseHelper(profile_),
@@ -314,7 +336,7 @@ void StorageHandler::UpdateBrowsingDataSize() {
storage_partition->GetServiceWorkerContext()),
new BrowsingDataCacheStorageHelper(
storage_partition->GetCacheStorageContext()),
- BrowsingDataFlashLSOHelper::Create(profile_)));
+ BrowsingDataFlashLSOHelper::Create(profile_));
}
site_data_size_collector_->Fetch(
base::Bind(&StorageHandler::OnGetBrowsingDataSize,
@@ -453,6 +475,36 @@ void StorageHandler::OnGetOtherUserSize(
}
}
+void StorageHandler::UpdateExternalStorages() {
+ base::Value devices(base::Value::Type::LIST);
+ for (const auto& itr : DiskMountManager::GetInstance()->mount_points()) {
+ const DiskMountManager::MountPointInfo& mount_info = itr.second;
+ if (!IsEligibleForAndroidStorage(mount_info.source_path))
+ continue;
+
+ const chromeos::disks::Disk* disk =
+ DiskMountManager::GetInstance()->FindDiskBySourcePath(
+ mount_info.source_path);
+ if (!disk)
+ continue;
+
+ std::string label = disk->device_label();
+ if (label.empty()) {
+ // To make volume labels consistent with Files app, we follow how Files
+ // generates a volume label when the volume doesn't have specific label.
+ // That is, we use the base name of mount path instead in such cases.
+ // TODO(fukino): Share the implementation to compute the volume name with
+ // Files app. crbug.com/1002535.
+ label = base::FilePath(mount_info.mount_path).BaseName().AsUTF8Unsafe();
+ }
+ base::Value device(base::Value::Type::DICTIONARY);
+ device.SetKey("uuid", base::Value(disk->fs_uuid()));
+ device.SetKey("label", base::Value(label));
+ devices.GetList().push_back(std::move(device));
+ }
+ FireWebUIListener("onExternalStoragesUpdated", devices);
+}
+
void StorageHandler::OnConnectionReady() {
is_android_running_ = true;
UpdateAndroidRunning();
@@ -471,5 +523,25 @@ void StorageHandler::OnArcPlayStoreEnabledChanged(bool enabled) {
content::WebUIDataSource::Update(profile_, source_name_, std::move(update));
}
+void StorageHandler::OnMountEvent(
+ DiskMountManager::MountEvent event,
+ chromeos::MountError error_code,
+ const DiskMountManager::MountPointInfo& mount_info) {
+ if (error_code != chromeos::MountError::MOUNT_ERROR_NONE)
+ return;
+
+ if (!IsEligibleForAndroidStorage(mount_info.source_path))
+ return;
+
+ UpdateExternalStorages();
+}
+
+bool StorageHandler::IsEligibleForAndroidStorage(std::string source_path) {
+ // Android's StorageManager volume concept relies on assumption that it is
+ // local filesystem. Hence, special volumes like DriveFS should not be
+ // listed on the Settings.
+ return !RE2::FullMatch(source_path, special_volume_path_pattern_);
+}
+
} // namespace settings
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.h
index cefa5753f66..32078b3aa56 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.h
@@ -19,10 +19,12 @@
#include "chrome/browser/chromeos/arc/arc_session_manager.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
#include "chromeos/dbus/cryptohome/rpc.pb.h"
-#include "components/arc/common/storage_manager.mojom.h"
+#include "chromeos/disks/disk_mount_manager.h"
+#include "components/arc/mojom/storage_manager.mojom.h"
#include "components/arc/session/connection_observer.h"
#include "components/arc/storage_manager/arc_storage_manager.h"
#include "components/user_manager/user.h"
+#include "third_party/re2/src/re2/re2.h"
class Profile;
@@ -40,7 +42,8 @@ namespace settings {
class StorageHandler
: public ::settings::SettingsPageUIHandler,
public arc::ConnectionObserver<arc::mojom::StorageManagerInstance>,
- public arc::ArcSessionManager::Observer {
+ public arc::ArcSessionManager::Observer,
+ public chromeos::disks::DiskMountManager::Observer {
public:
// Enumeration for device state about remaining space. These values must be
// kept in sync with settings.StorageSpaceState in JS code.
@@ -65,6 +68,12 @@ class StorageHandler
// arc::ArcSessionManager::Observer:
void OnArcPlayStoreEnabledChanged(bool enabled) override;
+ // chromeos::disks::DiskMountManager::Observer:
+ void OnMountEvent(chromeos::disks::DiskMountManager::MountEvent event,
+ chromeos::MountError error_code,
+ const chromeos::disks::DiskMountManager::MountPointInfo&
+ mount_info) override;
+
private:
// Handlers of JS messages.
void HandleUpdateAndroidEnabled(const base::ListValue* unused_args);
@@ -72,6 +81,7 @@ class StorageHandler
void HandleOpenDownloads(const base::ListValue* unused_args);
void HandleOpenArcStorage(const base::ListValue* unused_args);
void HandleClearDriveCache(const base::ListValue* unused_args);
+ void HandleUpdateExternalStorages(const base::ListValue* unused_args);
// Callback called when clearing Drive cache is done.
void OnClearDriveCacheDone(bool success);
@@ -125,6 +135,13 @@ class StorageHandler
// Callback to save the fetched user sizes and update the UI.
void OnGetOtherUserSize(base::Optional<cryptohome::BaseReply> reply);
+ // Updates list of external storages.
+ void UpdateExternalStorages();
+
+ // Returns true if the volume from |source_path| can be used as Android
+ // storage.
+ bool IsEligibleForAndroidStorage(std::string source_path);
+
// Total size of cache data in browsing data.
int64_t browser_cache_size_;
@@ -163,8 +180,9 @@ class StorageHandler
const std::string source_name_;
ScopedObserver<arc::ArcSessionManager, arc::ArcSessionManager::Observer>
arc_observer_;
+ const re2::RE2 special_volume_path_pattern_;
- base::WeakPtrFactory<StorageHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<StorageHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(StorageHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.cc
index 8af7cb25dac..577dc77a406 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.cc
@@ -58,10 +58,7 @@ std::unique_ptr<base::DictionaryValue> GetFingerprintsInfo(
} // namespace
FingerprintHandler::FingerprintHandler(Profile* profile)
- : profile_(profile),
- binding_(this),
- session_observer_(this),
- weak_ptr_factory_(this) {
+ : profile_(profile), binding_(this), session_observer_(this) {
content::GetSystemConnector()->BindInterface(device::mojom::kServiceName,
&fp_service_);
user_id_ = ProfileHelper::Get()->GetUserIdHashFromProfile(profile);
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.h
index e4d6c7e1fad..766d8842ee6 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.h
@@ -85,7 +85,7 @@ class FingerprintHandler : public ::settings::SettingsPageUIHandler,
session_manager::SessionManagerObserver>
session_observer_;
- base::WeakPtrFactory<FingerprintHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<FingerprintHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(FingerprintHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.cc
index 25814f623e6..a734cd0dc87 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.cc
@@ -12,21 +12,20 @@
#include "base/bind_helpers.h"
#include "base/values.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/ash/assistant/assistant_service_connection.h"
#include "chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.h"
#include "chromeos/audio/cras_audio_handler.h"
-#include "chromeos/constants/chromeos_switches.h"
-#include "chromeos/services/assistant/public/mojom/constants.mojom.h"
+#include "chromeos/constants/chromeos_features.h"
#include "components/arc/arc_prefs.h"
#include "components/arc/arc_service_manager.h"
#include "content/public/browser/browser_context.h"
-#include "services/service_manager/public/cpp/connector.h"
#include "ui/gfx/geometry/rect.h"
namespace chromeos {
namespace settings {
GoogleAssistantHandler::GoogleAssistantHandler(Profile* profile)
- : profile_(profile), weak_factory_(this) {
+ : profile_(profile) {
chromeos::CrasAudioHandler::Get()->AddAudioObserver(this);
}
@@ -77,8 +76,7 @@ void GoogleAssistantHandler::RegisterMessages() {
void GoogleAssistantHandler::HandleShowGoogleAssistantSettings(
const base::ListValue* args) {
CHECK_EQ(0U, args->GetSize());
- if (chromeos::switches::IsAssistantEnabled())
- ash::OpenAssistantSettings();
+ ash::OpenAssistantSettings();
}
void GoogleAssistantHandler::HandleRetrainVoiceModel(
@@ -106,9 +104,9 @@ void GoogleAssistantHandler::BindAssistantSettingsManager() {
DCHECK(!settings_manager_.is_bound());
// Set up settings mojom.
- service_manager::Connector* connector =
- content::BrowserContext::GetConnectorFor(profile_);
- connector->BindInterface(assistant::mojom::kServiceName, &settings_manager_);
+ AssistantServiceConnection::GetForProfile(profile_)
+ ->service()
+ ->BindSettingsManager(mojo::MakeRequest(&settings_manager_));
}
} // namespace settings
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.h
index 8891f4e53d7..067eae00af2 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.h
@@ -49,7 +49,7 @@ class GoogleAssistantHandler : public ::settings::SettingsPageUIHandler,
bool pending_hotword_update_ = false;
- base::WeakPtrFactory<GoogleAssistantHandler> weak_factory_;
+ base::WeakPtrFactory<GoogleAssistantHandler> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(GoogleAssistantHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/internet_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/internet_handler.cc
index 6d0b2214df2..883457370ee 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/internet_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/internet_handler.cc
@@ -14,14 +14,13 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
#include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
+#include "chromeos/network/network_connect.h"
#include "chromeos/network/network_event_log.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "components/arc/arc_service_manager.h"
-#include "components/arc/common/net.mojom.h"
-#include "components/arc/metrics/arc_metrics_constants.h"
+#include "components/arc/mojom/net.mojom.h"
#include "components/arc/session/arc_bridge_service.h"
-#include "components/arc/session/connection_holder.h"
#include "components/onc/onc_constants.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
@@ -36,8 +35,7 @@ namespace {
const char kAddThirdPartyVpnMessage[] = "addThirdPartyVpn";
const char kConfigureThirdPartyVpnMessage[] = "configureThirdPartyVpn";
-const char kRequestArcVpnProviders[] = "requestArcVpnProviders";
-const char kSendArcVpnProviders[] = "sendArcVpnProviders";
+const char kShowCellularSetupUI[] = "showCellularSetupUI";
const char kRequestGmsCoreNotificationsDisabledDeviceNames[] =
"requestGmsCoreNotificationsDisabledDeviceNames";
const char kSendGmsCoreNotificationsDisabledDeviceNames[] =
@@ -48,18 +46,6 @@ Profile* GetProfileForPrimaryUser() {
user_manager::UserManager::Get()->GetPrimaryUser());
}
-std::unique_ptr<base::DictionaryValue> ArcVpnProviderToValue(
- const app_list::ArcVpnProviderManager::ArcVpnProvider* arc_vpn_provider) {
- std::unique_ptr<base::DictionaryValue> serialized_entry =
- std::make_unique<base::DictionaryValue>();
- serialized_entry->SetString("PackageName", arc_vpn_provider->package_name);
- serialized_entry->SetString("ProviderName", arc_vpn_provider->app_name);
- serialized_entry->SetString("AppID", arc_vpn_provider->app_id);
- serialized_entry->SetDouble("LastLaunchTime",
- arc_vpn_provider->last_launch_time.ToDoubleT());
- return serialized_entry;
-}
-
} // namespace
namespace settings {
@@ -67,10 +53,6 @@ namespace settings {
InternetHandler::InternetHandler(Profile* profile) : profile_(profile) {
DCHECK(profile_);
- arc_vpn_provider_manager_ = app_list::ArcVpnProviderManager::Get(profile_);
- if (arc_vpn_provider_manager_)
- arc_vpn_provider_manager_->AddObserver(this);
-
TetherService* tether_service = TetherService::Get(profile);
gms_core_notifications_state_tracker_ =
tether_service ? tether_service->GetGmsCoreNotificationsStateTracker()
@@ -80,8 +62,6 @@ InternetHandler::InternetHandler(Profile* profile) : profile_(profile) {
}
InternetHandler::~InternetHandler() {
- if (arc_vpn_provider_manager_)
- arc_vpn_provider_manager_->RemoveObserver(this);
if (gms_core_notifications_state_tracker_)
gms_core_notifications_state_tracker_->RemoveObserver(this);
}
@@ -96,41 +76,20 @@ void InternetHandler::RegisterMessages() {
base::BindRepeating(&InternetHandler::ConfigureThirdPartyVpn,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
- kRequestArcVpnProviders,
- base::BindRepeating(&InternetHandler::RequestArcVpnProviders,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
kRequestGmsCoreNotificationsDisabledDeviceNames,
base::BindRepeating(
&InternetHandler::RequestGmsCoreNotificationsDisabledDeviceNames,
base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ kShowCellularSetupUI,
+ base::BindRepeating(&InternetHandler::ShowCellularSetupUI,
+ base::Unretained(this)));
}
void InternetHandler::OnJavascriptAllowed() {}
void InternetHandler::OnJavascriptDisallowed() {}
-void InternetHandler::OnArcVpnProviderRemoved(const std::string& package_name) {
- if (arc_vpn_providers_.find(package_name) == arc_vpn_providers_.end())
- return;
- arc_vpn_providers_.erase(package_name);
- SendArcVpnProviders();
-}
-
-void InternetHandler::OnArcVpnProvidersRefreshed(
- const std::vector<
- std::unique_ptr<app_list::ArcVpnProviderManager::ArcVpnProvider>>&
- arc_vpn_providers) {
- SetArcVpnProviders(arc_vpn_providers);
-}
-
-void InternetHandler::OnArcVpnProviderUpdated(
- app_list::ArcVpnProviderManager::ArcVpnProvider* arc_vpn_provider) {
- arc_vpn_providers_[arc_vpn_provider->package_name] =
- ArcVpnProviderToValue(arc_vpn_provider);
- SendArcVpnProviders();
-}
-
void InternetHandler::OnGmsCoreNotificationStateChanged() {
SetGmsCoreNotificationsDisabledDeviceNames();
}
@@ -213,41 +172,19 @@ void InternetHandler::ConfigureThirdPartyVpn(const base::ListValue* args) {
<< network->GetVpnProviderType() << " For: " << guid;
}
-void InternetHandler::RequestArcVpnProviders(const base::ListValue* args) {
- if (!arc_vpn_provider_manager_)
- return;
-
- AllowJavascript();
- SetArcVpnProviders(arc_vpn_provider_manager_->GetArcVpnProviders());
-}
-
void InternetHandler::RequestGmsCoreNotificationsDisabledDeviceNames(
const base::ListValue* args) {
AllowJavascript();
SetGmsCoreNotificationsDisabledDeviceNames();
}
-void InternetHandler::SetArcVpnProviders(
- const std::vector<
- std::unique_ptr<app_list::ArcVpnProviderManager::ArcVpnProvider>>&
- arc_vpn_providers) {
- arc_vpn_providers_.clear();
- for (const auto& arc_vpn_provider : arc_vpn_providers) {
- arc_vpn_providers_[arc_vpn_provider->package_name] =
- ArcVpnProviderToValue(arc_vpn_provider.get());
- }
- SendArcVpnProviders();
-}
-
-void InternetHandler::SendArcVpnProviders() {
- if (!IsJavascriptAllowed())
+void InternetHandler::ShowCellularSetupUI(const base::ListValue* args) {
+ std::string guid;
+ if (args->GetSize() < 1 || !args->GetString(0, &guid)) {
+ NOTREACHED() << "Invalid args for: " << kConfigureThirdPartyVpnMessage;
return;
-
- base::ListValue arc_vpn_providers_value;
- for (const auto& iter : arc_vpn_providers_) {
- arc_vpn_providers_value.GetList().push_back(iter.second->Clone());
}
- FireWebUIListener(kSendArcVpnProviders, arc_vpn_providers_value);
+ chromeos::NetworkConnect::Get()->ShowMobileSetup(guid);
}
void InternetHandler::SetGmsCoreNotificationsDisabledDeviceNames() {
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/internet_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/internet_handler.h
index 31ed7c90e43..89f10828b9a 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/internet_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/internet_handler.h
@@ -8,7 +8,6 @@
#include <memory>
#include "base/macros.h"
-#include "chrome/browser/ui/app_list/arc/arc_vpn_provider_manager.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
#include "chromeos/components/tether/gms_core_notifications_state_tracker.h"
#include "ui/gfx/native_widget_types.h"
@@ -25,8 +24,7 @@ namespace settings {
// Chrome OS Internet settings page UI handler.
class InternetHandler
- : public app_list::ArcVpnProviderManager::Observer,
- public chromeos::tether::GmsCoreNotificationsStateTracker::Observer,
+ : public chromeos::tether::GmsCoreNotificationsStateTracker::Observer,
public ::settings::SettingsPageUIHandler {
public:
explicit InternetHandler(Profile* profile);
@@ -37,15 +35,6 @@ class InternetHandler
void OnJavascriptAllowed() override;
void OnJavascriptDisallowed() override;
- // app_list::ArcVpnProviderManager::Observer:
- void OnArcVpnProvidersRefreshed(
- const std::vector<
- std::unique_ptr<app_list::ArcVpnProviderManager::ArcVpnProvider>>&
- arc_vpn_providers) override;
- void OnArcVpnProviderRemoved(const std::string& package_name) override;
- void OnArcVpnProviderUpdated(app_list::ArcVpnProviderManager::ArcVpnProvider*
- arc_vpn_provider) override;
-
// chromeos::tether::GmsCoreNotificationsStateTracker::Observer:
void OnGmsCoreNotificationStateChanged() override;
@@ -55,18 +44,9 @@ class InternetHandler
// Settings JS handlers.
void AddThirdPartyVpn(const base::ListValue* args);
void ConfigureThirdPartyVpn(const base::ListValue* args);
- void RequestArcVpnProviders(const base::ListValue* args);
void RequestGmsCoreNotificationsDisabledDeviceNames(
const base::ListValue* args);
-
- // Sets list of Arc Vpn providers.
- void SetArcVpnProviders(
- const std::vector<
- std::unique_ptr<app_list::ArcVpnProviderManager::ArcVpnProvider>>&
- arc_vpn_providers);
-
- // Sends list of Arc Vpn providers to Chrome://settings.
- void SendArcVpnProviders();
+ void ShowCellularSetupUI(const base::ListValue* args);
// Sets list of names of devices whose "Google Play Services" notifications
// are disabled.
@@ -81,17 +61,10 @@ class InternetHandler
chromeos::tether::GmsCoreNotificationsStateTracker*
gms_core_notifications_state_tracker);
- std::map<std::string, std::unique_ptr<base::DictionaryValue>>
- arc_vpn_providers_;
-
std::vector<std::unique_ptr<base::Value>> device_names_without_notifications_;
Profile* const profile_;
- // |arc_vpn_provider_manager_| and |gms_core_notifications_state_tracker_| are
- // provided by BrowserContextKeyedServices which are guaranteed to outlive
- // WebUIMessageHandlers.
- app_list::ArcVpnProviderManager* arc_vpn_provider_manager_;
chromeos::tether::GmsCoreNotificationsStateTracker*
gms_core_notifications_state_tracker_;
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.cc
index fdf98ee2cf5..d6125af737b 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.cc
@@ -22,7 +22,7 @@ namespace chromeos {
namespace settings {
KerberosAccountsHandler::KerberosAccountsHandler()
- : credentials_manager_observer_(this), weak_factory_(this) {}
+ : credentials_manager_observer_(this) {}
KerberosAccountsHandler::~KerberosAccountsHandler() = default;
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.h
index 78493fb26a9..296cf45bb46 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.h
@@ -79,7 +79,7 @@ class KerberosAccountsHandler : public ::settings::SettingsPageUIHandler,
KerberosCredentialsManager::Observer>
credentials_manager_observer_;
- base::WeakPtrFactory<KerberosAccountsHandler> weak_factory_;
+ base::WeakPtrFactory<KerberosAccountsHandler> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(KerberosAccountsHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler.cc
index 8d03f47642a..19977ff73a7 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler.cc
@@ -62,9 +62,8 @@ MultideviceHandler::MultideviceHandler(
android_sms_app_manager_(android_sms_app_manager),
multidevice_setup_observer_(this),
android_sms_pairing_state_tracker_observer_(this),
- android_sms_app_manager_observer_(this),
- callback_weak_ptr_factory_(this) {
- RegisterPrefChangeListeners();
+ android_sms_app_manager_observer_(this) {
+ pref_change_registrar_.Init(prefs_);
}
MultideviceHandler::~MultideviceHandler() {}
@@ -123,9 +122,22 @@ void MultideviceHandler::OnJavascriptAllowed() {
if (android_sms_app_manager_)
android_sms_app_manager_observer_.Add(android_sms_app_manager_);
+
+ pref_change_registrar_.Add(
+ proximity_auth::prefs::kProximityAuthIsChromeOSLoginEnabled,
+ base::BindRepeating(
+ &MultideviceHandler::NotifySmartLockSignInEnabledChanged,
+ base::Unretained(this)));
+ pref_change_registrar_.Add(
+ multidevice_setup::kSmartLockSigninAllowedPrefName,
+ base::BindRepeating(
+ &MultideviceHandler::NotifySmartLockSignInAllowedChanged,
+ base::Unretained(this)));
}
void MultideviceHandler::OnJavascriptDisallowed() {
+ pref_change_registrar_.RemoveAll();
+
if (multidevice_setup_client_)
multidevice_setup_observer_.Remove(multidevice_setup_client_);
@@ -377,23 +389,7 @@ MultideviceHandler::GeneratePageContentDataDictionary() {
return page_content_dictionary;
}
-void MultideviceHandler::RegisterPrefChangeListeners() {
- pref_change_registrar_.Init(prefs_);
- pref_change_registrar_.Add(
- proximity_auth::prefs::kProximityAuthIsChromeOSLoginEnabled,
- base::BindRepeating(
- &MultideviceHandler::NotifySmartLockSignInEnabledChanged,
- base::Unretained(this)));
- pref_change_registrar_.Add(
- multidevice_setup::kSmartLockSigninAllowedPrefName,
- base::BindRepeating(
- &MultideviceHandler::NotifySmartLockSignInAllowedChanged,
- base::Unretained(this)));
-}
-
void MultideviceHandler::NotifySmartLockSignInEnabledChanged() {
- AllowJavascript();
-
bool sign_in_enabled = prefs_->GetBoolean(
proximity_auth::prefs::kProximityAuthIsChromeOSLoginEnabled);
FireWebUIListener("smart-lock-signin-enabled-changed",
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler.h
index efb5ac7c6e9..8ee0b692ac1 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler.h
@@ -82,7 +82,6 @@ class MultideviceHandler
void OnSetFeatureStateEnabledResult(const std::string& js_callback_id,
bool success);
- void RegisterPrefChangeListeners();
void NotifySmartLockSignInEnabledChanged();
void NotifySmartLockSignInAllowedChanged();
// Generate android sms info dictionary containing the messages for web
@@ -126,7 +125,7 @@ class MultideviceHandler
android_sms_app_manager_observer_;
// Used to cancel callbacks when JavaScript becomes disallowed.
- base::WeakPtrFactory<MultideviceHandler> callback_weak_ptr_factory_;
+ base::WeakPtrFactory<MultideviceHandler> callback_weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(MultideviceHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler_unittest.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler_unittest.cc
index 8af51c05725..e0efafd8f75 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler_unittest.cc
@@ -124,7 +124,7 @@ class MultideviceHandlerTest : public testing::Test {
fake_android_sms_app_manager_ =
std::make_unique<android_sms::FakeAndroidSmsAppManager>();
- prefs_.reset(new TestingPrefServiceSimple());
+ prefs_ = std::make_unique<TestingPrefServiceSimple>();
handler_ = std::make_unique<TestMultideviceHandler>(
prefs_.get(), fake_multidevice_setup_client_.get(),
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.cc
index d01be34282e..a0fd1fe87ff 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.cc
@@ -11,15 +11,21 @@
#include <utility>
#include <vector>
+#include "ash/public/cpp/network_config_service.h"
#include "ash/public/cpp/resources/grit/ash_public_unscaled_resources.h"
+#include "base/bind.h"
+#include "base/feature_list.h"
#include "build/build_config.h"
+#include "chrome/browser/ui/webui/app_management/app_management.mojom.h"
+#include "chrome/browser/ui/webui/app_management/app_management_page_handler.h"
#include "chrome/browser/ui/webui/managed_ui_handler.h"
#include "chrome/browser/ui/webui/metrics_handler.h"
#include "chrome/browser/ui/webui/plural_string_handler.h"
#include "chrome/browser/ui/webui/settings/about_handler.h"
#include "chrome/browser/ui/webui/settings/accessibility_main_handler.h"
-#include "chrome/browser/ui/webui/settings/appearance_handler.h"
#include "chrome/browser/ui/webui/settings/browser_lifetime_handler.h"
+#include "chrome/browser/ui/webui/settings/chromeos/parental_controls_handler.h"
+#include "chrome/browser/ui/webui/settings/chromeos/wallpaper_handler.h"
#include "chrome/browser/ui/webui/settings/downloads_handler.h"
#include "chrome/browser/ui/webui/settings/extension_control_handler.h"
#include "chrome/browser/ui/webui/settings/languages_handler.h"
@@ -33,22 +39,25 @@
#include "chrome/browser/ui/webui/settings/settings_media_devices_selection_handler.h"
#include "chrome/browser/ui/webui/settings/settings_ui.h"
#include "chrome/browser/web_applications/system_web_app_manager.h"
+#include "chrome/common/chrome_features.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/browser_resources.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/os_settings_resources.h"
#include "chrome/grit/os_settings_resources_map.h"
-#include "chromeos/services/network_config/public/mojom/constants.mojom.h"
+#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom.h"
#include "components/password_manager/core/common/password_manager_features.h"
#include "components/unified_consent/feature.h"
#include "content/public/browser/web_ui_data_source.h"
-#include "services/service_manager/public/cpp/connector.h"
namespace chromeos {
namespace settings {
OSSettingsUI::OSSettingsUI(content::WebUI* web_ui)
- : ui::MojoWebUIController(web_ui, /*enable_chrome_send =*/true) {
+ : ui::MojoWebUIController(web_ui, /*enable_chrome_send=*/true),
+ webui_load_timer_(web_ui->GetWebContents(),
+ "ChromeOS.Settings.LoadDocumentTime",
+ "ChromeOS.Settings.LoadCompletedTime") {
Profile* profile = Profile::FromWebUI(web_ui);
content::WebUIDataSource* html_source =
content::WebUIDataSource::Create(chrome::kChromeUIOSSettingsHost);
@@ -62,8 +71,9 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui)
// page_visibility.js).
html_source->AddBoolean("showOSSettings", true);
- AddSettingsPageUIHandler(
- std::make_unique<::settings::AppearanceHandler>(web_ui));
+ html_source->AddBoolean(
+ "showParentalControls",
+ chromeos::settings::ShouldShowParentalControls(profile));
AddSettingsPageUIHandler(
std::make_unique<::settings::AccessibilityMainHandler>());
@@ -86,10 +96,21 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui)
std::make_unique<::settings::ProtocolHandlersHandler>());
AddSettingsPageUIHandler(
std::make_unique<::settings::SearchEnginesHandler>(profile));
+ AddSettingsPageUIHandler(
+ std::make_unique<chromeos::settings::WallpaperHandler>(web_ui));
html_source->AddBoolean("unifiedConsentEnabled",
unified_consent::IsUnifiedConsentFeatureEnabled());
+ html_source->AddBoolean(
+ "showApps", base::FeatureList::IsEnabled(features::kAppManagement));
+
+#if defined(OS_CHROMEOS)
+ html_source->AddBoolean(
+ "isSupportedArcVersion",
+ AppManagementPageHandler::IsCurrentArcVersionSupported(profile));
+#endif // OS_CHROMEOS
+
AddSettingsPageUIHandler(
base::WrapUnique(::settings::AboutHandler::Create(html_source, profile)));
AddSettingsPageUIHandler(base::WrapUnique(
@@ -122,6 +143,17 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui)
html_source->SetDefaultResource(IDR_OS_SETTINGS_SETTINGS_HTML);
#endif
+ html_source->AddResourcePath("app-management/app_management.mojom-lite.js",
+ IDR_APP_MANAGEMENT_MOJO_LITE_JS);
+ html_source->AddResourcePath("app-management/types.mojom-lite.js",
+ IDR_APP_MANAGEMENT_TYPES_MOJO_LITE_JS);
+ html_source->AddResourcePath("app-management/bitmap.mojom-lite.js",
+ IDR_APP_MANAGEMENT_BITMAP_MOJO_LITE_JS);
+ html_source->AddResourcePath("app-management/image.mojom-lite.js",
+ IDR_APP_MANAGEMENT_IMAGE_MOJO_LITE_JS);
+ html_source->AddResourcePath("app-management/image_info.mojom-lite.js",
+ IDR_APP_MANAGEMENT_IMAGE_INFO_MOJO_LITE_JS);
+
::settings::AddLocalizedStrings(html_source, profile);
auto plural_string_handler = std::make_unique<PluralStringHandler>();
@@ -136,6 +168,10 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui)
AddHandlerToRegistry(base::BindRepeating(&OSSettingsUI::BindCrosNetworkConfig,
base::Unretained(this)));
+
+ AddHandlerToRegistry(
+ base::BindRepeating(&OSSettingsUI::BindAppManagementPageHandlerFactory,
+ base::Unretained(this)));
}
OSSettingsUI::~OSSettingsUI() = default;
@@ -148,9 +184,17 @@ void OSSettingsUI::AddSettingsPageUIHandler(
void OSSettingsUI::BindCrosNetworkConfig(
network_config::mojom::CrosNetworkConfigRequest request) {
- content::BrowserContext::GetConnectorFor(
- web_ui()->GetWebContents()->GetBrowserContext())
- ->BindInterface(network_config::mojom::kServiceName, std::move(request));
+ ash::GetNetworkConfigService(std::move(request));
+}
+
+void OSSettingsUI::BindAppManagementPageHandlerFactory(
+ app_management::mojom::PageHandlerFactoryRequest request) {
+ if (!app_management_page_handler_factory_) {
+ app_management_page_handler_factory_ =
+ std::make_unique<AppManagementPageHandlerFactory>(
+ Profile::FromWebUI(web_ui()));
+ }
+ app_management_page_handler_factory_->Bind(std::move(request));
}
} // namespace settings
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.h b/chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.h
index 4e600afc38b..63131cfb6f6 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.h
@@ -8,8 +8,10 @@
#include <memory>
#include "base/macros.h"
-#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom.h"
-#include "content/public/browser/web_ui_controller.h"
+#include "chrome/browser/ui/webui/app_management/app_management.mojom-forward.h"
+#include "chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.h"
+#include "chrome/browser/ui/webui/webui_load_timer.h"
+#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom-forward.h"
#include "ui/webui/mojo_web_ui_controller.h"
namespace content {
@@ -30,8 +32,13 @@ class OSSettingsUI : public ui::MojoWebUIController {
std::unique_ptr<content::WebUIMessageHandler> handler);
void BindCrosNetworkConfig(
network_config::mojom::CrosNetworkConfigRequest request);
+ void BindAppManagementPageHandlerFactory(
+ app_management::mojom::PageHandlerFactoryRequest request);
- // TODO(crbug/950007): Create load histograms and embed WebuiLoadTimer.
+ WebuiLoadTimer webui_load_timer_;
+
+ std::unique_ptr<AppManagementPageHandlerFactory>
+ app_management_page_handler_factory_;
DISALLOW_COPY_AND_ASSIGN(OSSettingsUI);
};
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/parental_controls_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/parental_controls_handler.cc
index b76ceac4ab6..19182163f23 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/parental_controls_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/parental_controls_handler.cc
@@ -9,8 +9,9 @@
#include "base/values.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
-#include "chrome/browser/chromeos/arc/arc_session_manager.h"
+#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_navigator_params.h"
@@ -18,7 +19,7 @@
#include "chrome/services/app_service/public/cpp/app_registry_cache.h"
#include "chrome/services/app_service/public/cpp/app_update.h"
#include "chrome/services/app_service/public/mojom/types.mojom.h"
-#include "components/arc/arc_util.h"
+#include "chromeos/constants/chromeos_features.h"
#include "ui/base/page_transition_types.h"
#include "ui/base/window_open_disposition.h"
#include "ui/display/types/display_constants.h"
@@ -81,19 +82,32 @@ void ParentalControlsHandler::HandleLaunchFamilyLinkSettings(
proxy->Launch(app_id, ui::EventFlags::EF_NONE,
apps::mojom::LaunchSource::kFromParentalControls,
display::kDefaultDisplayId);
- } else if (arc::IsArcAvailable() &&
- arc::ArcSessionManager::Get()->IsAllowed()) {
- // No FLH app installed, but ARC is enabled so launch Play Store
- // to FLH app install page.
- arc::LaunchPlayStoreWithUrl(kFamilyLinkChildHelperAppPlayStoreURL);
- } else {
- // As a last resort, launch browser to the family link site.
- NavigateParams params(profile_, GURL(kFamilyLinkSiteURL),
- ui::PAGE_TRANSITION_FROM_API);
- params.disposition = WindowOpenDisposition::NEW_WINDOW;
- params.window_action = NavigateParams::SHOW_WINDOW;
- Navigate(&params);
+ return;
}
+ // No FLH app installed, so try to launch Play Store to FLH app install page.
+ // If there is no Play Store available LaunchPlayStoreWithUrl() will return
+ // false.
+ if (arc::LaunchPlayStoreWithUrl(kFamilyLinkChildHelperAppPlayStoreURL)) {
+ return;
+ }
+ // As a last resort, launch browser to the family link site.
+ NavigateParams params(profile_, GURL(kFamilyLinkSiteURL),
+ ui::PAGE_TRANSITION_FROM_API);
+ params.disposition = WindowOpenDisposition::NEW_WINDOW;
+ params.window_action = NavigateParams::SHOW_WINDOW;
+ Navigate(&params);
+}
+
+bool ShouldShowParentalControls(Profile* profile) {
+ // Show Parental controls for regular and child accounts that are the
+ // primary profile. Do not show it to any secondary profiles, managed
+ // accounts that aren't child accounts (i.e. enterprise and EDU accounts),
+ // OTR accounts, or legacy supervised user accounts.
+ return chromeos::features::IsParentalControlsSettingsEnabled() &&
+ profile == ProfileManager::GetPrimaryUserProfile() &&
+ !profile->IsLegacySupervised() && !profile->IsGuestSession() &&
+ (profile->IsChild() ||
+ !profile->GetProfilePolicyConnector()->IsManaged());
}
} // namespace settings
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/parental_controls_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/parental_controls_handler.h
index cb498d3db33..517bc1b50fd 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/parental_controls_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/parental_controls_handler.h
@@ -37,6 +37,9 @@ class ParentalControlsHandler : public ::settings::SettingsPageUIHandler {
DISALLOW_COPY_AND_ASSIGN(ParentalControlsHandler);
};
+// Indicates whether parental controls should be shown in the settings UI.
+bool ShouldShowParentalControls(Profile* profile);
+
} // namespace settings
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/plugin_vm_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/plugin_vm_handler.cc
index 09518e994a3..715782b0b11 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/plugin_vm_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/plugin_vm_handler.cc
@@ -18,8 +18,7 @@
namespace chromeos {
namespace settings {
-PluginVmHandler::PluginVmHandler(Profile* profile)
- : profile_(profile), weak_ptr_factory_(this) {}
+PluginVmHandler::PluginVmHandler(Profile* profile) : profile_(profile) {}
PluginVmHandler::~PluginVmHandler() = default;
@@ -59,7 +58,8 @@ void PluginVmHandler::HandleRemovePluginVmSharedPath(
vm_name, base::FilePath(path),
/*unpersist=*/true,
base::BindOnce(
- [](const std::string& path, bool result, std::string failure_reason) {
+ [](const std::string& path, bool result,
+ const std::string& failure_reason) {
if (!result) {
LOG(ERROR) << "Error unsharing " << path << ": "
<< failure_reason;
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/plugin_vm_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/plugin_vm_handler.h
index 64e9d850299..d57b34da1db 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/plugin_vm_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/plugin_vm_handler.h
@@ -35,7 +35,7 @@ class PluginVmHandler : public ::settings::SettingsPageUIHandler {
Profile* profile_;
// weak_ptr_factory_ should always be last member.
- base::WeakPtrFactory<PluginVmHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<PluginVmHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(PluginVmHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/wallpaper_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/wallpaper_handler.cc
new file mode 100644
index 00000000000..5f169f010f8
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/wallpaper_handler.cc
@@ -0,0 +1,67 @@
+// 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.
+
+#include "chrome/browser/ui/webui/settings/chromeos/wallpaper_handler.h"
+
+#include "base/bind.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/ash/wallpaper_controller_client.h"
+#include "content/public/browser/web_ui.h"
+
+namespace chromeos {
+namespace settings {
+
+WallpaperHandler::WallpaperHandler(content::WebUI* webui)
+ : profile_(Profile::FromWebUI(webui)) {}
+
+WallpaperHandler::~WallpaperHandler() = default;
+
+void WallpaperHandler::OnJavascriptAllowed() {}
+void WallpaperHandler::OnJavascriptDisallowed() {}
+
+void WallpaperHandler::RegisterMessages() {
+ web_ui()->RegisterMessageCallback(
+ "openWallpaperManager",
+ base::BindRepeating(&WallpaperHandler::HandleOpenWallpaperManager,
+ base::Unretained(this)));
+
+ web_ui()->RegisterMessageCallback(
+ "isWallpaperSettingVisible",
+ base::BindRepeating(&WallpaperHandler::HandleIsWallpaperSettingVisible,
+ base::Unretained(this)));
+
+ web_ui()->RegisterMessageCallback(
+ "isWallpaperPolicyControlled",
+ base::BindRepeating(&WallpaperHandler::HandleIsWallpaperPolicyControlled,
+ base::Unretained(this)));
+}
+
+void WallpaperHandler::HandleIsWallpaperSettingVisible(
+ const base::ListValue* args) {
+ CHECK_EQ(args->GetSize(), 1U);
+ ResolveCallback(
+ args->GetList()[0],
+ WallpaperControllerClient::Get()->ShouldShowWallpaperSetting());
+}
+
+void WallpaperHandler::HandleIsWallpaperPolicyControlled(
+ const base::ListValue* args) {
+ CHECK_EQ(args->GetSize(), 1U);
+ bool result = WallpaperControllerClient::Get()
+ ->IsActiveUserWallpaperControlledByPolicy();
+ ResolveCallback(args->GetList()[0], result);
+}
+
+void WallpaperHandler::HandleOpenWallpaperManager(const base::ListValue* args) {
+ WallpaperControllerClient::Get()->OpenWallpaperPickerIfAllowed();
+}
+
+void WallpaperHandler::ResolveCallback(const base::Value& callback_id,
+ bool result) {
+ AllowJavascript();
+ ResolveJavascriptCallback(callback_id, base::Value(result));
+}
+
+} // namespace settings
+} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/wallpaper_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/wallpaper_handler.h
new file mode 100644
index 00000000000..6e0c811b9e0
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/wallpaper_handler.h
@@ -0,0 +1,56 @@
+// 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.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_WALLPAPER_HANDLER_H_
+#define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_WALLPAPER_HANDLER_H_
+
+#include "base/macros.h"
+#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
+
+namespace base {
+class ListValue;
+}
+
+namespace content {
+class WebUI;
+}
+
+class Profile;
+
+namespace chromeos {
+namespace settings {
+
+// Chrome "Personalization" settings page UI handler.
+class WallpaperHandler : public ::settings::SettingsPageUIHandler {
+ public:
+ explicit WallpaperHandler(content::WebUI* webui);
+ ~WallpaperHandler() override;
+
+ // SettingsPageUIHandler implementation.
+ void RegisterMessages() override;
+ void OnJavascriptAllowed() override;
+ void OnJavascriptDisallowed() override;
+
+ private:
+ // Whether the wallpaper setting should be shown.
+ void HandleIsWallpaperSettingVisible(const base::ListValue* args);
+
+ // Whether the wallpaper is policy controlled.
+ void HandleIsWallpaperPolicyControlled(const base::ListValue* args);
+
+ // Open the wallpaper manager app.
+ void HandleOpenWallpaperManager(const base::ListValue* args);
+
+ // Helper function to resolve the Javascript callback.
+ void ResolveCallback(const base::Value& callback_id, bool result);
+
+ Profile* const profile_;
+
+ DISALLOW_COPY_AND_ASSIGN(WallpaperHandler);
+};
+
+} // namespace settings
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_WALLPAPER_HANDLER_H_
diff --git a/chromium/chrome/browser/ui/webui/settings/downloads_handler_unittest.cc b/chromium/chrome/browser/ui/webui/settings/downloads_handler_unittest.cc
index 7e7628fb021..80ea9d4632c 100644
--- a/chromium/chrome/browser/ui/webui/settings/downloads_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/settings/downloads_handler_unittest.cc
@@ -13,8 +13,8 @@
#include "chrome/test/base/testing_profile.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/web_ui.h"
+#include "content/public/test/browser_task_environment.h"
#include "content/public/test/mock_download_manager.h"
-#include "content/public/test/test_browser_thread_bundle.h"
#include "content/public/test/test_web_ui.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -74,7 +74,7 @@ class DownloadsHandlerTest : public testing::Test {
DownloadsHandler* handler() { return &handler_; }
private:
- content::TestBrowserThreadBundle thread_bundle_;
+ content::BrowserTaskEnvironment task_environment_;
content::TestWebUI test_web_ui_;
TestingProfile profile_;
diff --git a/chromium/chrome/browser/ui/webui/settings/metrics_reporting_handler_unittest.cc b/chromium/chrome/browser/ui/webui/settings/metrics_reporting_handler_unittest.cc
index d5adb2866a2..c33bd5da63e 100644
--- a/chromium/chrome/browser/ui/webui/settings/metrics_reporting_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/settings/metrics_reporting_handler_unittest.cc
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS)
+#include "build/branding_buildflags.h"
+
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING) && !defined(OS_CHROMEOS)
#include "chrome/browser/ui/webui/settings/metrics_reporting_handler.h"
@@ -18,7 +20,7 @@
#include "components/policy/policy_constants.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/web_ui.h"
-#include "content/public/test/test_browser_thread_bundle.h"
+#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_web_ui.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -34,10 +36,10 @@ class MetricsReportingHandlerTest : public testing::Test {
public:
MetricsReportingHandlerTest() {
// Local state must be set up before |handler_|.
- local_state_.reset(new ScopedTestingLocalState(
- TestingBrowserProcess::GetGlobal()));
+ local_state_ = std::make_unique<ScopedTestingLocalState>(
+ TestingBrowserProcess::GetGlobal());
- handler_.reset(new TestingMetricsReportingHandler);
+ handler_ = std::make_unique<TestingMetricsReportingHandler>();
handler_->set_web_ui(&test_web_ui_);
EXPECT_CALL(provider_, IsInitializationComplete(testing::_)).WillRepeatedly(
@@ -75,7 +77,7 @@ class MetricsReportingHandlerTest : public testing::Test {
policy::MockConfigurationPolicyProvider* provider() { return &provider_; }
private:
- content::TestBrowserThreadBundle thread_bundle_;
+ content::BrowserTaskEnvironment task_environment_;
content::TestWebUI test_web_ui_;
std::unique_ptr<ScopedTestingLocalState> local_state_;
std::unique_ptr<TestingMetricsReportingHandler> handler_;
@@ -124,4 +126,4 @@ TEST_F(MetricsReportingHandlerTest, PolicyChangesNotifyPage) {
} // namespace settings
-#endif // defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS)
+#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING) && !defined(OS_CHROMEOS)
diff --git a/chromium/chrome/browser/ui/webui/settings/on_startup_handler_unittest.cc b/chromium/chrome/browser/ui/webui/settings/on_startup_handler_unittest.cc
index 6a2dd312163..2b60755b794 100644
--- a/chromium/chrome/browser/ui/webui/settings/on_startup_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/settings/on_startup_handler_unittest.cc
@@ -17,7 +17,7 @@
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h"
-#include "content/public/test/test_browser_thread_bundle.h"
+#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_web_ui.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -58,7 +58,7 @@ class OnStartupHandlerTest : public testing::Test {
profile_ = profile_manager_.CreateTestingProfile("Profile 1");
#endif
- handler_.reset(new TestOnStartupHandler(profile_));
+ handler_ = std::make_unique<TestOnStartupHandler>(profile_);
handler_->set_web_ui(&web_ui_);
}
@@ -67,7 +67,7 @@ class OnStartupHandlerTest : public testing::Test {
content::TestWebUI* web_ui() { return &web_ui_; }
private:
- content::TestBrowserThreadBundle thread_bundle_;
+ content::BrowserTaskEnvironment task_environment_;
TestingProfileManager profile_manager_;
std::unique_ptr<TestOnStartupHandler> handler_;
Profile* profile_;
diff --git a/chromium/chrome/browser/ui/webui/settings/people_handler.cc b/chromium/chrome/browser/ui/webui/settings/people_handler.cc
index 3ea106d0157..5d7331dbf92 100644
--- a/chromium/chrome/browser/ui/webui/settings/people_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/people_handler.cc
@@ -36,7 +36,6 @@
#include "components/autofill/core/common/autofill_prefs.h"
#include "components/prefs/pref_service.h"
#include "components/signin/core/browser/signin_error_controller.h"
-#include "components/signin/core/browser/signin_header_helper.h"
#include "components/signin/public/base/signin_metrics.h"
#include "components/signin/public/base/signin_pref_names.h"
#include "components/signin/public/identity_manager/accounts_mutator.h"
@@ -221,6 +220,7 @@ base::string16 GetEnterPassphraseBody(syncer::PassphraseType passphrase_type,
base::TimeFormatShortDate(passphrase_time));
case syncer::PassphraseType::IMPLICIT_PASSPHRASE:
case syncer::PassphraseType::KEYSTORE_PASSPHRASE:
+ case syncer::PassphraseType::TRUSTED_VAULT_PASSPHRASE:
case syncer::PassphraseType::PASSPHRASE_TYPE_SIZE:
break;
}
@@ -243,6 +243,7 @@ base::string16 GetFullEncryptionBody(syncer::PassphraseType passphrase_type,
base::TimeFormatShortDate(passphrase_time));
case syncer::PassphraseType::IMPLICIT_PASSPHRASE:
case syncer::PassphraseType::KEYSTORE_PASSPHRASE:
+ case syncer::PassphraseType::TRUSTED_VAULT_PASSPHRASE:
case syncer::PassphraseType::PASSPHRASE_TYPE_SIZE:
break;
}
@@ -303,6 +304,10 @@ void PeopleHandler::RegisterMessages() {
"SyncSetupGetSyncStatus",
base::BindRepeating(&PeopleHandler::HandleGetSyncStatus,
base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "SyncPrefsDispatch",
+ base::BindRepeating(&PeopleHandler::HandleSyncPrefsDispatch,
+ base::Unretained(this)));
#if defined(OS_CHROMEOS)
web_ui()->RegisterMessageCallback(
"AttemptUserExit",
@@ -404,13 +409,11 @@ void PeopleHandler::DisplayGaiaLoginInNewTabOrWindow(
SigninErrorController* error_controller =
SigninErrorControllerFactory::GetForProfile(browser->profile());
DCHECK(error_controller->HasError());
- browser->window()->ShowAvatarBubbleFromAvatarButton(
- BrowserWindow::AVATAR_BUBBLE_MODE_REAUTH,
- signin::ManageAccountsParams(), access_point, false);
+ browser->window()->ShowAvatarBubbleFromAvatarButton(
+ BrowserWindow::AVATAR_BUBBLE_MODE_REAUTH, access_point, false);
} else {
browser->window()->ShowAvatarBubbleFromAvatarButton(
- BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN,
- signin::ManageAccountsParams(), access_point, false);
+ BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, access_point, false);
}
}
#endif
@@ -426,7 +429,7 @@ void PeopleHandler::DisplaySpinner() {
const int kTimeoutSec = 30;
DCHECK(!engine_start_timer_);
- engine_start_timer_.reset(new base::OneShotTimer());
+ engine_start_timer_ = std::make_unique<base::OneShotTimer>();
engine_start_timer_->Start(FROM_HERE,
base::TimeDelta::FromSeconds(kTimeoutSec), this,
&PeopleHandler::DisplayTimeout);
@@ -554,7 +557,7 @@ base::Value PeopleHandler::GetStoredAccountsList() {
// account.
auto* identity_manager = IdentityManagerFactory::GetForProfile(profile_);
base::Optional<AccountInfo> primary_account_info =
- identity_manager->FindExtendedAccountInfoForAccount(
+ identity_manager->FindExtendedAccountInfoForAccountWithRefreshToken(
identity_manager->GetPrimaryAccountInfo());
if (primary_account_info.has_value())
accounts_list.push_back(GetAccountValue(primary_account_info.value()));
@@ -575,7 +578,7 @@ void PeopleHandler::HandleStartSyncingWithEmail(const base::ListValue* args) {
base::Optional<AccountInfo> maybe_account =
IdentityManagerFactory::GetForProfile(profile_)
- ->FindAccountInfoForAccountWithRefreshTokenByEmailAddress(
+ ->FindExtendedAccountInfoForAccountWithRefreshTokenByEmailAddress(
email->GetString());
signin_ui_util::EnableSyncFromPromo(
@@ -850,6 +853,11 @@ void PeopleHandler::HandleGetSyncStatus(const base::ListValue* args) {
ResolveJavascriptCallback(*callback_id, *GetSyncStatusDictionary());
}
+void PeopleHandler::HandleSyncPrefsDispatch(const base::ListValue* args) {
+ AllowJavascript();
+ PushSyncPrefs();
+}
+
void PeopleHandler::CloseSyncSetup() {
// Stop a timer to handle timeout in waiting for checking network connection.
engine_start_timer_.reset();
@@ -1037,9 +1045,8 @@ std::unique_ptr<base::DictionaryValue> PeopleHandler::GetSyncStatusDictionary()
"disabled", !service || disallowed_by_policy ||
!service->GetUserSettings()->IsSyncAllowedByPlatform());
sync_status->SetBoolean("signedIn", identity_manager->HasPrimaryAccount());
- sync_status->SetString(
- "signedInUsername",
- signin_ui_util::GetAuthenticatedUsername(identity_manager));
+ sync_status->SetString("signedInUsername",
+ signin_ui_util::GetAuthenticatedUsername(profile_));
sync_status->SetBoolean("hasUnrecoverableError",
service && service->HasUnrecoverableError());
return sync_status;
diff --git a/chromium/chrome/browser/ui/webui/settings/people_handler.h b/chromium/chrome/browser/ui/webui/settings/people_handler.h
index 83cd8916760..51e9195e619 100644
--- a/chromium/chrome/browser/ui/webui/settings/people_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/people_handler.h
@@ -176,6 +176,7 @@ class PeopleHandler : public SettingsPageUIHandler,
void HandleSetEncryption(const base::ListValue* args);
void HandleShowSetupUI(const base::ListValue* args);
void HandleAttemptUserExit(const base::ListValue* args);
+ void HandleSyncPrefsDispatch(const base::ListValue* args);
#if defined(OS_CHROMEOS)
void HandleRequestPinLoginState(const base::ListValue* args);
#endif
diff --git a/chromium/chrome/browser/ui/webui/settings/people_handler_unittest.cc b/chromium/chrome/browser/ui/webui/settings/people_handler_unittest.cc
index 87b349ecacc..1a327ed2a6f 100644
--- a/chromium/chrome/browser/ui/webui/settings/people_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/settings/people_handler_unittest.cc
@@ -46,8 +46,8 @@
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_controller.h"
+#include "content/public/test/browser_task_environment.h"
#include "content/public/test/navigation_simulator.h"
-#include "content/public/test/test_browser_thread_bundle.h"
#include "content/public/test/test_web_ui.h"
#include "content/public/test/web_contents_tester.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -109,6 +109,8 @@ std::string GetConfiguration(const base::DictionaryValue* extra_values,
types.Has(syncer::UserSelectableType::kExtensions));
result.SetBoolean("passwordsSynced",
types.Has(syncer::UserSelectableType::kPasswords));
+ result.SetBoolean("wifiConfigurationsSynced",
+ types.Has(syncer::UserSelectableType::kWifiConfigurations));
result.SetBoolean("preferencesSynced",
types.Has(syncer::UserSelectableType::kPreferences));
result.SetBoolean("tabsSynced", types.Has(syncer::UserSelectableType::kTabs));
@@ -164,6 +166,8 @@ void CheckConfigDataTypeArguments(const base::DictionaryValue* dictionary,
types.Has(syncer::UserSelectableType::kExtensions));
CheckBool(dictionary, "passwordsSynced",
types.Has(syncer::UserSelectableType::kPasswords));
+ CheckBool(dictionary, "wifiConfigurationsSynced",
+ types.Has(syncer::UserSelectableType::kWifiConfigurations));
CheckBool(dictionary, "preferencesSynced",
types.Has(syncer::UserSelectableType::kPreferences));
CheckBool(dictionary, "tabsSynced",
@@ -249,7 +253,7 @@ class PeopleHandlerTest : public ChromeRenderViewHostTestHarness {
&PeopleHandlerTest::OnSetupInProgressHandleDestroyed,
base::Unretained(this))))));
- handler_.reset(new TestingPeopleHandler(&web_ui_, profile()));
+ handler_ = std::make_unique<TestingPeopleHandler>(&web_ui_, profile());
handler_->AllowJavascript();
web_ui_.set_web_contents(web_contents());
}
@@ -262,12 +266,9 @@ class PeopleHandlerTest : public ChromeRenderViewHostTestHarness {
ChromeRenderViewHostTestHarness::TearDown();
}
- content::BrowserContext* CreateBrowserContext() override {
- // Setup the profile.
- std::unique_ptr<TestingProfile> profile =
- IdentityTestEnvironmentProfileAdaptor::
- CreateProfileForIdentityTestEnvironment();
- return profile.release();
+ TestingProfile::TestingFactories GetTestingFactories() const override {
+ return IdentityTestEnvironmentProfileAdaptor::
+ GetIdentityTestEnvironmentFactories();
}
// Setup the expectations for calls made when displaying the config page.
@@ -1107,6 +1108,7 @@ TEST_F(PeopleHandlerTest, ShowSetupSyncEverything) {
CheckBool(dictionary, "bookmarksRegistered", true);
CheckBool(dictionary, "extensionsRegistered", true);
CheckBool(dictionary, "passwordsRegistered", true);
+ CheckBool(dictionary, "wifiConfigurationsRegistered", true);
CheckBool(dictionary, "preferencesRegistered", true);
CheckBool(dictionary, "tabsRegistered", true);
CheckBool(dictionary, "themesRegistered", true);
@@ -1402,7 +1404,7 @@ TEST_P(PeopleHandlerDiceUnifiedConsentTest, StoredAccountsList) {
base::CommandLine::ForCurrentProcess()->AppendSwitch(switches::kNoFirstRun);
ASSERT_FALSE(first_run::IsChromeFirstRun());
- content::TestBrowserThreadBundle test_browser_thread_bundle;
+ content::BrowserTaskEnvironment task_environment;
// Decode test parameters.
bool dice_enabled;
diff --git a/chromium/chrome/browser/ui/webui/settings/profile_info_handler_unittest.cc b/chromium/chrome/browser/ui/webui/settings/profile_info_handler_unittest.cc
index a5229444221..8bccab5cf80 100644
--- a/chromium/chrome/browser/ui/webui/settings/profile_info_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/settings/profile_info_handler_unittest.cc
@@ -14,7 +14,7 @@
#include "chrome/test/base/testing_profile_manager.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "content/public/browser/web_ui_data_source.h"
-#include "content/public/test/test_browser_thread_bundle.h"
+#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_web_ui.h"
#include "net/base/data_url.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -66,7 +66,7 @@ class ProfileInfoHandlerTest : public testing::Test {
profile_ = profile_manager_.CreateTestingProfile("Profile 1");
#endif
- handler_.reset(new TestProfileInfoHandler(profile_));
+ handler_ = std::make_unique<TestProfileInfoHandler>(profile_);
handler_->set_web_ui(&web_ui_);
}
@@ -101,7 +101,7 @@ class ProfileInfoHandlerTest : public testing::Test {
TestProfileInfoHandler* handler() const { return handler_.get(); }
private:
- content::TestBrowserThreadBundle thread_bundle_;
+ content::BrowserTaskEnvironment task_environment_;
TestingProfileManager profile_manager_;
content::TestWebUI web_ui_;
diff --git a/chromium/chrome/browser/ui/webui/settings/reset_settings_handler.cc b/chromium/chrome/browser/ui/webui/settings/reset_settings_handler.cc
index a1ef45f40ef..7dae9628108 100644
--- a/chromium/chrome/browser/ui/webui/settings/reset_settings_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/reset_settings_handler.cc
@@ -212,17 +212,17 @@ void ResetSettingsHandler::OnGetReportedSettingsDone(std::string callback_id) {
void ResetSettingsHandler::OnShowResetProfileDialog(
const base::ListValue* args) {
if (!GetResetter()->IsActive()) {
- setting_snapshot_.reset(new ResettableSettingsSnapshot(profile_));
+ setting_snapshot_ = std::make_unique<ResettableSettingsSnapshot>(profile_);
}
if (brandcode_.empty())
return;
- config_fetcher_.reset(new BrandcodeConfigFetcher(
+ config_fetcher_ = std::make_unique<BrandcodeConfigFetcher>(
g_browser_process->system_network_context_manager()
->GetURLLoaderFactory(),
base::Bind(&ResetSettingsHandler::OnSettingsFetched,
base::Unretained(this)),
- GURL("https://tools.google.com/service/update2"), brandcode_));
+ GURL("https://tools.google.com/service/update2"), brandcode_);
}
void ResetSettingsHandler::OnHideResetProfileDialog(
@@ -260,7 +260,7 @@ void ResetSettingsHandler::ResetProfile(
// If failed to fetch BrandcodedDefaultSettings or this is an organic
// installation, use default settings.
if (!default_settings)
- default_settings.reset(new BrandcodedDefaultSettings);
+ default_settings = std::make_unique<BrandcodedDefaultSettings>();
GetResetter()->Reset(
ProfileResetter::ALL, std::move(default_settings),
@@ -275,7 +275,7 @@ void ResetSettingsHandler::ResetProfile(
ProfileResetter* ResetSettingsHandler::GetResetter() {
if (!resetter_)
- resetter_.reset(new ProfileResetter(profile_));
+ resetter_ = std::make_unique<ProfileResetter>(profile_);
return resetter_.get();
}
diff --git a/chromium/chrome/browser/ui/webui/settings/reset_settings_handler_unittest.cc b/chromium/chrome/browser/ui/webui/settings/reset_settings_handler_unittest.cc
index 7c8f38e8be7..b21f85e169b 100644
--- a/chromium/chrome/browser/ui/webui/settings/reset_settings_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/settings/reset_settings_handler_unittest.cc
@@ -11,7 +11,7 @@
#include "chrome/browser/ui/webui/settings/reset_settings_handler.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/web_ui_data_source.h"
-#include "content/public/test/test_browser_thread_bundle.h"
+#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_web_ui.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -73,7 +73,8 @@ class ResetSettingsHandlerTest : public testing::Test {
public:
ResetSettingsHandlerTest() {
google_brand::BrandForTesting brand_for_testing("");
- handler_.reset(new TestingResetSettingsHandler(&profile_, &web_ui_));
+ handler_ =
+ std::make_unique<TestingResetSettingsHandler>(&profile_, &web_ui_);
}
TestingResetSettingsHandler* handler() { return handler_.get(); }
@@ -81,7 +82,7 @@ class ResetSettingsHandlerTest : public testing::Test {
private:
// The order here matters.
- content::TestBrowserThreadBundle thread_bundle_;
+ content::BrowserTaskEnvironment task_environment_;
TestingProfile profile_;
content::TestWebUI web_ui_;
std::unique_ptr<TestingResetSettingsHandler> handler_;
diff --git a/chromium/chrome/browser/ui/webui/settings/search_engines_handler.cc b/chromium/chrome/browser/ui/webui/settings/search_engines_handler.cc
index 24247be5a14..37eab4887a8 100644
--- a/chromium/chrome/browser/ui/webui/settings/search_engines_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/search_engines_handler.cc
@@ -195,8 +195,8 @@ SearchEnginesHandler::CreateDictionaryForEngine(int index, bool is_default) {
"keyword",
table_model->GetText(index, IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN));
Profile* profile = Profile::FromWebUI(web_ui());
- dict->SetString("url", template_url->url_ref().DisplayURL(
- UIThreadSearchTermsData(profile)));
+ dict->SetString(
+ "url", template_url->url_ref().DisplayURL(UIThreadSearchTermsData()));
dict->SetBoolean("urlLocked", template_url->prepopulate_id() > 0);
GURL icon_url = template_url->favicon_url();
if (icon_url.is_valid())
@@ -284,10 +284,10 @@ void SearchEnginesHandler::HandleSearchEngineEditStarted(
return;
}
- edit_controller_.reset(new EditSearchEngineController(
+ edit_controller_ = std::make_unique<EditSearchEngineController>(
index == kNewSearchEngineIndex ? nullptr
: list_controller_.GetTemplateURL(index),
- this, Profile::FromWebUI(web_ui())));
+ this, Profile::FromWebUI(web_ui()));
}
void SearchEnginesHandler::OnEditedKeyword(TemplateURL* template_url,
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.cc b/chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.cc
index d9c05922474..25dbe1f03e7 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.cc
@@ -20,6 +20,7 @@
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/render_process_host.h"
+#include "content/public/browser/same_site_data_remover.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_ui.h"
@@ -130,6 +131,7 @@ void CookiesViewHandler::OnJavascriptAllowed() {
}
void CookiesViewHandler::OnJavascriptDisallowed() {
+ callback_weak_ptr_factory_.InvalidateWeakPtrs();
}
void CookiesViewHandler::RegisterMessages() {
@@ -164,6 +166,10 @@ void CookiesViewHandler::RegisterMessages() {
base::BindRepeating(&CookiesViewHandler::HandleRemove,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
+ "localData.removeThirdPartyCookies",
+ base::BindRepeating(&CookiesViewHandler::HandleRemoveThirdParty,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
"localData.reload",
base::BindRepeating(&CookiesViewHandler::HandleReloadCookies,
base::Unretained(this)));
@@ -244,6 +250,13 @@ void CookiesViewHandler::EnsureCookiesTreeModelCreated() {
}
}
+void CookiesViewHandler::RecreateCookiesTreeModel() {
+ cookies_tree_model_.reset();
+ filter_.clear();
+ sorted_sites_.clear();
+ EnsureCookiesTreeModelCreated();
+}
+
void CookiesViewHandler::HandleGetCookieDetails(const base::ListValue* args) {
CHECK(request_.callback_id_.empty());
CHECK_EQ(2U, args->GetSize());
@@ -306,10 +319,7 @@ void CookiesViewHandler::HandleReloadCookies(const base::ListValue* args) {
CHECK(args->GetString(0, &request_.callback_id_));
AllowJavascript();
- cookies_tree_model_.reset();
- filter_.clear();
- sorted_sites_.clear();
- EnsureCookiesTreeModelCreated();
+ RecreateCookiesTreeModel();
}
void CookiesViewHandler::HandleRemoveAll(const base::ListValue* args) {
@@ -335,6 +345,20 @@ void CookiesViewHandler::HandleRemove(const base::ListValue* args) {
}
}
+void CookiesViewHandler::HandleRemoveThirdParty(const base::ListValue* args) {
+ CHECK(request_.callback_id_.empty());
+ CHECK_EQ(1U, args->GetSize());
+ CHECK(args->GetString(0, &request_.callback_id_));
+
+ AllowJavascript();
+ Profile* profile = Profile::FromWebUI(web_ui());
+ ClearSameSiteNoneData(
+ base::BindOnce(&CookiesViewHandler::RecreateCookiesTreeModel,
+ callback_weak_ptr_factory_.GetWeakPtr()),
+ profile,
+ /* clear_storage */ true);
+}
+
void CookiesViewHandler::HandleRemoveShownItems(const base::ListValue* args) {
CHECK_EQ(0U, args->GetSize());
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.h b/chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.h
index 574978c9b97..d5a031bf16a 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.h
@@ -49,6 +49,9 @@ class CookiesViewHandler : public SettingsPageUIHandler,
// Creates the CookiesTreeModel if necessary.
void EnsureCookiesTreeModelCreated();
+ // Resets the CookiesTreeModel, the current |filter_|, and the site list.
+ void RecreateCookiesTreeModel();
+
// Set |filter_| and get a portion (or all) of the list items.
void HandleGetDisplayList(const base::ListValue* args);
@@ -70,6 +73,9 @@ class CookiesViewHandler : public SettingsPageUIHandler,
// Remove selected sites data.
void HandleRemove(const base::ListValue* args);
+ // Removes cookies and site data available in third-party contexts.
+ void HandleRemoveThirdParty(const base::ListValue* args);
+
// Get children nodes data and pass it to 'CookiesView.loadChildren' to
// update the WebUI.
void SendChildren(const CookieTreeNode* parent);
@@ -111,6 +117,9 @@ class CookiesViewHandler : public SettingsPageUIHandler,
std::unique_ptr<CookiesTreeModelUtil> model_util_;
+ // Used to cancel callbacks when JavaScript becomes disallowed.
+ base::WeakPtrFactory<CookiesViewHandler> callback_weak_ptr_factory_{this};
+
DISALLOW_COPY_AND_ASSIGN(CookiesViewHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_import_data_handler.cc b/chromium/chrome/browser/ui/webui/settings/settings_import_data_handler.cc
index f546887fdfc..b2e78bd722b 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_import_data_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/settings_import_data_handler.cc
@@ -147,7 +147,7 @@ void ImportDataHandler::InitializeDialog(const base::ListValue* args) {
std::string callback_id;
CHECK(args->GetString(0, &callback_id));
- importer_list_.reset(new ImporterList());
+ importer_list_ = std::make_unique<ImporterList>();
importer_list_->DetectSourceProfiles(
g_browser_process->GetApplicationLocale(),
true, // include_interactive_profiles
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
index 9dc2fca39cb..3ff5f45c78b 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+++ b/chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -13,6 +13,7 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/windows_version.h"
+#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "build/buildflag.h"
#include "chrome/browser/autofill/personal_data_manager_factory.h"
@@ -40,6 +41,7 @@
#include "components/autofill/core/common/autofill_constants.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/autofill_payments_features.h"
+#include "components/browsing_data/core/features.h"
#include "components/google/core/common/google_util.h"
#include "components/omnibox/common/omnibox_features.h"
#include "components/password_manager/core/browser/manage_passwords_referrer.h"
@@ -59,12 +61,14 @@
#include "media/base/media_switches.h"
#include "net/base/url_util.h"
#include "services/device/public/cpp/device_features.h"
+#include "third_party/blink/public/common/features.h"
#include "ui/accessibility/accessibility_switches.h"
+#include "ui/base/accelerators/accelerator.h"
#include "ui/base/l10n/l10n_util.h"
#if defined(OS_CHROMEOS)
#include "ash/public/cpp/ash_switches.h"
-#include "ash/public/interfaces/voice_interaction_controller.mojom.h"
+#include "ash/public/mojom/voice_interaction_controller.mojom.h"
#include "base/system/sys_info.h"
#include "chrome/browser/chromeos/account_manager/account_manager_util.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
@@ -81,6 +85,7 @@
#include "chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.h"
#include "chrome/browser/ui/webui/chromeos/smb_shares/smb_shares_localized_strings_provider.h"
#include "chrome/common/pref_names.h"
+#include "chrome/common/webui_url_constants.h"
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/constants/chromeos_switches.h"
#include "chromeos/services/assistant/public/features.h"
@@ -101,12 +106,12 @@
#include "chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.h"
#include "device/fido/win/webauthn_api.h"
-#if defined(GOOGLE_CHROME_BUILD)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "base/metrics/field_trial_params.h"
#include "base/strings/strcat.h"
#include "chrome/grit/chrome_unscaled_resources.h"
#include "ui/base/resource/resource_bundle.h"
-#endif // defined(GOOGLE_CHROME_BUILD)
+#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
#endif // defined(OS_WIN)
#if defined(USE_NSS_CERTS)
@@ -116,10 +121,6 @@
namespace settings {
namespace {
-// Note that settings.html contains a <script> tag which imports a script of
-// the following name. These names must be kept in sync.
-constexpr char kLocalizedStringsFile[] = "strings.js";
-
#if defined(OS_CHROMEOS)
// Generates a Google Help URL which includes a "board type" parameter. Some
// help pages need to be adjusted depending on the type of CrOS device that is
@@ -195,13 +196,17 @@ void AddA11yStrings(content::WebUIDataSource* html_source) {
{"moreFeaturesLinkDescription",
IDS_SETTINGS_MORE_FEATURES_LINK_DESCRIPTION},
{"captionsTitle", IDS_SETTINGS_CAPTIONS},
+ {"captionsSettings", IDS_SETTINGS_CAPTIONS_SETTINGS},
+ {"captionsPreview", IDS_SETTINGS_CAPTIONS_PREVIEW},
{"captionsTextSize", IDS_SETTINGS_CAPTIONS_TEXT_SIZE},
{"captionsTextFont", IDS_SETTINGS_CAPTIONS_TEXT_FONT},
{"captionsTextColor", IDS_SETTINGS_CAPTIONS_TEXT_COLOR},
{"captionsTextOpacity", IDS_SETTINGS_CAPTIONS_TEXT_OPACITY},
{"captionsBackgroundOpacity", IDS_SETTINGS_CAPTIONS_BACKGROUND_OPACITY},
- {"captionsOpacityMin", IDS_SETTINGS_CAPTIONS_OPACITY_MIN},
- {"captionsOpacityMax", IDS_SETTINGS_CAPTIONS_OPACITY_MAX},
+ {"captionsOpacityOpaque", IDS_SETTINGS_CAPTIONS_OPACITY_OPAQUE},
+ {"captionsOpacitySemiTransparent",
+ IDS_SETTINGS_CAPTIONS_OPACITY_SEMI_TRANSPARENT},
+ {"captionsOpacityTransparent", IDS_SETTINGS_CAPTIONS_OPACITY_TRANSPARENT},
{"captionsTextShadow", IDS_SETTINGS_CAPTIONS_TEXT_SHADOW},
{"captionsTextShadowNone", IDS_SETTINGS_CAPTIONS_TEXT_SHADOW_NONE},
{"captionsTextShadowRaised", IDS_SETTINGS_CAPTIONS_TEXT_SHADOW_RAISED},
@@ -307,6 +312,8 @@ void AddA11yStrings(content::WebUIDataSource* html_source) {
{"switchAccessAutoScanLabel", IDS_SETTINGS_SWITCH_ACCESS_AUTO_SCAN_LABEL},
{"switchAccessAutoScanSpeedLabel",
IDS_SETTINGS_SWITCH_ACCESS_AUTO_SCAN_SPEED_LABEL},
+ {"switchAccessAutoScanKeyboardSpeedLabel",
+ IDS_SETTINGS_SWITCH_ACCESS_AUTO_SCAN_KEYBOARD_SPEED_LABEL},
{"durationInSeconds", IDS_SETTINGS_DURATION_IN_SECONDS},
{"manageAccessibilityFeatures",
IDS_SETTINGS_ACCESSIBILITY_MANAGE_ACCESSIBILITY_FEATURES},
@@ -396,6 +403,11 @@ void AddA11yStrings(content::WebUIDataSource* html_source) {
html_source->AddBoolean(
"showExperimentalAccessibilitySwitchAccess",
cmd.HasSwitch(::switches::kEnableExperimentalAccessibilitySwitchAccess));
+
+ html_source->AddBoolean(
+ "showExperimentalAccessibilitySwitchAccessImprovedTextInput",
+ cmd.HasSwitch(
+ ::switches::kEnableExperimentalAccessibilitySwitchAccessText));
#endif
}
@@ -403,7 +415,7 @@ void AddAboutStrings(content::WebUIDataSource* html_source) {
static constexpr LocalizedString kLocalizedStrings[] = {
{"aboutProductLogoAlt", IDS_SHORT_PRODUCT_LOGO_ALT_TEXT},
-#if defined(GOOGLE_CHROME_BUILD)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
{"aboutReportAnIssue", IDS_SETTINGS_ABOUT_PAGE_REPORT_AN_ISSUE},
#endif
@@ -431,6 +443,8 @@ void AddAboutStrings(content::WebUIDataSource* html_source) {
IDS_SETTINGS_ABOUT_PAGE_RELAUNCH_AND_POWERWASH},
{"aboutRollbackInProgress", IDS_SETTINGS_UPGRADE_ROLLBACK_IN_PROGRESS},
{"aboutRollbackSuccess", IDS_SETTINGS_UPGRADE_ROLLBACK_SUCCESS},
+ {"aboutUpdateOsSettingsLink",
+ IDS_SETTINGS_ABOUT_SEE_OS_SETTINGS_FOR_UPDATE_MESSAGE},
{"aboutUpgradeUpdatingChannelSwitch",
IDS_SETTINGS_UPGRADE_UPDATING_CHANNEL_SWITCH},
{"aboutUpgradeSuccessChannelSwitch",
@@ -567,9 +581,6 @@ void AddCrostiniStrings(content::WebUIDataSource* html_source,
html_source->AddBoolean(
"showCrostiniExportImport",
crostini::IsCrostiniExportImportUIAllowedForProfile(profile));
- html_source->AddBoolean(
- "enableCrostiniUsbDeviceSupport",
- base::FeatureList::IsEnabled(chromeos::features::kCrostiniUsbSupport));
}
void AddPluginVmStrings(content::WebUIDataSource* html_source,
@@ -622,13 +633,45 @@ void AddAndroidAppStrings(content::WebUIDataSource* html_source) {
void AddAppsStrings(content::WebUIDataSource* html_source) {
LocalizedString localized_strings[] = {
{"appsPageTitle", IDS_SETTINGS_APPS_TITLE},
- {"manageYourApps", IDS_SETTINGS_APPS_LINK_TEXT},
- {"manageYourAppsSublabel", IDS_SETTINGS_APPS_LINK_SUBLABEL_TEXT},
+ {"appManagementTitle", IDS_SETTINGS_APPS_LINK_TEXT},
};
AddLocalizedStringsBulk(html_source, localized_strings,
base::size(localized_strings));
}
+
+void AddAppManagementStrings(content::WebUIDataSource* html_source) {
+ static constexpr LocalizedString localized_strings[] = {
+ {"appListTitle", IDS_APP_MANAGEMENT_APP_LIST_TITLE},
+ {"appNoPermission", IDS_APPLICATION_INFO_APP_NO_PERMISSIONS_TEXT},
+ {"camera", IDS_APP_MANAGEMENT_CAMERA},
+ {"contacts", IDS_APP_MANAGEMENT_CONTACTS},
+ {"controlledByPolicy", IDS_CONTROLLED_SETTING_POLICY},
+ {"lessApps", IDS_APP_MANAGEMENT_LESS_APPS},
+ {"location", IDS_APP_MANAGEMENT_LOCATION},
+ {"microphone", IDS_APP_MANAGEMENT_MICROPHONE},
+ {"moreApps", IDS_APP_MANAGEMENT_MORE_APPS},
+ {"moreSettings", IDS_APP_MANAGEMENT_MORE_SETTINGS},
+ {"notifications", IDS_APP_MANAGEMENT_NOTIFICATIONS},
+ {"notificationSublabel", IDS_APP_MANAGEMENT_NOTIFICATIONS_SUBLABEL},
+ {"openAndroidSettings", IDS_APP_MANAGEMENT_ANDROID_SETTINGS},
+ {"openExtensionsSettings", IDS_APP_MANAGEMENT_EXTENSIONS_SETTINGS},
+ {"openSiteSettings", IDS_APP_MANAGEMENT_SITE_SETTING},
+ {"permissions", IDS_APP_MANAGEMENT_PERMISSIONS},
+ {"pinControlledByPolicy", IDS_APP_MANAGEMENT_PIN_ENFORCED_BY_POLICY},
+ {"pinToShelf", IDS_APP_MANAGEMENT_PIN_TO_SHELF},
+ {"policyAppUninstallPolicy", IDS_APP_MANAGEMENT_POLICY_APP_POLICY_STRING},
+ {"size", IDS_APP_MANAGEMENT_SIZE},
+ {"storage", IDS_APP_MANAGEMENT_STORAGE},
+ {"systemAppUninstallPolicy", IDS_APP_MANAGEMENT_SYSTEM_APP_POLICY_STRING},
+ {"thisAppCan", IDS_APP_MANAGEMENT_THIS_APP_CAN},
+ {"title", IDS_APP_MANAGEMENT_TITLE},
+ {"uninstallApp", IDS_APP_MANAGEMENT_UNINSTALL_APP},
+ {"version", IDS_APP_MANAGEMENT_VERSION},
+ };
+ AddLocalizedStringsBulk(html_source, localized_strings,
+ base::size(localized_strings));
+}
#endif
#if defined(OS_CHROMEOS)
@@ -678,7 +721,6 @@ void AddAppearanceStrings(content::WebUIDataSource* html_source,
{"personalizationPageTitle", IDS_OS_SETTINGS_PERSONALIZATION},
{"openWallpaperApp", IDS_OS_SETTINGS_OPEN_WALLPAPER_APP},
{"setWallpaper", IDS_OS_SETTINGS_SET_WALLPAPER},
- {"osLanguagesPageTitle", IDS_OS_SETTINGS_LANGUAGES_AND_INPUT_PAGE_TITLE},
#endif
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
{"showWindowDecorations", IDS_SHOW_WINDOW_DECORATIONS},
@@ -842,6 +884,7 @@ void AddDeviceStrings(content::WebUIDataSource* html_source) {
{"mouseSpeed", IDS_SETTINGS_MOUSE_SPEED_LABEL},
{"mouseSwapButtons", IDS_SETTINGS_MOUSE_SWAP_BUTTONS_LABEL},
{"mouseReverseScroll", IDS_SETTINGS_MOUSE_REVERSE_SCROLL_LABEL},
+ {"pointerAccelerationLabel", IDS_SETTINGS_POINTER_ACCELERATION_LABEL},
};
AddLocalizedStringsBulk(html_source, kPointersStrings,
base::size(kPointersStrings));
@@ -988,6 +1031,10 @@ void AddDeviceStrings(content::WebUIDataSource* html_source) {
html_source->AddBoolean("hasExternalTouchDevice",
display::HasExternalTouchscreenDevice());
+ html_source->AddBoolean(
+ "allowDisableMouseAcceleration",
+ base::FeatureList::IsEnabled(features::kAllowDisableMouseAcceleration));
+
static constexpr LocalizedString kStorageStrings[] = {
{"storageTitle", IDS_SETTINGS_STORAGE_TITLE},
{"storageItemInUse", IDS_SETTINGS_STORAGE_ITEM_IN_USE},
@@ -1019,10 +1066,10 @@ void AddDeviceStrings(content::WebUIDataSource* html_source) {
{"storageDeleteAllButtonTitle",
IDS_SETTINGS_STORAGE_DELETE_ALL_BUTTON_TITLE},
{"storageExternal", IDS_SETTINGS_STORAGE_EXTERNAL},
- {"storageAndroidAppsExternalDrives",
- IDS_SETTINGS_STORAGE_ANDROID_APPS_ACCESS_EXTERNAL_DRIVES},
{"storageAndroidAppsExternalDrivesNote",
- IDS_SETTINGS_STORAGE_ANDROID_APPS_ACCESS_EXTERNAL_DRIVES_NOTE}};
+ IDS_SETTINGS_STORAGE_ANDROID_APPS_ACCESS_EXTERNAL_DRIVES_NOTE},
+ {"storageExternalStorageListHeader",
+ IDS_SETTINGS_STORAGE_EXTERNAL_STORAGE_LIST_HEADER}};
AddLocalizedStringsBulk(html_source, kStorageStrings,
base::size(kStorageStrings));
@@ -1098,7 +1145,7 @@ void AddDownloadsStrings(content::WebUIDataSource* html_source) {
base::size(kLocalizedStrings));
}
-#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
+#if defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
void AddChromeCleanupStrings(content::WebUIDataSource* html_source) {
const wchar_t kUnwantedSoftwareProtectionWhitePaperUrl[] =
L"https://www.google.ca/chrome/browser/privacy/"
@@ -1227,11 +1274,11 @@ void AddIncompatibleApplicationsStrings(content::WebUIDataSource* html_source) {
html_source->AddString("incompatibleApplicationsSubpageLearnHow",
learn_how_text);
}
-#endif // defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
+#endif // defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
void AddResetStrings(content::WebUIDataSource* html_source) {
static constexpr LocalizedString kLocalizedStrings[] = {
-#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
+#if defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
{"resetPageTitle", IDS_SETTINGS_RESET_AND_CLEANUP},
#else
{"resetPageTitle", IDS_SETTINGS_RESET},
@@ -1254,7 +1301,7 @@ void AddResetStrings(content::WebUIDataSource* html_source) {
{"resetAutomatedDialogTitle", IDS_SETTINGS_RESET_AUTOMATED_DIALOG_TITLE},
{"resetProfileBannerButton", IDS_SETTINGS_RESET_BANNER_RESET_BUTTON_TEXT},
{"resetProfileBannerDescription", IDS_SETTINGS_RESET_BANNER_TEXT},
-#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
+#if defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
{"resetCleanupComputerTrigger",
IDS_SETTINGS_RESET_CLEAN_UP_COMPUTER_TRIGGER},
#endif
@@ -1381,8 +1428,6 @@ void AddInternetStrings(content::WebUIDataSource* html_source) {
IDS_SETTINGS_INTERNET_ADD_CONNECTION_NOT_ALLOWED},
{"internetAddThirdPartyVPN", IDS_SETTINGS_INTERNET_ADD_THIRD_PARTY_VPN},
{"internetAddVPN", IDS_SETTINGS_INTERNET_ADD_VPN},
- {"internetAddArcVPN", IDS_SETTINGS_INTERNET_ADD_ARC_VPN},
- {"internetAddArcVPNProvider", IDS_SETTINGS_INTERNET_ADD_ARC_VPN_PROVIDER},
{"internetAddWiFi", IDS_SETTINGS_INTERNET_ADD_WIFI},
{"internetConfigName", IDS_SETTINGS_INTERNET_CONFIG_NAME},
{"internetDetailPageTitle", IDS_SETTINGS_INTERNET_DETAIL},
@@ -1400,8 +1445,6 @@ void AddInternetStrings(content::WebUIDataSource* html_source) {
IDS_SETTINGS_INTERNET_TOGGLE_TETHER_SUBTEXT},
{"internetToggleWiFiA11yLabel",
IDS_SETTINGS_INTERNET_TOGGLE_WIFI_ACCESSIBILITY_LABEL},
- {"internetToggleWiMAXA11yLabel",
- IDS_SETTINGS_INTERNET_TOGGLE_WIMAX_ACCESSIBILITY_LABEL},
{"knownNetworksAll", IDS_SETTINGS_INTERNET_KNOWN_NETWORKS_ALL},
{"knownNetworksButton", IDS_SETTINGS_INTERNET_KNOWN_NETWORKS_BUTTON},
{"knownNetworksMessage", IDS_SETTINGS_INTERNET_KNOWN_NETWORKS_MESSAGE},
@@ -1452,6 +1495,10 @@ void AddInternetStrings(content::WebUIDataSource* html_source) {
{"networkShared", IDS_SETTINGS_INTERNET_NETWORK_SHARED},
{"networkVpnBuiltin", IDS_NETWORK_TYPE_VPN_BUILTIN},
{"networkOutOfRange", IDS_SETTINGS_INTERNET_WIFI_NETWORK_OUT_OF_RANGE},
+ {"cellularContactSpecificCarrier",
+ IDS_SETTINGS_INTERNET_CELLULAR_CONTACT_SPECIFIC_CARRIER},
+ {"cellularContactDefaultCarrier",
+ IDS_SETTINGS_INTERNET_CELLULAR_CONTACT_DEFAULT_CARRIER},
{"tetherPhoneOutOfRange",
IDS_SETTINGS_INTERNET_TETHER_PHONE_OUT_OF_RANGE},
{"gmscoreNotificationsTitle",
@@ -1521,6 +1568,8 @@ void AddLanguagesStrings(content::WebUIDataSource* html_source) {
{"removeLanguage", IDS_SETTINGS_LANGUAGES_LANGUAGES_LIST_REMOVE},
{"addLanguages", IDS_SETTINGS_LANGUAGES_LANGUAGES_ADD},
#if defined(OS_CHROMEOS)
+ {"osLanguagesPageTitle", IDS_OS_SETTINGS_LANGUAGES_AND_INPUT_PAGE_TITLE},
+ {"osLanguagesListTitle", IDS_OS_SETTINGS_LANGUAGES_LIST_TITLE},
{"inputMethodsListTitle", IDS_SETTINGS_LANGUAGES_INPUT_METHODS_LIST_TITLE},
{"inputMethodEnabled", IDS_SETTINGS_LANGUAGES_INPUT_METHOD_ENABLED},
{"inputMethodsExpandA11yLabel",
@@ -1612,6 +1661,15 @@ void AddChromeOSUserStrings(content::WebUIDataSource* html_source,
"secondaryUserBannerText",
l10n_util::GetStringFUTF16(IDS_SETTINGS_SECONDARY_USER_BANNER,
base::ASCIIToUTF16(primary_user_email)));
+ html_source->AddString("browserSettingsBannerText",
+ l10n_util::GetStringFUTF16(
+ IDS_SETTINGS_BROWSER_SETTINGS_BANNER,
+ base::ASCIIToUTF16(chrome::kChromeUISettingsURL)));
+ html_source->AddString(
+ "osSettingsBannerText",
+ l10n_util::GetStringFUTF16(
+ IDS_SETTINGS_OS_SETTINGS_BANNER,
+ base::ASCIIToUTF16(chrome::kChromeUIOSSettingsURL)));
html_source->AddBoolean("isActiveDirectoryUser",
user && user->IsActiveDirectoryUser());
@@ -1688,6 +1746,14 @@ void AddAutofillStrings(content::WebUIDataSource* html_source,
IDS_SETTINGS_PASSWORDS_AUTOSIGNIN_CHECKBOX_LABEL},
{"passwordsAutosigninDescription",
IDS_SETTINGS_PASSWORDS_AUTOSIGNIN_CHECKBOX_DESC},
+ {"passwordsLeakDetectionLabel",
+ IDS_SETTINGS_PASSWORDS_LEAK_DETECTION_LABEL},
+ {"passwordsLeakDetectionSignedInDescription",
+ IDS_SETTINGS_PASSWORDS_LEAK_DETECTION_SIGNED_IN_DESC},
+ {"passwordsLeakDetectionSignedOutDisabledDescription",
+ IDS_SETTINGS_PASSWORDS_LEAK_DETECTION_SIGNED_OUT_DISABLED_DESC},
+ {"passwordsLeakDetectionSignedOutEnabledDescription",
+ IDS_SETTINGS_PASSWORDS_LEAK_DETECTION_SIGNED_OUT_ENABLED_DESC},
{"savedPasswordsHeading", IDS_SETTINGS_PASSWORDS_SAVED_HEADING},
{"passwordExceptionsHeading", IDS_SETTINGS_PASSWORDS_EXCEPTIONS_HEADING},
{"deletePasswordException", IDS_SETTINGS_PASSWORDS_DELETE_EXCEPTION},
@@ -1766,6 +1832,16 @@ void AddAutofillStrings(content::WebUIDataSource* html_source,
/*is_test_mode=*/false,
/*log_manager=*/nullptr));
+ html_source->AddBoolean(
+ "passwordsLeakDetectionEnabled",
+ base::FeatureList::IsEnabled(password_manager::features::kLeakDetection));
+
+ ui::Accelerator undoAccelerator(ui::VKEY_Z, ui::EF_PLATFORM_ACCELERATOR);
+ html_source->AddString(
+ "undoDescription",
+ l10n_util::GetStringFUTF16(IDS_UNDO_DESCRIPTION,
+ undoAccelerator.GetShortcutText()));
+
AddLocalizedStringsBulk(html_source, kLocalizedStrings,
base::size(kLocalizedStrings));
}
@@ -1835,6 +1911,8 @@ void AddPeopleStrings(content::WebUIDataSource* html_source, Profile* profile) {
IDS_SETTINGS_KERBEROS_ACCOUNTS_REMOVE_ACCOUNT_LABEL},
{"kerberosAccountsAccountRemovedTip",
IDS_SETTINGS_KERBEROS_ACCOUNTS_ACCOUNT_REMOVED_TIP},
+ {"kerberosAccountsAccountRefreshedTip",
+ IDS_SETTINGS_KERBEROS_ACCOUNTS_ACCOUNT_REFRESHED_TIP},
{"kerberosAccountsSignedIn", IDS_SETTINGS_KERBEROS_ACCOUNTS_SIGNED_IN},
{"kerberosAccountsSignedOut", IDS_SETTINGS_KERBEROS_ACCOUNTS_SIGNED_OUT},
{"kerberosAccountsReauthenticationLabel",
@@ -1909,7 +1987,6 @@ void AddPeopleStrings(content::WebUIDataSource* html_source, Profile* profile) {
IDS_SETTINGS_PEOPLE_LOCK_SCREEN_FINGERPRINT_LESS_SECURE},
{"lockScreenDeleteFingerprintLabel",
IDS_SETTINGS_PEOPLE_LOCK_SCREEN_DELETE_FINGERPRINT_ARIA_LABEL},
- {"lockScreenMediaKeys", IDS_SETTINGS_PEOPLE_LOCK_SCREEN_MEDIA_KEYS},
{"lockScreenNotificationHide",
IDS_ASH_SETTINGS_LOCK_SCREEN_NOTIFICATION_HIDE},
{"lockScreenNotificationHideSensitive",
@@ -1960,6 +2037,8 @@ void AddPeopleStrings(content::WebUIDataSource* html_source, Profile* profile) {
{"photoDiscardAccessibleText", IDS_SETTINGS_PHOTO_DISCARD_ACCESSIBLE_TEXT},
{"photoModeAccessibleText", IDS_SETTINGS_PHOTO_MODE_ACCESSIBLE_TEXT},
{"videoModeAccessibleText", IDS_SETTINGS_VIDEO_MODE_ACCESSIBLE_TEXT},
+ {"wifiConfigurationsCheckboxLabel",
+ IDS_SETTINGS_WIFI_CONFIGURATIONS_CHECKBOX_LABEL},
#else // !defined(OS_CHROMEOS)
{"domainManagedProfile", IDS_SETTINGS_PEOPLE_DOMAIN_MANAGED_PROFILE},
{"editPerson", IDS_SETTINGS_EDIT_PERSON},
@@ -2223,7 +2302,8 @@ void AddPrintingStrings(content::WebUIDataSource* html_source) {
{"addCupsPrinter", IDS_SETTINGS_PRINTING_CUPS_PRINTERS_ADD_PRINTER},
{"editPrinter", IDS_SETTINGS_PRINTING_CUPS_PRINTERS_EDIT},
{"removePrinter", IDS_SETTINGS_PRINTING_CUPS_PRINTERS_REMOVE},
- {"configurePrinter", IDS_SETTINGS_PRINTING_CUPS_PRINTER_CONFIGURE_BUTTON},
+ {"setupPrinter", IDS_SETTINGS_PRINTING_CUPS_PRINTER_SETUP_BUTTON},
+ {"savePrinter", IDS_SETTINGS_PRINTING_CUPS_PRINTER_SAVE_BUTTON},
{"searchLabel", IDS_SETTINGS_PRINTING_CUPS_SEARCH_LABEL},
{"noSearchResults", IDS_SEARCH_NO_RESULTS},
{"printerDetailsTitle", IDS_SETTINGS_PRINTING_CUPS_PRINTER_DETAILS_TITLE},
@@ -2276,6 +2356,8 @@ void AddPrintingStrings(content::WebUIDataSource* html_source) {
IDS_SETTINGS_PRINTING_CUPS_PRINTER_ADDED_PRINTER_DONE_MESSAGE},
{"printerEditedSuccessfulMessage",
IDS_SETTINGS_PRINTING_CUPS_PRINTER_EDITED_PRINTER_DONE_MESSAGE},
+ {"printerUnavailableMessage",
+ IDS_SETTINGS_PRINTING_CUPS_PRINTER_UNAVAILABLE_MESSAGE},
{"noPrinterNearbyMessage",
IDS_SETTINGS_PRINTING_CUPS_PRINTER_NO_PRINTER_NEARBY},
{"searchingNearbyPrinters",
@@ -2300,6 +2382,12 @@ void AddPrintingStrings(content::WebUIDataSource* html_source) {
IDS_SETTINGS_PRINTING_CUPS_EDIT_PRINTER_INVALID_PRINTER_UPDATE},
{"requireNetworkMessage",
IDS_SETTINGS_PRINTING_CUPS_PRINTER_REQUIRE_INTERNET_MESSAGE},
+ {"checkNetworkMessage",
+ IDS_SETTINGS_PRINTING_CUPS_PRINTER_CHECK_CONNECTION_MESSAGE},
+ {"noInternetConnection",
+ IDS_SETTINGS_PRINTING_CUPS_PRINTER_NO_INTERNET_CONNECTION},
+ {"checkNetworkAndTryAgain",
+ IDS_SETTINGS_PRINTING_CUPS_PRINTER_CONNECT_TO_NETWORK_SUBTEXT},
{"editPrinterDialogTitle",
IDS_SETTINGS_PRINTING_CUPS_EDIT_PRINTER_DIALOG_TITLE},
{"editPrinterButtonText", IDS_SETTINGS_PRINTING_CUPS_EDIT_PRINTER_BUTTON},
@@ -2594,7 +2682,6 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
{"appCacheOrigin", IDS_SETTINGS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL},
{"cookieAppCache", IDS_SETTINGS_COOKIES_APPLICATION_CACHE},
{"cookieCacheStorage", IDS_SETTINGS_COOKIES_CACHE_STORAGE},
- {"cookieChannelId", IDS_SETTINGS_COOKIES_CHANNEL_ID},
{"cookieDatabaseStorage", IDS_SETTINGS_COOKIES_DATABASE_STORAGE},
{"cookieFileSystem", IDS_SETTINGS_COOKIES_FILE_SYSTEM},
{"cookieFlashLso", IDS_SETTINGS_COOKIES_FLASH_LSO},
@@ -2610,10 +2697,6 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
IDS_SETTINGS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL},
{"cacheStorageOrigin", IDS_SETTINGS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL},
{"cacheStorageSize", IDS_SETTINGS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL},
- {"channelIdServerId", IDS_SETTINGS_COOKIES_CHANNEL_ID_ORIGIN_LABEL},
- {"channelIdType", IDS_SETTINGS_COOKIES_CHANNEL_ID_TYPE_LABEL},
- {"channelIdCreated", IDS_SETTINGS_COOKIES_CHANNEL_ID_CREATED_LABEL},
- {"channelIdExpires", IDS_SETTINGS_COOKIES_CHANNEL_ID_EXPIRES_LABEL},
{"cookieAccessibleToScript",
IDS_SETTINGS_COOKIES_COOKIE_ACCESSIBLE_TO_SCRIPT_LABEL},
{"cookieContent", IDS_SETTINGS_COOKIES_COOKIE_CONTENT_LABEL},
@@ -2739,6 +2822,14 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
IDS_SETTINGS_SITE_SETTINGS_USB_DEVICES_ASK_RECOMMENDED},
{"siteSettingsUsbDevicesBlock",
IDS_SETTINGS_SITE_SETTINGS_USB_DEVICES_BLOCK},
+ {"siteSettingsNativeFileSystemWrite",
+ IDS_SETTINGS_SITE_SETTINGS_NATIVE_FILE_SYSTEM_WRITE},
+ {"siteSettingsNativeFileSystemWriteAsk",
+ IDS_SETTINGS_SITE_SETTINGS_NATIVE_FILE_SYSTEM_WRITE_ASK},
+ {"siteSettingsNativeFileSystemWriteAskRecommended",
+ IDS_SETTINGS_SITE_SETTINGS_NATIVE_FILE_SYSTEM_WRITE_ASK_RECOMMENDED},
+ {"siteSettingsNativeFileSystemWriteBlock",
+ IDS_SETTINGS_SITE_SETTINGS_NATIVE_FILE_SYSTEM_WRITE_BLOCK},
{"siteSettingsRemoveZoomLevel",
IDS_SETTINGS_SITE_SETTINGS_REMOVE_ZOOM_LEVEL},
{"siteSettingsZoomLevels", IDS_SETTINGS_SITE_SETTINGS_ZOOM_LEVELS},
@@ -2848,6 +2939,14 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
IDS_SETTINGS_SITE_SETTINGS_COOKIE_REMOVE_ALL},
{"siteSettingsCookieRemoveAllShown",
IDS_SETTINGS_SITE_SETTINGS_COOKIE_REMOVE_ALL_SHOWN},
+ {"siteSettingsCookieRemoveAllThirdParty",
+ IDS_SETTINGS_SITE_SETTINGS_COOKIE_REMOVE_ALL_THIRD_PARTY},
+ {"siteSettingsCookieRemoveThirdPartyDialogTitle",
+ IDS_SETTINGS_SITE_SETTINGS_THIRD_PARTY_COOKIE_REMOVE_DIALOG_TITLE},
+ {"siteSettingsCookieRemoveThirdPartyConfirmation",
+ IDS_SETTINGS_SITE_SETTINGS_THIRD_PARTY_COOKIE_REMOVE_CONFIRMATION},
+ {"siteSettingsCookiesClearThirdParty",
+ IDS_SETTINGS_SITE_SETTINGS_CLEAR_THIRD_PARTY_COOKIES},
{"siteSettingsCookieRemoveDialogTitle",
IDS_SETTINGS_SITE_SETTINGS_COOKIE_REMOVE_DIALOG_TITLE},
{"siteSettingsCookieRemoveMultipleConfirmation",
@@ -2951,10 +3050,6 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
base::FeatureList::IsEnabled(media::kAutoplayWhitelistSettings));
html_source->AddBoolean(
- "enableSensorsContentSetting",
- base::FeatureList::IsEnabled(features::kSensorContentSetting));
-
- html_source->AddBoolean(
"enablePaymentHandlerContentSetting",
base::FeatureList::IsEnabled(features::kServiceWorkerPaymentApps));
@@ -2966,6 +3061,15 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
html_source->AddBoolean(
"enableBluetoothScanningContentSetting",
cmd.HasSwitch(::switches::kEnableWebBluetoothScanning));
+
+ html_source->AddBoolean(
+ "enableNativeFileSystemWriteContentSetting",
+ base::FeatureList::IsEnabled(::blink::features::kNativeFileSystemAPI));
+
+ html_source->AddBoolean(
+ "enableRemovingAllThirdPartyCookies",
+ base::FeatureList::IsEnabled(
+ browsing_data::features::kEnableRemovingAllThirdPartyCookies));
}
#if defined(OS_CHROMEOS)
@@ -3128,6 +3232,20 @@ void AddExtensionsStrings(content::WebUIDataSource* html_source) {
void AddSecurityKeysStrings(content::WebUIDataSource* html_source) {
static constexpr LocalizedString kSecurityKeysStrings[] = {
+ {"securityKeysBioEnrollmentDialogTitle",
+ IDS_SETTINGS_SECURITY_KEYS_BIO_ENROLLMENT_DIALOG_TITLE},
+ {"securityKeysBioEnrollmentEnrollingLabel",
+ IDS_SETTINGS_SECURITY_KEYS_BIO_ENROLLMENT_ENROLLING_LABEL},
+ {"securityKeysBioEnrollmentLabel",
+ IDS_SETTINGS_SECURITY_KEYS_BIO_ENROLLMENT_LABEL},
+ {"securityKeysBioEnrollmentNoEnrollments",
+ IDS_SETTINGS_SECURITY_KEYS_BIO_ENROLLMENT_NO_ENROLLMENTS},
+ {"securityKeysBioEnrollmentPinPrompt",
+ IDS_SETTINGS_SECURITY_KEYS_BIO_ENROLLMENT_PIN_PROMPT},
+ {"securityKeysBioEnrollmentSubpageDescription",
+ IDS_SETTINGS_SECURITY_KEYS_BIO_ENROLLMENT_SUBPAGE_DESCRIPTION},
+ {"securityKeysBioEnrollmentTouch",
+ IDS_SETTINGS_SECURITY_KEYS_BIO_ENROLLMENT_TOUCH},
{"securityKeysPINTooShort",
IDS_SETTINGS_SECURITY_KEYS_PIN_ERROR_TOO_SHORT},
{"securityKeysConfirmPIN", IDS_SETTINGS_SECURITY_KEYS_CONFIRM_PIN},
@@ -3201,24 +3319,22 @@ void AddSecurityKeysStrings(content::WebUIDataSource* html_source) {
};
AddLocalizedStringsBulk(html_source, kSecurityKeysStrings,
base::size(kSecurityKeysStrings));
-
- html_source->AddBoolean(
- "enableSecurityKeysSubpage",
- base::FeatureList::IsEnabled(device::kWebAuthPINSupport)
+ bool win_native_api_available = false;
#if defined(OS_WIN)
- && (!base::FeatureList::IsEnabled(device::kWebAuthUseNativeWinApi) ||
- !device::WinWebAuthnApi::GetDefault()->IsAvailable())
+ win_native_api_available =
+ base::FeatureList::IsEnabled(device::kWebAuthUseNativeWinApi) &&
+ device::WinWebAuthnApi::GetDefault()->IsAvailable();
#endif
- );
+ html_source->AddBoolean("enableSecurityKeysSubpage",
+ !win_native_api_available);
html_source->AddBoolean(
"enableSecurityKeysCredentialManagement",
- base::FeatureList::IsEnabled(device::kWebAuthPINSupport) &&
- base::FeatureList::IsEnabled(device::kWebAuthCredentialManagement)
-#if defined(OS_WIN)
- && (!base::FeatureList::IsEnabled(device::kWebAuthUseNativeWinApi) ||
- !device::WinWebAuthnApi::GetDefault()->IsAvailable())
-#endif
- );
+ base::FeatureList::IsEnabled(device::kWebAuthCredentialManagement) &&
+ !win_native_api_available);
+ html_source->AddBoolean(
+ "enableSecurityKeysBioEnrollment",
+ base::FeatureList::IsEnabled(device::kWebAuthBiometricEnrollment) &&
+ !win_native_api_available);
}
} // namespace
@@ -3230,10 +3346,10 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source,
AddAutofillStrings(html_source, profile);
AddAppearanceStrings(html_source, profile);
-#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
+#if defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
AddChromeCleanupStrings(html_source);
AddIncompatibleApplicationsStrings(html_source);
-#endif // defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
+#endif // defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
AddChangePasswordStrings(html_source);
AddClearBrowsingDataStrings(html_source, profile);
@@ -3255,12 +3371,12 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source,
AddWebContentStrings(html_source);
#if defined(OS_CHROMEOS)
- AddCrostiniStrings(html_source, profile);
- AddPluginVmStrings(html_source, profile);
AddAndroidAppStrings(html_source);
+ AddAppManagementStrings(html_source);
AddAppsStrings(html_source);
AddBluetoothStrings(html_source);
AddChromeOSUserStrings(html_source, profile);
+ AddCrostiniStrings(html_source, profile);
AddDateTimeStrings(html_source);
AddDeviceStrings(html_source);
AddEasyUnlockStrings(html_source);
@@ -3268,6 +3384,7 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source,
AddInternetStrings(html_source);
AddMultideviceStrings(html_source);
AddParentalControlStrings(html_source);
+ AddPluginVmStrings(html_source, profile);
AddUsersStrings(html_source);
#else
AddDefaultBrowserStrings(html_source);
@@ -3290,7 +3407,7 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source,
policy_indicator::AddLocalizedStrings(html_source);
AddSecurityKeysStrings(html_source);
- html_source->SetJsonPath(kLocalizedStringsFile);
+ html_source->UseStringsJs();
}
} // namespace settings
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_manage_profile_handler_unittest.cc b/chromium/chrome/browser/ui/webui/settings/settings_manage_profile_handler_unittest.cc
index d7ee5c19f6d..3cc1952359a 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_manage_profile_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/settings/settings_manage_profile_handler_unittest.cc
@@ -11,7 +11,7 @@
#include "chrome/test/base/testing_profile_manager.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/web_ui_data_source.h"
-#include "content/public/test/test_browser_thread_bundle.h"
+#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_web_ui.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -40,7 +40,7 @@ class ManageProfileHandlerTest : public testing::Test {
ASSERT_TRUE(profile_manager_.SetUp());
profile_ = profile_manager_.CreateTestingProfile("Profile 1");
- handler_.reset(new TestManageProfileHandler(profile_));
+ handler_ = std::make_unique<TestManageProfileHandler>(profile_);
handler_->set_web_ui(&web_ui_);
handler()->AllowJavascript();
web_ui()->ClearTrackedCalls();
@@ -60,7 +60,7 @@ class ManageProfileHandlerTest : public testing::Test {
TestManageProfileHandler* handler() const { return handler_.get(); }
private:
- content::TestBrowserThreadBundle thread_bundle_;
+ content::BrowserTaskEnvironment task_environment_;
TestingProfileManager profile_manager_;
content::TestWebUI web_ui_;
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.cc b/chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.cc
index 0215a9b4c38..8f725e8ca0d 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.cc
@@ -11,11 +11,14 @@
#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
+#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
+#include "chrome/browser/ui/webui/settings/settings_security_key_handler.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/system_connector.h"
#include "content/public/browser/web_ui.h"
#include "content/public/common/service_manager_connection.h"
+#include "device/fido/bio/enrollment_handler.h"
#include "device/fido/credential_management.h"
#include "device/fido/credential_management_handler.h"
#include "device/fido/fido_discovery_factory.h"
@@ -408,7 +411,8 @@ void SecurityKeysCredentialHandler::OnHaveCredentials(
DCHECK(!callback_id_.empty());
if (status != device::CtapDeviceResponseCode::kSuccess) {
- OnFinished(device::FidoReturnCode::kAuthenticatorResponseInvalid);
+ OnFinished(
+ device::CredentialManagementStatus::kAuthenticatorResponseInvalid);
return;
}
DCHECK(responses);
@@ -481,38 +485,294 @@ void SecurityKeysCredentialHandler::OnCredentialsDeleted(
: IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_FAILED)));
}
-void SecurityKeysCredentialHandler::OnFinished(device::FidoReturnCode status) {
+void SecurityKeysCredentialHandler::OnFinished(
+ device::CredentialManagementStatus status) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
int error;
switch (status) {
- case device::FidoReturnCode::kSoftPINBlock:
+ case device::CredentialManagementStatus::kSoftPINBlock:
error = IDS_SETTINGS_SECURITY_KEYS_PIN_SOFT_LOCK;
break;
- case device::FidoReturnCode::kHardPINBlock:
+ case device::CredentialManagementStatus::kHardPINBlock:
error = IDS_SETTINGS_SECURITY_KEYS_PIN_HARD_LOCK;
break;
- case device::FidoReturnCode::kAuthenticatorMissingCredentialManagement:
+ case device::CredentialManagementStatus::
+ kAuthenticatorMissingCredentialManagement:
error = IDS_SETTINGS_SECURITY_KEYS_NO_CREDENTIAL_MANAGEMENT;
break;
- case device::FidoReturnCode::kAuthenticatorMissingUserVerification:
+ case device::CredentialManagementStatus::kNoPINSet:
error = IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_NO_PIN;
break;
- case device::FidoReturnCode::kAuthenticatorResponseInvalid:
+ case device::CredentialManagementStatus::kAuthenticatorResponseInvalid:
error = IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_ERROR;
break;
- case device::FidoReturnCode::kSuccess:
+ case device::CredentialManagementStatus::kSuccess:
error = IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_REMOVED;
break;
- default:
- NOTREACHED();
- error = IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_ERROR;
- break;
}
FireWebUIListener("security-keys-credential-management-finished",
base::Value(l10n_util::GetStringUTF8(std::move(error))));
}
+SecurityKeysBioEnrollmentHandler::SecurityKeysBioEnrollmentHandler() = default;
+SecurityKeysBioEnrollmentHandler::~SecurityKeysBioEnrollmentHandler() = default;
+
+void SecurityKeysBioEnrollmentHandler::RegisterMessages() {
+ web_ui()->RegisterMessageCallback(
+ "securityKeyBioEnrollStart",
+ base::BindRepeating(&SecurityKeysBioEnrollmentHandler::HandleStart,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "securityKeyBioEnrollProvidePIN",
+ base::BindRepeating(&SecurityKeysBioEnrollmentHandler::HandleProvidePIN,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "securityKeyBioEnrollEnumerate",
+ base::BindRepeating(&SecurityKeysBioEnrollmentHandler::HandleEnumerate,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "securityKeyBioEnrollStartEnrolling",
+ base::BindRepeating(
+ &SecurityKeysBioEnrollmentHandler::HandleStartEnrolling,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "securityKeyBioEnrollDelete",
+ base::BindRepeating(&SecurityKeysBioEnrollmentHandler::HandleDelete,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "securityKeyBioEnrollCancel",
+ base::BindRepeating(&SecurityKeysBioEnrollmentHandler::HandleCancel,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "securityKeyBioEnrollClose",
+ base::BindRepeating(
+ &HandleClose,
+ base::BindRepeating(&SecurityKeysBioEnrollmentHandler::Close,
+ base::Unretained(this))));
+}
+
+void SecurityKeysBioEnrollmentHandler::Close() {
+ weak_factory_.InvalidateWeakPtrs();
+ state_ = State::kNone;
+ discovery_factory_.reset();
+ bio_.reset();
+ callback_id_.clear();
+ discovery_factory_.reset();
+ provide_pin_cb_.Reset();
+}
+
+void SecurityKeysBioEnrollmentHandler::HandleStart(
+ const base::ListValue* args) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK_EQ(state_, State::kNone);
+ DCHECK_EQ(1u, args->GetSize());
+ DCHECK(callback_id_.empty());
+
+ AllowJavascript();
+ state_ = State::kStart;
+ callback_id_ = args->GetList()[0].GetString();
+ discovery_factory_ = std::make_unique<device::FidoDiscoveryFactory>();
+ bio_ = std::make_unique<device::BioEnrollmentHandler>(
+ content::ServiceManagerConnection::GetForProcess()->GetConnector(),
+ supported_transports(),
+ base::BindOnce(&SecurityKeysBioEnrollmentHandler::OnReady,
+ weak_factory_.GetWeakPtr()),
+ base::BindOnce(&SecurityKeysBioEnrollmentHandler::OnError,
+ weak_factory_.GetWeakPtr()),
+ base::BindRepeating(&SecurityKeysBioEnrollmentHandler::OnGatherPIN,
+ weak_factory_.GetWeakPtr()),
+ discovery_factory_.get());
+}
+
+void SecurityKeysBioEnrollmentHandler::OnReady() {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK(bio_);
+ DCHECK_EQ(state_, State::kGatherPIN);
+ DCHECK(!callback_id_.empty());
+ state_ = State::kReady;
+ ResolveJavascriptCallback(base::Value(std::move(callback_id_)),
+ base::Value());
+}
+
+void SecurityKeysBioEnrollmentHandler::OnError(
+ device::BioEnrollmentStatus status) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ state_ = State::kNone;
+
+ int error;
+ switch (status) {
+ case device::BioEnrollmentStatus::kSoftPINBlock:
+ error = IDS_SETTINGS_SECURITY_KEYS_PIN_SOFT_LOCK;
+ break;
+ case device::BioEnrollmentStatus::kHardPINBlock:
+ error = IDS_SETTINGS_SECURITY_KEYS_PIN_HARD_LOCK;
+ break;
+ case device::BioEnrollmentStatus::kAuthenticatorMissingBioEnrollment:
+ error = IDS_SETTINGS_SECURITY_KEYS_NO_BIOMETRIC_ENROLLMENT;
+ break;
+ case device::BioEnrollmentStatus::kNoPINSet:
+ error = IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_NO_PIN;
+ break;
+ case device::BioEnrollmentStatus::kAuthenticatorResponseInvalid:
+ error = IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_ERROR;
+ break;
+ case device::BioEnrollmentStatus::kSuccess:
+ error = IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_REMOVED;
+ break;
+ }
+
+ FireWebUIListener("security-keys-bio-enroll-error",
+ base::Value(l10n_util::GetStringUTF8(error)));
+
+ // If |callback_id_| is not empty, there is an ongoing operation,
+ // which means there is an unresolved Promise. Reject it so that
+ // it isn't leaked.
+ if (!callback_id_.empty()) {
+ RejectJavascriptCallback(base::Value(std::move(callback_id_)),
+ base::Value());
+ }
+}
+
+void SecurityKeysBioEnrollmentHandler::OnGatherPIN(
+ int64_t retries,
+ base::OnceCallback<void(std::string)> cb) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK(!callback_id_.empty());
+ DCHECK(state_ == State::kStart || state_ == State::kGatherPIN);
+ state_ = State::kGatherPIN;
+ provide_pin_cb_ = std::move(cb);
+ ResolveJavascriptCallback(base::Value(std::move(callback_id_)),
+ base::Value(static_cast<int>(retries)));
+}
+
+void SecurityKeysBioEnrollmentHandler::HandleProvidePIN(
+ const base::ListValue* args) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK_EQ(2u, args->GetSize());
+ DCHECK_EQ(state_, State::kGatherPIN);
+ state_ = State::kGatherPIN;
+ callback_id_ = args->GetList()[0].GetString();
+ std::move(provide_pin_cb_).Run(args->GetList()[1].GetString());
+}
+
+void SecurityKeysBioEnrollmentHandler::HandleEnumerate(
+ const base::ListValue* args) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK_EQ(1u, args->GetSize());
+ DCHECK_EQ(state_, State::kReady);
+ state_ = State::kEnumerating;
+ callback_id_ = args->GetList()[0].GetString();
+ bio_->EnumerateTemplates(
+ base::BindOnce(&SecurityKeysBioEnrollmentHandler::OnHaveEnumeration,
+ weak_factory_.GetWeakPtr()));
+}
+
+void SecurityKeysBioEnrollmentHandler::OnHaveEnumeration(
+ device::CtapDeviceResponseCode code,
+ base::Optional<std::map<std::vector<uint8_t>, std::string>> enrollments) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK(!callback_id_.empty());
+ DCHECK_EQ(state_, State::kEnumerating);
+
+ base::Value::ListStorage list;
+ if (enrollments) {
+ for (const auto& enrollment : *enrollments) {
+ base::DictionaryValue elem;
+ elem.SetStringKey("name", std::move(enrollment.second));
+ elem.SetStringKey("id", base::HexEncode(enrollment.first.data(),
+ enrollment.first.size()));
+ list.emplace_back(std::move(elem));
+ }
+ }
+
+ state_ = State::kReady;
+ ResolveJavascriptCallback(base::Value(std::move(callback_id_)),
+ base::ListValue(std::move(list)));
+}
+
+void SecurityKeysBioEnrollmentHandler::HandleStartEnrolling(
+ const base::ListValue* args) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK_EQ(1u, args->GetSize());
+ DCHECK_EQ(state_, State::kReady);
+ state_ = State::kEnrolling;
+ callback_id_ = args->GetList()[0].GetString();
+ bio_->EnrollTemplate(
+ base::BindRepeating(
+ &SecurityKeysBioEnrollmentHandler::OnEnrollingResponse,
+ weak_factory_.GetWeakPtr()),
+ base::BindOnce(&SecurityKeysBioEnrollmentHandler::OnEnrollmentFinished,
+ weak_factory_.GetWeakPtr()));
+}
+
+void SecurityKeysBioEnrollmentHandler::OnEnrollingResponse(
+ device::BioEnrollmentSampleStatus status,
+ uint8_t remaining_samples) {
+ DCHECK_EQ(state_, State::kEnrolling);
+ base::DictionaryValue d;
+ d.SetIntKey("status", static_cast<int>(status));
+ d.SetIntKey("remaining", static_cast<int>(remaining_samples));
+ FireWebUIListener("security-keys-bio-enroll-status", std::move(d));
+}
+
+void SecurityKeysBioEnrollmentHandler::OnEnrollmentFinished(
+ device::CtapDeviceResponseCode code) {
+ DCHECK_EQ(state_, State::kEnrolling);
+ DCHECK(!callback_id_.empty());
+ state_ = State::kReady;
+ base::DictionaryValue d;
+ d.SetIntKey("code", static_cast<int>(code));
+ d.SetIntKey("remaining", 0);
+ ResolveJavascriptCallback(base::Value(std::move(callback_id_)), std::move(d));
+}
+
+void SecurityKeysBioEnrollmentHandler::HandleDelete(
+ const base::ListValue* args) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK_EQ(2u, args->GetSize());
+ state_ = State::kDeleting;
+ callback_id_ = args->GetList()[0].GetString();
+ std::vector<uint8_t> template_id;
+ if (!base::HexStringToBytes(args->GetList()[1].GetString(), &template_id)) {
+ NOTREACHED();
+ return;
+ }
+ bio_->DeleteTemplate(
+ std::move(template_id),
+ base::BindOnce(&SecurityKeysBioEnrollmentHandler::OnDelete,
+ weak_factory_.GetWeakPtr()));
+}
+
+void SecurityKeysBioEnrollmentHandler::OnDelete(
+ device::CtapDeviceResponseCode c) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK_EQ(state_, State::kDeleting);
+ DCHECK(!callback_id_.empty());
+ state_ = State::kEnumerating;
+ bio_->EnumerateTemplates(
+ base::BindOnce(&SecurityKeysBioEnrollmentHandler::OnHaveEnumeration,
+ weak_factory_.GetWeakPtr()));
+}
+
+void SecurityKeysBioEnrollmentHandler::HandleCancel(
+ const base::ListValue* args) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK_EQ(1u, args->GetSize());
+ state_ = State::kCancelling;
+ callback_id_ = args->GetList()[0].GetString();
+ bio_->Cancel(base::BindOnce(&SecurityKeysBioEnrollmentHandler::OnEnrollCancel,
+ weak_factory_.GetWeakPtr()));
+}
+
+void SecurityKeysBioEnrollmentHandler::OnEnrollCancel(
+ device::CtapDeviceResponseCode) {
+ DCHECK_EQ(state_, State::kCancelling);
+ state_ = State::kReady;
+ ResolveJavascriptCallback(base::Value(std::move(callback_id_)),
+ base::Value());
+}
+
} // namespace settings
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.h b/chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.h
index 2b9e1b17317..60196df0fba 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.h
@@ -14,6 +14,8 @@
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
#include "device/fido/fido_constants.h"
+#include "device/fido/bio/enrollment.h"
+
namespace base {
class ListValue;
}
@@ -22,8 +24,11 @@ namespace device {
struct AggregatedEnumerateCredentialsResponse;
class FidoDiscoveryFactory;
class CredentialManagementHandler;
+enum class CredentialManagementStatus;
class SetPINRequestHandler;
class ResetRequestHandler;
+class BioEnrollmentHandler;
+enum class BioEnrollmentStatus;
} // namespace device
namespace settings {
@@ -149,7 +154,7 @@ class SecurityKeysCredentialHandler : public SecurityKeysHandlerBase {
base::Optional<size_t> remaining_credentials);
void OnGatherPIN(int64_t num_retries, base::OnceCallback<void(std::string)>);
void OnCredentialsDeleted(device::CtapDeviceResponseCode status);
- void OnFinished(device::FidoReturnCode status);
+ void OnFinished(device::CredentialManagementStatus status);
State state_ = State::kNone;
base::OnceCallback<void(std::string)> credential_management_provide_pin_cb_;
@@ -161,6 +166,60 @@ class SecurityKeysCredentialHandler : public SecurityKeysHandlerBase {
base::WeakPtrFactory<SecurityKeysCredentialHandler> weak_factory_{this};
};
+// SecurityKeysBioEnrollmentHandler processes messages from the "Manage
+// fingerprints" dialog of the "Security Keys" settings subpage. An instance of
+// this class is created for each settings tab and is destroyed when the tab is
+// closed. See SecurityKeysBioEnrollProxy about the interface.
+class SecurityKeysBioEnrollmentHandler : public SecurityKeysHandlerBase {
+ public:
+ SecurityKeysBioEnrollmentHandler();
+ ~SecurityKeysBioEnrollmentHandler() override;
+
+ private:
+ enum class State {
+ kNone,
+ kStart,
+ kGatherPIN,
+ kReady,
+ kEnumerating,
+ kEnrolling,
+ kDeleting,
+ kCancelling,
+ };
+
+ void RegisterMessages() override;
+ void Close() override;
+
+ void HandleStart(const base::ListValue* args);
+ void OnReady();
+ void OnError(device::BioEnrollmentStatus status);
+ void OnGatherPIN(int64_t retries, base::OnceCallback<void(std::string)>);
+
+ void HandleProvidePIN(const base::ListValue* args);
+
+ void HandleEnumerate(const base::ListValue* args);
+ void OnHaveEnumeration(
+ device::CtapDeviceResponseCode,
+ base::Optional<std::map<std::vector<uint8_t>, std::string>>);
+
+ void HandleStartEnrolling(const base::ListValue* args);
+ void OnEnrollingResponse(device::BioEnrollmentSampleStatus, uint8_t);
+ void OnEnrollmentFinished(device::CtapDeviceResponseCode);
+
+ void HandleDelete(const base::ListValue* args);
+ void OnDelete(device::CtapDeviceResponseCode);
+
+ void HandleCancel(const base::ListValue* args);
+ void OnEnrollCancel(device::CtapDeviceResponseCode);
+
+ State state_ = State::kNone;
+ std::string callback_id_;
+ base::OnceCallback<void(std::string)> provide_pin_cb_;
+ std::unique_ptr<device::FidoDiscoveryFactory> discovery_factory_;
+ std::unique_ptr<device::BioEnrollmentHandler> bio_;
+ base::WeakPtrFactory<SecurityKeysBioEnrollmentHandler> weak_factory_{this};
+};
+
} // namespace settings
#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_SECURITY_KEY_HANDLER_H_
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_ui.cc b/chromium/chrome/browser/ui/webui/settings/settings_ui.cc
index d33e9f09336..3ea47f5691e 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_ui.cc
+++ b/chromium/chrome/browser/ui/webui/settings/settings_ui.cc
@@ -17,7 +17,6 @@
#include "base/stl_util.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
-#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/ui/passwords/manage_passwords_view_utils.h"
@@ -55,6 +54,7 @@
#include "components/favicon_base/favicon_url_parser.h"
#include "components/password_manager/core/common/password_manager_features.h"
#include "components/pref_registry/pref_registry_syncable.h"
+#include "components/safe_browsing/buildflags.h"
#include "components/unified_consent/feature.h"
#include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_contents.h"
@@ -79,6 +79,7 @@
#endif // defined(OS_WIN) || defined(OS_CHROMEOS)
#if defined(OS_CHROMEOS)
+#include "ash/public/cpp/network_config_service.h"
#include "ash/public/cpp/resources/grit/ash_public_unscaled_resources.h"
#include "ash/public/cpp/stylus_utils.h"
#include "chrome/browser/browser_process.h"
@@ -92,7 +93,6 @@
#include "chrome/browser/chromeos/multidevice_setup/multidevice_setup_client_factory.h"
#include "chrome/browser/chromeos/plugin_vm/plugin_vm_util.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
-#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/webui/chromeos/smb_shares/smb_handler.h"
#include "chrome/browser/ui/webui/settings/chromeos/accessibility_handler.h"
#include "chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h"
@@ -113,24 +113,23 @@
#include "chrome/browser/ui/webui/settings/chromeos/multidevice_handler.h"
#include "chrome/browser/ui/webui/settings/chromeos/parental_controls_handler.h"
#include "chrome/browser/ui/webui/settings/chromeos/plugin_vm_handler.h"
+#include "chrome/browser/ui/webui/settings/chromeos/wallpaper_handler.h"
#include "chrome/browser/web_applications/system_web_app_manager.h"
-#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/grit/browser_resources.h"
#include "chromeos/components/account_manager/account_manager.h"
#include "chromeos/components/account_manager/account_manager_factory.h"
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/constants/chromeos_pref_names.h"
-#include "chromeos/constants/chromeos_switches.h"
#include "chromeos/login/auth/password_visibility_utils.h"
#include "chromeos/services/multidevice_setup/public/cpp/prefs.h"
#include "chromeos/services/network_config/public/mojom/constants.mojom.h" // nogncheck
#include "components/arc/arc_util.h"
#include "components/prefs/pref_service.h"
#include "components/user_manager/user.h"
-#include "services/service_manager/public/cpp/connector.h"
#include "ui/base/ui_base_features.h"
#include "ui/chromeos/resources/grit/ui_chromeos_resources.h"
+#include "ui/resources/grit/webui_resources.h"
#else // !defined(OS_CHROMEOS)
#include "chrome/browser/signin/account_consistency_mode_manager.h"
#include "chrome/browser/ui/webui/settings/settings_default_browser_handler.h"
@@ -148,32 +147,12 @@
#include "chrome/browser/ui/webui/settings/printing_handler.h"
#endif
-#if defined(FULL_SAFE_BROWSING)
+#if BUILDFLAG(FULL_SAFE_BROWSING)
#include "chrome/browser/safe_browsing/chrome_password_protection_service.h"
#include "chrome/browser/ui/webui/settings/change_password_handler.h"
#endif
namespace settings {
-
-namespace {
-
-#if defined(OS_CHROMEOS)
-bool ShouldShowParentalControls(Profile* profile) {
- // Show Parental controls for regular and child accounts that are the
- // primary profile. Do not show it to any secondary profiles, managed
- // accounts that aren't child accounts (i.e. enterprise and EDU accounts),
- // OTR accounts, or legacy supervised user accounts.
- return chromeos::switches::IsParentalControlsSettingsEnabled() &&
- profile == ProfileManager::GetPrimaryUserProfile() &&
- !profile->IsLegacySupervised() && !profile->IsGuestSession() &&
- (profile->IsChild() ||
- !profile->GetProfilePolicyConnector()->IsManaged());
-}
-
-#endif // defined(OS_CHROMEOS)
-
-} // namespace
-
// static
void SettingsUI::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
@@ -234,6 +213,8 @@ SettingsUI::SettingsUI(content::WebUI* web_ui)
AddSettingsPageUIHandler(std::make_unique<SecurityKeysPINHandler>());
AddSettingsPageUIHandler(std::make_unique<SecurityKeysResetHandler>());
AddSettingsPageUIHandler(std::make_unique<SecurityKeysCredentialHandler>());
+ AddSettingsPageUIHandler(
+ std::make_unique<SecurityKeysBioEnrollmentHandler>());
#if defined(OS_WIN) || defined(OS_MACOSX)
AddSettingsPageUIHandler(std::make_unique<CaptionsHandler>());
@@ -270,7 +251,7 @@ SettingsUI::SettingsUI(content::WebUI* web_ui)
#endif // OS_WIN && BUILDFLAG(GOOGLE_CHROME_BRANDING)
bool password_protection_available = false;
-#if defined(FULL_SAFE_BROWSING)
+#if BUILDFLAG(FULL_SAFE_BROWSING)
safe_browsing::ChromePasswordProtectionService* password_protection =
safe_browsing::ChromePasswordProtectionService::
GetPasswordProtectionService(profile);
@@ -301,8 +282,9 @@ SettingsUI::SettingsUI(content::WebUI* web_ui)
password_manager::features::kPasswordImport));
#if defined(OS_CHROMEOS)
- html_source->AddBoolean("showParentalControls",
- ShouldShowParentalControls(profile));
+ html_source->AddBoolean(
+ "showParentalControls",
+ chromeos::settings::ShouldShowParentalControls(profile));
#endif
#if defined(OS_CHROMEOS)
@@ -412,10 +394,8 @@ void SettingsUI::InitOSWebUIHandlers(Profile* profile,
chromeos::settings::DateTimeHandler::Create(html_source)));
web_ui->AddMessageHandler(
std::make_unique<chromeos::settings::FingerprintHandler>(profile));
- if (chromeos::switches::IsAssistantEnabled()) {
- web_ui->AddMessageHandler(
- std::make_unique<chromeos::settings::GoogleAssistantHandler>(profile));
- }
+ web_ui->AddMessageHandler(
+ std::make_unique<chromeos::settings::GoogleAssistantHandler>(profile));
if (g_browser_process->local_state()->GetBoolean(prefs::kKerberosEnabled)) {
// Note that UI is also dependent on this pref.
web_ui->AddMessageHandler(
@@ -423,6 +403,12 @@ void SettingsUI::InitOSWebUIHandlers(Profile* profile,
}
web_ui->AddMessageHandler(
std::make_unique<chromeos::settings::KeyboardHandler>());
+
+ // TODO(crbug/950007): Remove adding WallpaperHandler when
+ // SplitSettings complete.
+ web_ui->AddMessageHandler(
+ std::make_unique<chromeos::settings::WallpaperHandler>(web_ui));
+
if (plugin_vm::IsPluginVmEnabled(profile)) {
web_ui->AddMessageHandler(
std::make_unique<chromeos::settings::PluginVmHandler>(profile));
@@ -454,7 +440,7 @@ void SettingsUI::InitOSWebUIHandlers(Profile* profile,
: nullptr,
android_sms_service ? android_sms_service->android_sms_app_manager()
: nullptr));
- if (ShouldShowParentalControls(profile)) {
+ if (chromeos::settings::ShouldShowParentalControls(profile)) {
web_ui->AddMessageHandler(
std::make_unique<chromeos::settings::ParentalControlsHandler>(
profile));
@@ -485,15 +471,22 @@ void SettingsUI::InitOSWebUIHandlers(Profile* profile,
html_source->AddInteger(
"fingerprintReaderLocation",
static_cast<int32_t>(chromeos::quick_unlock::GetFingerprintLocation()));
+
+ // To use lottie, the worker-src CSP needs to be updated for the web ui that
+ // is using it. Since as of now there are only a couple of webuis using
+ // lottie animations, this update has to be performed manually. As the usage
+ // increases, set this as the default so manual override is no longer
+ // required.
+ html_source->OverrideContentSecurityPolicyWorkerSrc(
+ "worker-src blob: 'self';");
+ html_source->AddResourcePath("finger_print.json",
+ IDR_LOGIN_FINGER_PRINT_TABLET_ANIMATION);
}
html_source->AddBoolean("lockScreenNotificationsEnabled",
ash::features::IsLockScreenNotificationsEnabled());
html_source->AddBoolean(
"lockScreenHideSensitiveNotificationsSupported",
ash::features::IsLockScreenHideSensitiveNotificationsSupported());
- html_source->AddBoolean(
- "lockScreenMediaKeysEnabled",
- base::FeatureList::IsEnabled(ash::features::kLockScreenMediaKeys));
html_source->AddBoolean("showTechnologyBadge",
!ash::features::IsSeparateNetworkIconsEnabled());
html_source->AddBoolean("hasInternalStylus",
@@ -512,9 +505,6 @@ void SettingsUI::InitOSWebUIHandlers(Profile* profile,
html_source->AddBoolean("isDemoSession",
chromeos::DemoSession::IsDeviceInDemoMode());
- html_source->AddBoolean("assistantEnabled",
- chromeos::switches::IsAssistantEnabled());
-
// We have 2 variants of Android apps settings. Default case, when the Play
// Store app exists we show expandable section that allows as to
// enable/disable the Play Store and link to Android settings which is
@@ -531,10 +521,8 @@ void SettingsUI::InitOSWebUIHandlers(Profile* profile,
std::make_unique<chromeos::settings::PowerHandler>(profile->GetPrefs()));
html_source->AddBoolean(
- "showApps", base::FeatureList::IsEnabled(features::kAppManagement));
-
- html_source->AddBoolean("showParentalControlsSettings",
- ShouldShowParentalControls(profile));
+ "showParentalControlsSettings",
+ chromeos::settings::ShouldShowParentalControls(profile));
}
#endif // defined(OS_CHROMEOS)
@@ -547,10 +535,7 @@ void SettingsUI::AddSettingsPageUIHandler(
#if defined(OS_CHROMEOS)
void SettingsUI::BindCrosNetworkConfig(
chromeos::network_config::mojom::CrosNetworkConfigRequest request) {
- content::BrowserContext::GetConnectorFor(
- web_ui()->GetWebContents()->GetBrowserContext())
- ->BindInterface(chromeos::network_config::mojom::kServiceName,
- std::move(request));
+ ash::GetNetworkConfigService(std::move(request));
}
#endif // defined(OS_CHROMEOS)
diff --git a/chromium/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc b/chromium/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
index b0869cafd40..3d5fc205b3d 100644
--- a/chromium/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
@@ -48,10 +48,11 @@
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/web_ui_data_source.h"
-#include "content/public/test/test_browser_thread_bundle.h"
+#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_web_ui.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension_builder.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
#include "ppapi/buildflags/buildflags.h"
#include "services/device/public/cpp/test/fake_usb_device_manager.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -468,7 +469,7 @@ class SiteSettingsHandlerTest : public testing::Test {
const std::string kFlash;
private:
- content::TestBrowserThreadBundle thread_bundle_;
+ content::BrowserTaskEnvironment task_environment_;
TestingProfile profile_;
TestingProfile* incognito_profile_;
content::TestWebUI web_ui_;
@@ -1009,8 +1010,7 @@ TEST_F(SiteSettingsHandlerTest, GetAndSetOriginPermissions) {
#if BUILDFLAG(ENABLE_PLUGINS)
TEST_F(SiteSettingsHandlerTest, ChangingFlashSettingForSiteIsRemembered) {
- ChromePluginServiceFilter::GetInstance()->RegisterResourceContext(
- profile(), profile()->GetResourceContext());
+ ChromePluginServiceFilter::GetInstance()->RegisterProfile(profile());
FlashContentSettingsChangeWaiter waiter(profile());
const std::string origin_with_port("https://www.example.com:443");
@@ -1561,9 +1561,10 @@ class SiteSettingsHandlerChooserExceptionTest : public SiteSettingsHandlerTest {
6355, 0, "Google", "Widget", "789XYZ");
auto* chooser_context = UsbChooserContextFactory::GetForProfile(profile());
- device::mojom::UsbDeviceManagerPtr device_manager_ptr;
- device_manager_.AddBinding(mojo::MakeRequest(&device_manager_ptr));
- chooser_context->SetDeviceManagerForTesting(std::move(device_manager_ptr));
+ mojo::PendingRemote<device::mojom::UsbDeviceManager> device_manager;
+ device_manager_.AddReceiver(
+ device_manager.InitWithNewPipeAndPassReceiver());
+ chooser_context->SetDeviceManagerForTesting(std::move(device_manager));
chooser_context->GetDevices(
base::DoNothing::Once<std::vector<device::mojom::UsbDeviceInfoPtr>>());
base::RunLoop().RunUntilIdle();
@@ -1603,9 +1604,10 @@ class SiteSettingsHandlerChooserExceptionTest : public SiteSettingsHandlerTest {
CreateIncognitoProfile();
auto* chooser_context =
UsbChooserContextFactory::GetForProfile(incognito_profile());
- device::mojom::UsbDeviceManagerPtr device_manager_ptr;
- device_manager_.AddBinding(mojo::MakeRequest(&device_manager_ptr));
- chooser_context->SetDeviceManagerForTesting(std::move(device_manager_ptr));
+ mojo::PendingRemote<device::mojom::UsbDeviceManager> device_manager;
+ device_manager_.AddReceiver(
+ device_manager.InitWithNewPipeAndPassReceiver());
+ chooser_context->SetDeviceManagerForTesting(std::move(device_manager));
chooser_context->GetDevices(
base::DoNothing::Once<std::vector<device::mojom::UsbDeviceInfoPtr>>());
base::RunLoop().RunUntilIdle();
diff --git a/chromium/chrome/browser/ui/webui/settings/tts_handler.cc b/chromium/chrome/browser/ui/webui/settings/tts_handler.cc
index 440e917e224..605afeb6055 100644
--- a/chromium/chrome/browser/ui/webui/settings/tts_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/tts_handler.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/speech/extension_api/tts_engine_extension_api.h"
#include "chrome/browser/speech/extension_api/tts_engine_extension_observer.h"
+#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/tts_controller.h"
@@ -24,7 +25,7 @@
#include "ui/base/l10n/l10n_util.h"
namespace settings {
-TtsHandler::TtsHandler() : weak_factory_(this) {}
+TtsHandler::TtsHandler() {}
TtsHandler::~TtsHandler() {
content::TtsController::GetInstance()->RemoveVoicesChangedDelegate(this);
@@ -143,7 +144,8 @@ void TtsHandler::HandlePreviewTtsVoice(const base::ListValue* args) {
utterance->SetText(text);
utterance->SetVoiceName(name);
utterance->SetEngineId(extension_id);
- utterance->SetSrcUrl(GURL("chrome://settings/manageAccessibility/tts"));
+ utterance->SetSrcUrl(
+ GURL(chrome::GetOSSettingsUrl("manageAccessibility/tts")));
utterance->SetEventDelegate(this);
content::TtsController::GetInstance()->Stop();
diff --git a/chromium/chrome/browser/ui/webui/settings/tts_handler.h b/chromium/chrome/browser/ui/webui/settings/tts_handler.h
index f26fbb230e5..a839dee3c0b 100644
--- a/chromium/chrome/browser/ui/webui/settings/tts_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/tts_handler.h
@@ -46,7 +46,7 @@ class TtsHandler : public SettingsPageUIHandler,
int GetVoiceLangMatchScore(const content::VoiceData* voice,
const std::string& app_locale);
- base::WeakPtrFactory<TtsHandler> weak_factory_;
+ base::WeakPtrFactory<TtsHandler> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(TtsHandler);
};