summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/ui/webui/chromeos
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-01-20 13:40:20 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-01-22 12:41:23 +0000
commit7961cea6d1041e3e454dae6a1da660b453efd238 (patch)
treec0eeb4a9ff9ba32986289c1653d9608e53ccb444 /chromium/chrome/browser/ui/webui/chromeos
parentb7034d0803538058e5c9d904ef03cf5eab34f6ef (diff)
BASELINE: Update Chromium to 78.0.3904.130
Change-Id: If185e0c0061b3437531c97c9c8c78f239352a68b Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/chrome/browser/ui/webui/chromeos')
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_dialog.cc5
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_dialog.h1
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_ui.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_ui.h2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_dialog.cc5
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_dialog.h1
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_ui.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_ui.h2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/add_supervision/BUILD.gn3
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler.cc31
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.cc25
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.h6
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder.cc79
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder.h66
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder_browsertest.cc294
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.cc60
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.h16
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/add_supervision/confirm_signout_dialog.cc14
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.cc57
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_ui.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.cc23
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.h3
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_utils.cc9
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/bluetooth_pairing_dialog.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/bluetooth_pairing_dialog_browsertest-inl.h7
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/camera/camera_ui.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/cellular_setup/DEPS3
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog.cc45
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_localized_strings_provider.cc12
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_ui.cc15
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/certificate_manager_dialog_ui.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc38
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc9
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/first_run/first_run_handler.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/first_run/first_run_ui.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/image_source.cc15
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/image_source.h11
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/confirm_password_change_handler.cc73
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/confirm_password_change_handler.h11
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_dialogs.cc201
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_dialogs.h92
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_ui.cc202
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_ui.h66
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/internet_config_dialog.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/internet_detail_dialog.cc10
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.cc42
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc26
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h13
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_pin_setup.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc25
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h6
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler_unittest.cc16
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc11
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h10
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc224
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h49
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/l10n_util.cc9
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc8
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/network_state_informer.cc20
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/network_state_informer.h12
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc12
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.h4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc46
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.h2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc39
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h14
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/signin_userlist_unittest.cc8
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/machine_learning/BUILD.gn3
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_dialog.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_localized_strings_provider.cc16
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.cc9
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/network_ui.cc13
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/power_ui.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/set_time_ui.cc11
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/slow_trace_ui.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/slow_trace_ui.h2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/slow_ui.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_credentials_dialog.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_handler.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_handler.h3
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_share_dialog.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_message_handler.cc8
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_message_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.cc5
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.cc22
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.h4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/user_image_source.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/user_image_source.h2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/video_source.cc15
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/video_source.h11
107 files changed, 1623 insertions, 713 deletions
diff --git a/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_dialog.cc
index d678bfe3343..0ffa1c7c75a 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_dialog.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_dialog.cc
@@ -67,7 +67,6 @@ bool AccountManagerWelcomeDialog::ShowIfRequired() {
void AccountManagerWelcomeDialog::AdjustWidgetInitParams(
views::Widget::InitParams* params) {
params->z_order = ui::ZOrderLevel::kNormal;
- params->type = views::Widget::InitParams::Type::TYPE_WINDOW_FRAMELESS;
params->shadow_type = views::Widget::InitParams::ShadowType::SHADOW_TYPE_DROP;
params->shadow_elevation = wm::kShadowElevationActiveWindow;
}
@@ -92,4 +91,8 @@ bool AccountManagerWelcomeDialog::ShouldShowDialogTitle() const {
return false;
}
+bool AccountManagerWelcomeDialog::ShouldShowCloseButton() const {
+ return false;
+}
+
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_dialog.h b/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_dialog.h
index efed08c5331..67fea954e98 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_dialog.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_dialog.h
@@ -29,6 +29,7 @@ class AccountManagerWelcomeDialog : public SystemWebDialogDelegate {
void GetDialogSize(gfx::Size* size) const override;
std::string GetDialogArgs() const override;
bool ShouldShowDialogTitle() const override;
+ bool ShouldShowCloseButton() const override;
private:
DISALLOW_COPY_AND_ASSIGN(AccountManagerWelcomeDialog);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_ui.cc
index 67d228af18c..16a69c1d232 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_ui.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/strings/utf_string_conversions.h"
+#include "build/branding_buildflags.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/url_constants.h"
#include "chrome/common/webui_url_constants.h"
@@ -18,7 +19,7 @@
namespace chromeos {
AccountManagerWelcomeUI::AccountManagerWelcomeUI(content::WebUI* web_ui)
- : ui::WebDialogUI(web_ui), weak_factory_(this) {
+ : ui::WebDialogUI(web_ui) {
content::WebUIDataSource* html_source = content::WebUIDataSource::Create(
chrome::kChromeUIAccountManagerWelcomeHost);
@@ -26,7 +27,7 @@ AccountManagerWelcomeUI::AccountManagerWelcomeUI(content::WebUI* web_ui)
"closeDialog", base::BindRepeating(&WebDialogUI::CloseDialog,
weak_factory_.GetWeakPtr()));
- html_source->SetJsonPath("strings.js");
+ html_source->UseStringsJs();
// Add localized strings.
html_source->AddLocalizedString("welcomeTitle",
@@ -44,7 +45,7 @@ AccountManagerWelcomeUI::AccountManagerWelcomeUI(content::WebUI* web_ui)
IDR_ACCOUNT_MANAGER_SHARED_CSS);
html_source->AddResourcePath("account_manager_welcome.js",
IDR_ACCOUNT_MANAGER_WELCOME_JS);
-#if defined(GOOGLE_CHROME_BUILD)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
html_source->AddResourcePath("account_manager_welcome_1x.png",
IDR_ACCOUNT_MANAGER_WELCOME_1X_PNG);
html_source->AddResourcePath("account_manager_welcome_2x.png",
diff --git a/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_ui.h b/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_ui.h
index 6f66e183f84..ded176fe6df 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_ui.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_ui.h
@@ -18,7 +18,7 @@ class AccountManagerWelcomeUI : public ui::WebDialogUI {
~AccountManagerWelcomeUI() override;
private:
- base::WeakPtrFactory<AccountManagerWelcomeUI> weak_factory_;
+ base::WeakPtrFactory<AccountManagerWelcomeUI> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(AccountManagerWelcomeUI);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_dialog.cc
index 33407733834..5144af68c27 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_dialog.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_dialog.cc
@@ -64,7 +64,6 @@ AccountMigrationWelcomeDialog* AccountMigrationWelcomeDialog::Show(
void AccountMigrationWelcomeDialog::AdjustWidgetInitParams(
views::Widget::InitParams* params) {
params->z_order = ui::ZOrderLevel::kNormal;
- params->type = views::Widget::InitParams::Type::TYPE_WINDOW_FRAMELESS;
params->shadow_type = views::Widget::InitParams::ShadowType::SHADOW_TYPE_DROP;
params->shadow_elevation = wm::kShadowElevationActiveWindow;
}
@@ -89,6 +88,10 @@ bool AccountMigrationWelcomeDialog::ShouldShowDialogTitle() const {
return false;
}
+bool AccountMigrationWelcomeDialog::ShouldShowCloseButton() const {
+ return false;
+}
+
const std::string& AccountMigrationWelcomeDialog::Id() {
return id_;
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_dialog.h b/chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_dialog.h
index c12c22906fc..96670974836 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_dialog.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_dialog.h
@@ -28,6 +28,7 @@ class AccountMigrationWelcomeDialog : public SystemWebDialogDelegate {
void GetDialogSize(gfx::Size* size) const override;
std::string GetDialogArgs() const override;
bool ShouldShowDialogTitle() const override;
+ bool ShouldShowCloseButton() const override;
const std::string& Id() override;
std::string GetUserEmail() const;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_ui.cc
index 78f338045ea..3c486f344a0 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_ui.cc
@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/strings/utf_string_conversions.h"
+#include "build/branding_buildflags.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/signin/inline_login_handler_dialog_chromeos.h"
#include "chrome/common/url_constants.h"
@@ -71,11 +72,11 @@ class MigrationMessageHandler : public content::WebUIMessageHandler {
} // namespace
AccountMigrationWelcomeUI::AccountMigrationWelcomeUI(content::WebUI* web_ui)
- : ui::WebDialogUI(web_ui), weak_factory_(this) {
+ : ui::WebDialogUI(web_ui) {
content::WebUIDataSource* html_source = content::WebUIDataSource::Create(
chrome::kChromeUIAccountMigrationWelcomeHost);
- html_source->SetJsonPath("strings.js");
+ html_source->UseStringsJs();
// Add localized strings.
html_source->AddLocalizedString("welcomePageTitle",
@@ -99,7 +100,7 @@ AccountMigrationWelcomeUI::AccountMigrationWelcomeUI(content::WebUI* web_ui)
IDR_ACCOUNT_MIGRATION_BROWSER_PROXY_HTML);
html_source->AddResourcePath("account_migration_browser_proxy.js",
IDR_ACCOUNT_MIGRATION_BROWSER_PROXY_JS);
-#if defined(GOOGLE_CHROME_BUILD)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
html_source->AddResourcePath("account_manager_welcome_1x.png",
IDR_ACCOUNT_MANAGER_WELCOME_1X_PNG);
html_source->AddResourcePath("account_manager_welcome_2x.png",
diff --git a/chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_ui.h b/chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_ui.h
index 90dee7f3a6f..24a0c7dd8be 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_ui.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/account_migration_welcome_ui.h
@@ -19,7 +19,7 @@ class AccountMigrationWelcomeUI : public ui::WebDialogUI {
~AccountMigrationWelcomeUI() override;
private:
- base::WeakPtrFactory<AccountMigrationWelcomeUI> weak_factory_;
+ base::WeakPtrFactory<AccountMigrationWelcomeUI> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(AccountMigrationWelcomeUI);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/BUILD.gn b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/BUILD.gn
index 2829e6d376d..54b63f6b00a 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/BUILD.gn
+++ b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/BUILD.gn
@@ -8,7 +8,4 @@ mojom("mojo_bindings") {
sources = [
"add_supervision.mojom",
]
-
- # TODO(https://crbug.com/968369): Change to use new names.
- use_old_js_lite_bindings_names = true
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler.cc
index 0acab1a5249..e418a046414 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler.cc
@@ -11,17 +11,19 @@
#include "base/stl_util.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/lifetime/application_lifetime.h"
+#include "chrome/browser/chromeos/arc/arc_session_manager.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/supervised_user/supervised_user_service.h"
#include "chrome/browser/supervised_user/supervised_user_service_factory.h"
#include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.h"
+#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder.h"
#include "chrome/services/app_service/public/cpp/app_registry_cache.h"
#include "components/signin/public/identity_manager/access_token_fetcher.h"
#include "components/signin/public/identity_manager/access_token_info.h"
#include "components/signin/public/identity_manager/identity_manager.h"
+#include "components/user_manager/user_manager.h"
#include "content/public/browser/web_ui.h"
#include "google_apis/gaia/gaia_constants.h"
@@ -50,6 +52,18 @@ void AddSupervisionHandler::GetInstalledArcApps(
apps::AppServiceProxy* proxy =
apps::AppServiceProxyFactory::GetForProfile(profile);
+ if (arc::ArcSessionManager::Get() == nullptr) {
+ DLOG(WARNING) << "No ArcSessionManager available";
+ std::move(callback).Run({});
+ return;
+ }
+ if (arc::ArcSessionManager::Get()->state() !=
+ arc::ArcSessionManager::State::ACTIVE) {
+ DLOG(WARNING) << "ArcSessionManager is not active";
+ std::move(callback).Run({});
+ return;
+ }
+
std::vector<std::string> installed_arc_apps;
proxy->AppRegistryCache().ForEachApp(
@@ -75,6 +89,8 @@ void AddSupervisionHandler::GetOAuthToken(GetOAuthTokenCallback callback) {
scopes.insert(GaiaConstants::kKidsSupervisionSetupChildOAuth2Scope);
scopes.insert(GaiaConstants::kPeopleApiReadOnlyOAuth2Scope);
scopes.insert(GaiaConstants::kAccountsReauthOAuth2Scope);
+ scopes.insert(GaiaConstants::kAuditRecordingOAuth2Scope);
+ scopes.insert(GaiaConstants::kClearCutOAuth2Scope);
oauth2_access_token_fetcher_ =
identity_manager_->CreateAccessTokenFetcherForAccount(
@@ -85,14 +101,23 @@ void AddSupervisionHandler::GetOAuthToken(GetOAuthTokenCallback callback) {
}
void AddSupervisionHandler::LogOut() {
- chrome::AttemptUserExit();
+ LogOutHelper();
}
void AddSupervisionHandler::NotifySupervisionEnabled() {
SupervisedUserService* service =
SupervisedUserServiceFactory::GetForProfile(Profile::FromWebUI(web_ui_));
-
service->set_signout_required_after_supervision_enabled();
+
+ // Force full sign-in the next time the user is at the login screen.
+ // Gellerization can only be triggered by the primary user.
+ user_manager::UserManager* manager = user_manager::UserManager::Get();
+ manager->SaveForceOnlineSignin(manager->GetPrimaryUser()->GetAccountId(),
+ true /* force signin */);
+
+ // Record UMA metric that user has completed Add Supervision process.
+ AddSupervisionMetricsRecorder::GetInstance()->RecordAddSupervisionEnrollment(
+ AddSupervisionMetricsRecorder::EnrollmentState::kCompleted);
}
void AddSupervisionHandler::OnAccessTokenFetchComplete(
diff --git a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.cc b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.cc
index c5775d23ff0..0c7a610df3e 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.cc
@@ -4,6 +4,11 @@
#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.h"
+#include "chrome/browser/lifetime/application_lifetime.h"
+#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/supervised_user/supervised_user_service.h"
+#include "chrome/browser/supervised_user/supervised_user_service_factory.h"
+#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder.h"
#include "chrome/services/app_service/public/cpp/app_update.h"
#include "chrome/services/app_service/public/mojom/types.mojom.h"
@@ -13,3 +18,23 @@ bool ShouldIncludeAppUpdate(const apps::AppUpdate& app_update) {
return app_update.AppType() == apps::mojom::AppType::kArc;
}
+
+void LogOutHelper() {
+ // Record UMA metric that the user clicked "Sign out".
+ if (EnrollmentCompleted()) {
+ AddSupervisionMetricsRecorder::GetInstance()
+ ->RecordAddSupervisionEnrollment(
+ AddSupervisionMetricsRecorder::EnrollmentState::kSignedOut);
+ } else {
+ AddSupervisionMetricsRecorder::GetInstance()
+ ->RecordAddSupervisionEnrollment(
+ AddSupervisionMetricsRecorder::EnrollmentState::kSwitchedAccounts);
+ }
+ chrome::AttemptUserExit();
+}
+
+bool EnrollmentCompleted() {
+ SupervisedUserService* service = SupervisedUserServiceFactory::GetForProfile(
+ ProfileManager::GetPrimaryUserProfile());
+ return service->signout_required_after_supervision_enabled();
+}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.h b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.h
index 9f8c8383fc8..6cb4741673d 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.h
@@ -17,4 +17,10 @@ class AppUpdate;
// returned to clients or uninstalled.
bool ShouldIncludeAppUpdate(const apps::AppUpdate& app_update);
+// Records UMA metric and signs out the user.
+void LogOutHelper();
+
+// Checks if the user has completed enrollment in supervision.
+bool EnrollmentCompleted();
+
#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_ADD_SUPERVISION_ADD_SUPERVISION_HANDLER_UTILS_H_
diff --git a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder.cc b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder.cc
new file mode 100644
index 00000000000..3681eee93fe
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder.cc
@@ -0,0 +1,79 @@
+// 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/chromeos/add_supervision/add_supervision_metrics_recorder.h"
+
+#include "base/logging.h"
+#include "base/metrics/histogram_functions.h"
+#include "base/metrics/user_metrics.h"
+#include "base/time/default_tick_clock.h"
+#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.h"
+
+// static
+AddSupervisionMetricsRecorder* AddSupervisionMetricsRecorder::GetInstance() {
+ static base::NoDestructor<AddSupervisionMetricsRecorder> instance_;
+ return instance_.get();
+}
+
+void AddSupervisionMetricsRecorder::RecordAddSupervisionEnrollment(
+ EnrollmentState action) {
+ base::UmaHistogramEnumeration("AddSupervisionDialog.Enrollment", action);
+ switch (action) {
+ case EnrollmentState::kInitiated:
+ DCHECK(!EnrollmentCompleted())
+ << "The user should not be enrolled in supervision at the start of "
+ "the Add Supervision process.";
+ base::RecordAction(
+ base::UserMetricsAction("AddSupervisionDialog_Launched"));
+ start_time_ = clock_->NowTicks();
+ break;
+ case EnrollmentState::kCompleted:
+ DCHECK(EnrollmentCompleted())
+ << "Add Supervision enrollment should be completed before recording "
+ "kCompleted UMA metric.";
+ RecordUserTime("AddSupervisionDialog.EnrollmentCompletedUserTime");
+ base::RecordAction(
+ base::UserMetricsAction("AddSupervisionDialog_EnrollmentCompleted"));
+ break;
+ case EnrollmentState::kSignedOut:
+ DCHECK(EnrollmentCompleted())
+ << "There should be no way for the user to attempt sign out from "
+ "within the Add Supervision dialog without completing supervision "
+ "enrollment.";
+ RecordUserTime("AddSupervisionDialog.SignoutCompletedUserTime");
+ base::RecordAction(base::UserMetricsAction(
+ "AddSupervisionDialog_AttemptedSignoutAfterEnrollment"));
+ break;
+ case EnrollmentState::kClosed:
+ DCHECK(!EnrollmentCompleted())
+ << "There should be no way to close the Add Supervision dialog "
+ "without signing out after supervision enrollment has completed.";
+ RecordUserTime("AddSupervisionDialog.EnrollmentNotCompletedUserTime");
+ base::RecordAction(
+ base::UserMetricsAction("AddSupervisionDialog_Closed"));
+ break;
+ case EnrollmentState::kSwitchedAccounts:
+ DCHECK(!EnrollmentCompleted()) << "The only way for the user to switch "
+ "accounts is before enrollment";
+ RecordUserTime("AddSupervisionDialog.EnrollmentNotCompletedUserTime");
+ base::RecordAction(
+ base::UserMetricsAction("AddSupervisionDialog_SwitchedAccounts"));
+ break;
+ }
+}
+
+void AddSupervisionMetricsRecorder::SetClockForTesting(
+ const base::TickClock* tick_clock) {
+ clock_ = tick_clock;
+}
+
+AddSupervisionMetricsRecorder::AddSupervisionMetricsRecorder()
+ : clock_(base::DefaultTickClock::GetInstance()) {}
+
+void AddSupervisionMetricsRecorder::RecordUserTime(
+ const char* metric_name) const {
+ DCHECK(!start_time_.is_null()) << "start_time_ has not been initialized.";
+ base::TimeDelta duration = clock_->NowTicks() - start_time_;
+ base::UmaHistogramLongTimes(metric_name, duration);
+}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder.h b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder.h
new file mode 100644
index 00000000000..600f4b87324
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder.h
@@ -0,0 +1,66 @@
+// 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_CHROMEOS_ADD_SUPERVISION_ADD_SUPERVISION_METRICS_RECORDER_H_
+#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_ADD_SUPERVISION_ADD_SUPERVISION_METRICS_RECORDER_H_
+
+#include "base/no_destructor.h"
+#include "base/time/time.h"
+
+namespace base {
+class TickClock;
+}
+
+// Records UMA metrics for users going through the Add Supervision process.
+class AddSupervisionMetricsRecorder {
+ public:
+ // These enum values represent the state that the user has attained while
+ // going through the Add Supervision dialog.
+ // These values are persisted to logs. Entries should not be renumbered and
+ // numeric values should never be reused.
+ enum class EnrollmentState {
+ // Recorded when user opens Add Supervision dialog.
+ kInitiated = 0,
+ // Recorded when user successfully enrolls in supervision.
+ kCompleted = 1,
+ // Recorded when user clicks "Sign out" after enrollment in the dialog.
+ kSignedOut = 2,
+ // Recorded when user closes the dialog without enrollment, excluding sign
+ // out.
+ kClosed = 3,
+ // Recorded when user signs out to switch accounts.
+ kSwitchedAccounts = 4,
+ // Add future entries above this comment, in sync with enums.xml.
+ // Update kMaxValue to the last value.
+ kMaxValue = kSwitchedAccounts
+ };
+
+ static AddSupervisionMetricsRecorder* GetInstance();
+
+ // Records UMA metrics for users going through the Add Supervision process.
+ void RecordAddSupervisionEnrollment(EnrollmentState action);
+
+ // Method intended for testing purposes only.
+ // Set clock used for timing to enable manipulation during tests.
+ void SetClockForTesting(const base::TickClock* tick_clock);
+
+ private:
+ friend class base::NoDestructor<AddSupervisionMetricsRecorder>;
+
+ AddSupervisionMetricsRecorder();
+
+ // Records UMA metric of how long the user spends in the Add Supervision
+ // process in milliseconds.
+ void RecordUserTime(const char* metric_name) const;
+
+ // Points to the base::DefaultTickClock by default.
+ const base::TickClock* clock_;
+
+ // Records when the user initiates the Add Supervision process.
+ base::TimeTicks start_time_;
+
+ DISALLOW_COPY_AND_ASSIGN(AddSupervisionMetricsRecorder);
+};
+
+#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_ADD_SUPERVISION_ADD_SUPERVISION_METRICS_RECORDER_H_
diff --git a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder_browsertest.cc b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder_browsertest.cc
new file mode 100644
index 00000000000..3071dacac19
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder_browsertest.cc
@@ -0,0 +1,294 @@
+// 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 "base/test/metrics/histogram_tester.h"
+#include "base/test/metrics/user_action_tester.h"
+#include "base/test/scoped_feature_list.h"
+#include "base/test/test_mock_time_task_runner.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision.mojom.h"
+#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler.h"
+#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.h"
+#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder.h"
+#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.h"
+#include "chrome/test/base/in_process_browser_test.h"
+#include "chromeos/constants/chromeos_features.h"
+#include "content/public/test/test_web_ui.h"
+
+namespace chromeos {
+
+// This browser test class is for the Add Supervision metrics recorder.
+class AddSupervisionMetricsRecorderTest : public InProcessBrowserTest {
+ public:
+ AddSupervisionMetricsRecorderTest() = default;
+ ~AddSupervisionMetricsRecorderTest() override = default;
+
+ void SetUp() override {
+ feature_list_.InitAndEnableFeature(
+ chromeos::features::kParentalControlsSettings);
+ InProcessBrowserTest::SetUp();
+ }
+
+ void SetUpOnMainThread() override {
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ test_web_ui_.set_web_contents(web_contents);
+ }
+
+ void ShowAddSupervisionDialog() {
+ content::WebContents* web_contents = test_web_ui_.GetWebContents();
+ AddSupervisionDialog::Show(web_contents->GetTopLevelNativeWindow());
+ }
+
+ void CloseNowForTesting() {
+ AddSupervisionDialog* instance =
+ static_cast<AddSupervisionDialog*>(AddSupervisionDialog::GetInstance());
+ instance->CloseNowForTesting();
+ }
+
+ void CloseAddSupervisionDialog() {
+ bool out_close_dialog =
+ AddSupervisionDialog::GetInstance()->OnDialogCloseRequested();
+ EXPECT_TRUE(out_close_dialog);
+ CloseNowForTesting();
+ }
+
+ void NotifySupervisionEnabled() {
+ add_supervision::mojom::AddSupervisionHandlerRequest request;
+ AddSupervisionUI add_supervision_ui(&test_web_ui_);
+ AddSupervisionHandler add_supervision_handler(
+ std::move(request), &test_web_ui_, &add_supervision_ui);
+ add_supervision_handler.NotifySupervisionEnabled();
+ }
+
+ void LogOutAndClose() {
+ LogOutHelper();
+ CloseNowForTesting();
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AddSupervisionMetricsRecorderTest);
+
+ base::test::ScopedFeatureList feature_list_;
+ content::TestWebUI test_web_ui_;
+};
+
+IN_PROC_BROWSER_TEST_F(AddSupervisionMetricsRecorderTest, HistogramTest) {
+ base::HistogramTester histogram_tester;
+
+ // Should see 0 Add Supervision enrollment metrics at first.
+ histogram_tester.ExpectTotalCount("AddSupervisionDialog.Enrollment", 0);
+
+ // Simulate the user opening the Add Supervision dialog and closing it.
+ ShowAddSupervisionDialog();
+
+ // Should see 1 Add Supervision process initiated.
+ histogram_tester.ExpectUniqueSample(
+ "AddSupervisionDialog.Enrollment",
+ AddSupervisionMetricsRecorder::EnrollmentState::kInitiated, 1);
+ histogram_tester.ExpectTotalCount("AddSupervisionDialog.Enrollment", 1);
+
+ CloseAddSupervisionDialog();
+
+ // Should see 1 Add Supervision process closed.
+ histogram_tester.ExpectBucketCount(
+ "AddSupervisionDialog.Enrollment",
+ AddSupervisionMetricsRecorder::EnrollmentState::kClosed, 1);
+ histogram_tester.ExpectTotalCount("AddSupervisionDialog.Enrollment", 2);
+
+ // Simulate the user opening the Add Supervision dialog and signing out to
+ // switch accounts.
+ ShowAddSupervisionDialog();
+
+ // Should see 2 Add Supervision processes initiated.
+ histogram_tester.ExpectBucketCount(
+ "AddSupervisionDialog.Enrollment",
+ AddSupervisionMetricsRecorder::EnrollmentState::kInitiated, 2);
+ histogram_tester.ExpectTotalCount("AddSupervisionDialog.Enrollment", 3);
+
+ LogOutAndClose();
+
+ // Should see 1 switch accounts attempt.
+ histogram_tester.ExpectBucketCount(
+ "AddSupervisionDialog.Enrollment",
+ AddSupervisionMetricsRecorder::EnrollmentState::kSwitchedAccounts, 1);
+ histogram_tester.ExpectTotalCount("AddSupervisionDialog.Enrollment", 4);
+
+ // Simulate the user opening the Add Supervision dialog, enrolling in
+ // supervision and signing out.
+ ShowAddSupervisionDialog();
+
+ // Should see 3 Add Supervision processes initiated.
+ histogram_tester.ExpectBucketCount(
+ "AddSupervisionDialog.Enrollment",
+ AddSupervisionMetricsRecorder::EnrollmentState::kInitiated, 3);
+ histogram_tester.ExpectTotalCount("AddSupervisionDialog.Enrollment", 5);
+
+ NotifySupervisionEnabled();
+
+ // Should see 1 Add Supervision process completed.
+ histogram_tester.ExpectBucketCount(
+ "AddSupervisionDialog.Enrollment",
+ AddSupervisionMetricsRecorder::EnrollmentState::kCompleted, 1);
+ histogram_tester.ExpectTotalCount("AddSupervisionDialog.Enrollment", 6);
+
+ LogOutAndClose();
+
+ // Should see 1 sign out attempt.
+ histogram_tester.ExpectBucketCount(
+ "AddSupervisionDialog.Enrollment",
+ AddSupervisionMetricsRecorder::EnrollmentState::kSignedOut, 1);
+ histogram_tester.ExpectTotalCount("AddSupervisionDialog.Enrollment", 7);
+}
+
+IN_PROC_BROWSER_TEST_F(AddSupervisionMetricsRecorderTest, UserActionTest) {
+ base::UserActionTester user_action_tester;
+ // Should see 0 user actions at first.
+ EXPECT_EQ(user_action_tester.GetActionCount("AddSupervisionDialog_Launched"),
+ 0);
+ EXPECT_EQ(user_action_tester.GetActionCount("AddSupervisionDialog_Closed"),
+ 0);
+ EXPECT_EQ(user_action_tester.GetActionCount(
+ "AddSupervisionDialog_AttemptedSignoutAfterEnrollment"),
+ 0);
+ EXPECT_EQ(user_action_tester.GetActionCount(
+ "AddSupervisionDialog_EnrollmentCompleted"),
+ 0);
+
+ // Simulate the user opening the Add Supervision dialog and closing it.
+ ShowAddSupervisionDialog();
+
+ // Should see 1 Launched action.
+ EXPECT_EQ(user_action_tester.GetActionCount("AddSupervisionDialog_Launched"),
+ 1);
+
+ CloseAddSupervisionDialog();
+
+ // Should see 1 Closed action.
+ EXPECT_EQ(user_action_tester.GetActionCount("AddSupervisionDialog_Closed"),
+ 1);
+
+ // Simulate the user opening the Add Supervision dialog and signing out to
+ // switch accounts.
+ ShowAddSupervisionDialog();
+
+ // Should see 2 Launched actions.
+ EXPECT_EQ(user_action_tester.GetActionCount("AddSupervisionDialog_Launched"),
+ 2);
+
+ LogOutAndClose();
+
+ // Should see 1 switch accounts attempt.
+ EXPECT_EQ(user_action_tester.GetActionCount(
+ "AddSupervisionDialog_SwitchedAccounts"),
+ 1);
+
+ // Simulate the user opening the Add Supervision dialog, enrolling in
+ // supervision and signing out.
+ ShowAddSupervisionDialog();
+
+ // Should see 3 Launched actions.
+ EXPECT_EQ(user_action_tester.GetActionCount("AddSupervisionDialog_Launched"),
+ 3);
+
+ NotifySupervisionEnabled();
+
+ // Should see 1 EnrollmentCompleted action.
+ EXPECT_EQ(user_action_tester.GetActionCount(
+ "AddSupervisionDialog_EnrollmentCompleted"),
+ 1);
+
+ LogOutAndClose();
+
+ // Should see 1 AttemptedSignoutAfterEnrollment action.
+ EXPECT_EQ(user_action_tester.GetActionCount(
+ "AddSupervisionDialog_AttemptedSignoutAfterEnrollment"),
+ 1);
+}
+
+// This browser test class is for the Add Supervision timing metrics.
+class AddSupervisionMetricsRecorderTimeTest
+ : public AddSupervisionMetricsRecorderTest,
+ public testing::WithParamInterface<int> {};
+
+INSTANTIATE_TEST_SUITE_P(AddSupervisionDialogUserTimeInSeconds,
+ AddSupervisionMetricsRecorderTimeTest,
+ ::testing::Values(0, 11, 120, 1800));
+
+IN_PROC_BROWSER_TEST_P(AddSupervisionMetricsRecorderTimeTest, UserTimingTest) {
+ base::HistogramTester histogram_tester;
+
+ // Should see 0 Add Supervision timing metrics at first.
+ histogram_tester.ExpectTotalCount(
+ "AddSupervisionDialog.EnrollmentNotCompletedUserTime", 0);
+ histogram_tester.ExpectTotalCount(
+ "AddSupervisionDialog.EnrollmentCompletedUserTime", 0);
+ histogram_tester.ExpectTotalCount(
+ "AddSupervisionDialog.SignoutCompletedUserTime", 0);
+
+ // Simulate the user opening the Add Supervision dialog and closing it
+ // after GetParam() seconds.
+ scoped_refptr<base::TestMockTimeTaskRunner> task_runner_ =
+ base::MakeRefCounted<base::TestMockTimeTaskRunner>();
+ AddSupervisionMetricsRecorder::GetInstance()->SetClockForTesting(
+ task_runner_->GetMockTickClock());
+ base::TimeDelta duration(base::TimeDelta::FromSeconds(GetParam()));
+
+ // We need to start at some non-zero point in time or else
+ // DCHECK(!start_time_.is_null()) throws.
+ task_runner_->FastForwardBy(base::TimeDelta::FromSeconds(1));
+ ShowAddSupervisionDialog();
+ task_runner_->FastForwardBy(duration);
+ CloseAddSupervisionDialog();
+
+ // Should see 1 new EnrollmentNotCompletedUserTime timing.
+ histogram_tester.ExpectTimeBucketCount(
+ "AddSupervisionDialog.EnrollmentNotCompletedUserTime", duration, 1);
+ histogram_tester.ExpectTotalCount(
+ "AddSupervisionDialog.EnrollmentNotCompletedUserTime", 1);
+ histogram_tester.ExpectTotalCount(
+ "AddSupervisionDialog.EnrollmentCompletedUserTime", 0);
+ histogram_tester.ExpectTotalCount(
+ "AddSupervisionDialog.SignoutCompletedUserTime", 0);
+
+ // Simulate the user opening the Add Supervision dialog and signing out to
+ // switch accounts after GetParam() seconds.
+ ShowAddSupervisionDialog();
+ task_runner_->FastForwardBy(duration);
+ LogOutAndClose();
+
+ // Should see 1 new EnrollmentNotCompletedUserTime timing.
+ histogram_tester.ExpectTimeBucketCount(
+ "AddSupervisionDialog.EnrollmentNotCompletedUserTime", duration, 2);
+ histogram_tester.ExpectTotalCount(
+ "AddSupervisionDialog.EnrollmentNotCompletedUserTime", 2);
+ histogram_tester.ExpectTotalCount(
+ "AddSupervisionDialog.EnrollmentCompletedUserTime", 0);
+ histogram_tester.ExpectTotalCount(
+ "AddSupervisionDialog.SignoutCompletedUserTime", 0);
+
+ // Simulate the user opening the Add Supervision dialog, enrolling in
+ // supervision after GetParam() seconds and signing out after GetParam()
+ // seconds.
+ ShowAddSupervisionDialog();
+ task_runner_->FastForwardBy(duration);
+ NotifySupervisionEnabled();
+ task_runner_->FastForwardBy(duration);
+ LogOutAndClose();
+
+ histogram_tester.ExpectTotalCount(
+ "AddSupervisionDialog.EnrollmentNotCompletedUserTime", 2);
+ // Should see 1 new EnrollmentCompletedUserTime timing.
+ histogram_tester.ExpectTimeBucketCount(
+ "AddSupervisionDialog.EnrollmentCompletedUserTime", duration, 1);
+ histogram_tester.ExpectTotalCount(
+ "AddSupervisionDialog.EnrollmentCompletedUserTime", 1);
+ // Should see 1 new SignoutCompletedUserTime timing.
+ histogram_tester.ExpectTimeBucketCount(
+ "AddSupervisionDialog.SignoutCompletedUserTime", 2 * duration, 1);
+ histogram_tester.ExpectTotalCount(
+ "AddSupervisionDialog.SignoutCompletedUserTime", 1);
+}
+
+} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.cc
index b0dcfb1cfef..c0c3fb9b98f 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.cc
@@ -8,14 +8,13 @@
#include <utility>
#include "base/bind.h"
-#include "base/no_destructor.h"
#include "base/system/sys_info.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/browser/supervised_user/supervised_user_service.h"
-#include "chrome/browser/supervised_user/supervised_user_service_factory.h"
+#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/ui/views/chrome_web_dialog_view.h"
+#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.h"
+#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder.h"
#include "chrome/browser/ui/webui/chromeos/add_supervision/confirm_signout_dialog.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/browser_resources.h"
@@ -34,19 +33,12 @@ namespace {
constexpr int kDialogHeightPx = 608;
constexpr int kDialogWidthPx = 768;
-// Id of System Dialog used to show the Add Supervision flow.
-std::string& GetDialogId() {
- static base::NoDestructor<std::string> dialog_id;
- return *dialog_id;
-}
// Shows the dialog indicating that user has to sign out if supervision has been
// enabled for their account. Returns a boolean indicating whether the
// ConfirmSignoutDialog is being shown.
bool MaybeShowConfirmSignoutDialog() {
- SupervisedUserService* service = SupervisedUserServiceFactory::GetForProfile(
- ProfileManager::GetPrimaryUserProfile());
- if (service->signout_required_after_supervision_enabled()) {
+ if (EnrollmentCompleted()) {
ConfirmSignoutDialog::Show();
return true;
}
@@ -94,10 +86,18 @@ void AddSupervisionDialog::Show(gfx::NativeView parent) {
// SystemWebDialogDelegate::OnDialogClosed() is called.
current_instance = new AddSupervisionDialog();
- GetDialogId() = current_instance->Id();
-
current_instance->ShowSystemDialogForBrowserContext(
ProfileManager::GetPrimaryUserProfile(), parent);
+
+ // Record UMA metric that user has initiated the Add Supervision process.
+ AddSupervisionMetricsRecorder::GetInstance()->RecordAddSupervisionEnrollment(
+ AddSupervisionMetricsRecorder::EnrollmentState::kInitiated);
+}
+
+// static
+SystemWebDialogDelegate* AddSupervisionDialog::GetInstance() {
+ return SystemWebDialogDelegate::FindInstance(
+ chrome::kChromeUIAddSupervisionURL);
}
// static
@@ -105,7 +105,14 @@ void AddSupervisionDialog::Close() {
SystemWebDialogDelegate* current_instance = GetInstance();
if (current_instance) {
current_instance->Close();
- GetDialogId() = std::string();
+ }
+}
+
+void AddSupervisionDialog::CloseNowForTesting() {
+ SystemWebDialogDelegate* current_instance = GetInstance();
+ if (current_instance) {
+ DCHECK(dialog_window()) << "No dialog window instance currently set.";
+ views::Widget::GetWidgetForNativeWindow(dialog_window())->CloseNow();
}
}
@@ -117,20 +124,16 @@ void AddSupervisionDialog::GetDialogSize(gfx::Size* size) const {
size->SetSize(kDialogWidthPx, kDialogHeightPx);
}
-bool AddSupervisionDialog::OnDialogCloseRequested() {
+bool AddSupervisionDialog::CanCloseDialog() const {
bool showing_confirm_dialog = MaybeShowConfirmSignoutDialog();
return !showing_confirm_dialog;
}
-void AddSupervisionDialog::OnCloseContents(content::WebContents* source,
- bool* out_close_dialog) {
- // This code gets called by a different path that OnDialogCloseRequested(),
- // and actually masks the call to OnDialogCloseRequested() the first time the
- // user clicks on the [x]. Because the first [x] click comes here, we need to
- // show the confirmation dialog here and signal the caller to possibly close
- // the dialog. Subsequent clicks on [x] during the lifetime of the dialog
- // will result in calls to OnDialogCloseRequested().
- *out_close_dialog = OnDialogCloseRequested();
+bool AddSupervisionDialog::OnDialogCloseRequested() {
+ // Record UMA metric that user has closed the Add Supervision dialog.
+ AddSupervisionMetricsRecorder::GetInstance()->RecordAddSupervisionEnrollment(
+ AddSupervisionMetricsRecorder::EnrollmentState::kClosed);
+ return true;
}
AddSupervisionDialog::AddSupervisionDialog()
@@ -139,11 +142,6 @@ AddSupervisionDialog::AddSupervisionDialog()
AddSupervisionDialog::~AddSupervisionDialog() = default;
-// static
-SystemWebDialogDelegate* AddSupervisionDialog::GetInstance() {
- return SystemWebDialogDelegate::FindInstance(GetDialogId());
-}
-
// AddSupervisionUI implementations.
AddSupervisionUI::AddSupervisionUI(content::WebUI* web_ui)
@@ -188,7 +186,7 @@ void AddSupervisionUI::SetupResources() {
"add_supervision.mojom-lite.js",
IDR_ADD_SUPERVISION_MOJOM_LITE_JS);
- source->SetJsonPath("strings.js");
+ source->UseStringsJs();
source->SetDefaultResource(IDR_ADD_SUPERVISION_HTML);
source->AddString("webviewUrl", supervision_url_.spec());
source->AddString("eventOriginFilter", supervision_url_.GetOrigin().spec());
diff --git a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.h b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.h
index 25a2c1b2068..02afc8e1d8e 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.h
@@ -27,24 +27,30 @@ class AddSupervisionDialog : public SystemWebDialogDelegate {
// no-op.
static void Show(gfx::NativeView parent);
- // Closes the dialog, if the dialog doesn't exist, this function is a
+ static SystemWebDialogDelegate* GetInstance();
+
+ // Closes the dialog; if the dialog doesn't exist, this function is a
// no-op.
+ // This is only called when the user clicks "Cancel", not the "x" in the top
+ // right.
static void Close();
+ // Deletes this dialog window.
+ // Currently only used by AddSupervisionMetricsRecorderTest browser test to
+ // simulate closing the dialog cleanly.
+ void CloseNowForTesting();
+
// ui::WebDialogDelegate:
ui::ModalType GetDialogModalType() const override;
void GetDialogSize(gfx::Size* size) const override;
+ bool CanCloseDialog() const override;
bool OnDialogCloseRequested() override;
- void OnCloseContents(content::WebContents* source,
- bool* out_close_dialog) override;
protected:
AddSupervisionDialog();
~AddSupervisionDialog() override;
private:
- static SystemWebDialogDelegate* GetInstance();
-
DISALLOW_COPY_AND_ASSIGN(AddSupervisionDialog);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/confirm_signout_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/confirm_signout_dialog.cc
index 9ee08568e9b..b0754f4a57b 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/confirm_signout_dialog.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/confirm_signout_dialog.cc
@@ -7,11 +7,10 @@
#include <memory>
#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/ui/browser_dialogs.h"
+#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.h"
#include "chrome/grit/generated_resources.h"
#include "components/constrained_window/constrained_window_views.h"
-#include "components/user_manager/user_manager.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/resources/grit/ui_resources.h"
@@ -35,15 +34,12 @@ ConfirmSignoutDialog::ConfirmSignoutDialog() {
views::LayoutProvider::Get()->GetDialogInsetsForContentType(
views::DialogContentType::TEXT, views::DialogContentType::TEXT)));
- base::string16 given_name =
- user_manager::UserManager::Get()->GetPrimaryUser()->GetGivenName();
-
- // |body_| will be owned by the views system.
+ // |body| will be owned by the views system.
views::Label* body = new views::Label;
body->SetHorizontalAlignment(gfx::ALIGN_LEFT);
body->SetMultiLine(true);
- body->SetText(l10n_util::GetStringFUTF16(IDS_ADD_SUPERVISION_EXIT_DIALOG_BODY,
- given_name));
+ body->SetText(
+ l10n_util::GetStringUTF16(IDS_ADD_SUPERVISION_EXIT_DIALOG_BODY));
body->SizeToFit(kDialogBodyTextWidth);
AddChildView(body);
}
@@ -59,7 +55,7 @@ base::string16 ConfirmSignoutDialog::GetWindowTitle() const {
}
bool ConfirmSignoutDialog::Accept() {
- chrome::AttemptUserExit();
+ LogOutHelper();
return true;
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.cc
index de20b5eedd0..3c918789930 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.cc
@@ -16,6 +16,7 @@
#include "base/json/json_writer.h"
#include "base/linux_util.h"
#include "base/memory/ref_counted_memory.h"
+#include "base/metrics/histogram_macros.h"
#include "base/process/process_iterator.h"
#include "base/strings/string_split.h"
#include "base/strings/string_tokenizer.h"
@@ -55,9 +56,24 @@ constexpr char kKeyTasks[] = "tasks";
constexpr char kLastTracingModelName[] = "last_tracing_model.json";
+enum class Action {
+ kShown = 0,
+ kBuildSucceeded = 1,
+ kBuildFailed = 2,
+ kInitialLoadSucceeded = 3,
+ kInitialLoadFailed = 4,
+ kLoadSucceeded = 5,
+ kLoadFailed = 6,
+ kMaxValue = kLoadFailed,
+};
+
+void UpdateStatistics(Action action) {
+ UMA_HISTOGRAM_ENUMERATION("Arc.Tracing.Tool", action);
+}
+
// Maximum interval to display.
constexpr base::TimeDelta kMaxIntervalToDisplay =
- base::TimeDelta::FromSecondsD(3.0);
+ base::TimeDelta::FromSecondsD(5.0);
base::FilePath GetLastTracingModelPath(Profile* profile) {
DCHECK(profile);
@@ -78,9 +94,12 @@ std::pair<base::Value, std::string> MaybeLoadLastGraphicsModel(
arc::ArcTracingGraphicsModel graphics_model;
base::DictionaryValue* dictionary = nullptr;
model->GetAsDictionary(&dictionary);
- if (!graphics_model.LoadFromValue(*dictionary))
+ if (!graphics_model.LoadFromValue(*dictionary)) {
+ UpdateStatistics(Action::kInitialLoadFailed);
return std::make_pair(base::Value(), "Failed to load last tracing model");
+ }
+ UpdateStatistics(Action::kInitialLoadSucceeded);
return std::make_pair(std::move(*model), "Loaded last tracing model");
}
@@ -168,15 +187,19 @@ std::pair<base::Value, std::string> BuildGraphicsModel(
(time_min_clamped - base::TimeTicks()).InMicroseconds(),
(time_max - base::TimeTicks()).InMicroseconds());
- if (!common_model.Build(data))
+ if (!common_model.Build(data)) {
+ UpdateStatistics(Action::kBuildFailed);
return std::make_pair(base::Value(), "Failed to process tracing data");
+ }
system_stat_collector->Flush(time_min, time_max,
&common_model.system_model());
arc::ArcTracingGraphicsModel graphics_model;
- if (!graphics_model.Build(common_model))
+ if (!graphics_model.Build(common_model)) {
+ UpdateStatistics(Action::kBuildFailed);
return std::make_pair(base::Value(), "Failed to build tracing model");
+ }
UpdateThreads(&graphics_model.system_model().thread_map());
@@ -194,16 +217,20 @@ std::pair<base::Value, std::string> BuildGraphicsModel(
<< ".";
}
+ UpdateStatistics(Action::kBuildSucceeded);
return std::make_pair(std::move(*model), "Tracing model is ready");
}
std::pair<base::Value, std::string> LoadGraphicsModel(
const std::string& json_text) {
arc::ArcTracingGraphicsModel graphics_model;
- if (!graphics_model.LoadFromJson(json_text))
+ if (!graphics_model.LoadFromJson(json_text)) {
+ UpdateStatistics(Action::kLoadFailed);
return std::make_pair(base::Value(), "Failed to load tracing model");
+ }
std::unique_ptr<base::DictionaryValue> model = graphics_model.Serialize();
+ UpdateStatistics(Action::kLoadSucceeded);
return std::make_pair(std::move(*model), "Tracing model is loaded");
}
@@ -211,8 +238,7 @@ std::pair<base::Value, std::string> LoadGraphicsModel(
ArcGraphicsTracingHandler::ArcGraphicsTracingHandler()
: wm_helper_(exo::WMHelper::HasInstance() ? exo::WMHelper::GetInstance()
- : nullptr),
- weak_ptr_factory_(this) {
+ : nullptr) {
DCHECK(wm_helper_);
aura::Window* const current_active = wm_helper_->GetActiveWindow();
@@ -221,6 +247,8 @@ ArcGraphicsTracingHandler::ArcGraphicsTracingHandler()
current_active, nullptr);
}
wm_helper_->AddActivationObserver(this);
+
+ UpdateStatistics(Action::kShown);
}
ArcGraphicsTracingHandler::~ArcGraphicsTracingHandler() {
@@ -428,8 +456,9 @@ void ArcGraphicsTracingHandler::OnTracingStopped(
base::RefCountedString* trace_data) {
std::string string_data;
string_data.swap(trace_data->data());
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
+ base::PostTaskAndReplyWithResult(
+ FROM_HERE,
+ {base::ThreadPool(), base::MayBlock(), base::TaskPriority::BEST_EFFORT},
base::BindOnce(&BuildGraphicsModel, std::move(string_data),
std::move(tasks_info_), std::move(system_stat_colletor_),
tracing_time_min_, tracing_time_max_,
@@ -450,8 +479,9 @@ void ArcGraphicsTracingHandler::OnGraphicsModelReady(
}
void ArcGraphicsTracingHandler::HandleReady(const base::ListValue* args) {
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
+ base::PostTaskAndReplyWithResult(
+ FROM_HERE,
+ {base::ThreadPool(), base::MayBlock(), base::TaskPriority::BEST_EFFORT},
base::BindOnce(&MaybeLoadLastGraphicsModel,
GetLastTracingModelPath(Profile::FromWebUI(web_ui()))),
base::BindOnce(&ArcGraphicsTracingHandler::OnGraphicsModelReady,
@@ -476,8 +506,9 @@ void ArcGraphicsTracingHandler::HandleLoadFromText(
return;
}
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
+ base::PostTaskAndReplyWithResult(
+ FROM_HERE,
+ {base::ThreadPool(), base::MayBlock(), base::TaskPriority::BEST_EFFORT},
base::BindOnce(&LoadGraphicsModel,
std::move(args->GetList()[0].GetString())),
base::BindOnce(&ArcGraphicsTracingHandler::OnGraphicsModelReady,
diff --git a/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.h b/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.h
index 4f613c1a1a7..bd774e39149 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.h
@@ -119,7 +119,7 @@ class ArcGraphicsTracingHandler : public content::WebUIMessageHandler,
// Information about tasks, title and icon.
base::DictionaryValue tasks_info_;
- base::WeakPtrFactory<ArcGraphicsTracingHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<ArcGraphicsTracingHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ArcGraphicsTracingHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_ui.cc
index f144257e56f..9610dee0f41 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_ui.cc
@@ -25,7 +25,7 @@ constexpr char kArcGraphicsTracingCssPath[] = "arc_graphics_tracing.css";
content::WebUIDataSource* CreateDataSource() {
content::WebUIDataSource* source =
content::WebUIDataSource::Create(chrome::kChromeUIArcGraphicsTracingHost);
- source->SetJsonPath("strings.js");
+ source->UseStringsJs();
source->SetDefaultResource(IDR_ARC_GRAPHICS_TRACING_HTML);
source->AddResourcePath(kArcGraphicsTracingJsPath,
IDR_ARC_GRAPHICS_TRACING_JS);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.cc
index 2e65bdfe483..03a052c6863 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.cc
@@ -8,7 +8,7 @@
#include <string>
#include <utility>
-#include "ash/public/interfaces/voice_interaction_controller.mojom.h"
+#include "ash/public/mojom/voice_interaction_controller.mojom.h"
#include "base/bind.h"
#include "base/macros.h"
#include "base/strings/string_number_conversions.h"
@@ -20,7 +20,6 @@
#include "chrome/common/url_constants.h"
#include "chrome/grit/browser_resources.h"
#include "chromeos/services/assistant/public/cpp/assistant_prefs.h"
-#include "components/arc/arc_prefs.h"
#include "components/prefs/pref_service.h"
#include "components/session_manager/core/session_manager.h"
#include "content/public/browser/host_zoom_map.h"
@@ -29,7 +28,9 @@
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/common/content_features.h"
#include "net/base/url_util.h"
+#include "ui/chromeos/resources/grit/ui_chromeos_resources.h"
#include "ui/views/widget/widget.h"
+#include "ui/wm/core/window_animations.h"
namespace chromeos {
@@ -76,11 +77,14 @@ AssistantOptInUI::AssistantOptInUI(content::WebUI* web_ui)
base::DictionaryValue localized_strings;
assistant_handler_ptr_->GetLocalizedStrings(&localized_strings);
source->AddLocalizedStrings(localized_strings);
- source->SetJsonPath("strings.js");
+ source->UseStringsJs();
source->AddResourcePath("assistant_optin.js", IDR_ASSISTANT_OPTIN_JS);
source->AddResourcePath("assistant_logo.png", IDR_ASSISTANT_LOGO_PNG);
source->AddBoolean("hotwordDspAvailable", chromeos::IsHotwordDspAvailable());
source->SetDefaultResource(IDR_ASSISTANT_OPTIN_HTML);
+ source->AddResourcePath("voice_match_animation.json",
+ IDR_ASSISTANT_VOICE_MATCH_ANIMATION);
+ source->OverrideContentSecurityPolicyWorkerSrc("worker-src blob: 'self';");
content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source);
// Do not zoom for Assistant opt-in web contents.
@@ -135,6 +139,17 @@ void AssistantOptInDialog::Show(
g_dialog->ShowSystemDialog();
}
+// static
+bool AssistantOptInDialog::BounceIfActive() {
+ if (!g_dialog)
+ return false;
+
+ g_dialog->Focus();
+ wm::AnimateWindow(g_dialog->dialog_window(),
+ wm::WINDOW_ANIMATION_TYPE_BOUNCE);
+ return true;
+}
+
AssistantOptInDialog::AssistantOptInDialog(
ash::FlowType type,
ash::AssistantSetup::StartAssistantOptInFlowCallback callback)
@@ -172,7 +187,7 @@ void AssistantOptInDialog::OnDialogClosed(const std::string& json_retval) {
PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs();
const bool completed =
- prefs->GetBoolean(arc::prefs::kVoiceInteractionEnabled) &&
+ prefs->GetBoolean(chromeos::assistant::prefs::kAssistantEnabled) &&
(prefs->GetInteger(assistant::prefs::kAssistantConsentStatus) ==
assistant::prefs::ConsentStatus::kActivityControlAccepted);
std::move(callback_).Run(completed);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.h b/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.h
index d4b7b6b90e0..a93c2483e26 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.h
@@ -48,6 +48,9 @@ class AssistantOptInDialog : public SystemWebDialogDelegate {
ash::AssistantSetup::StartAssistantOptInFlowCallback
callback = base::DoNothing());
+ // Returns true and bounces the window if the dialog is active.
+ static bool BounceIfActive();
+
protected:
AssistantOptInDialog(
ash::FlowType type,
diff --git a/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_utils.cc b/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_utils.cc
index 4287e686189..96f8106a00d 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_utils.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_utils.cc
@@ -13,6 +13,7 @@
#include "chrome/grit/browser_resources.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/audio/cras_audio_handler.h"
+#include "chromeos/services/assistant/public/cpp/assistant_prefs.h"
#include "chromeos/services/assistant/public/features.h"
#include "components/arc/arc_prefs.h"
#include "components/consent_auditor/consent_auditor.h"
@@ -39,12 +40,12 @@ bool IsPreferenceDefaultEnabled(const PrefService* prefs,
bool IsScreenContextDefaultEnabled(PrefService* prefs) {
return IsPreferenceDefaultEnabled(
- prefs, arc::prefs::kVoiceInteractionContextEnabled);
+ prefs, chromeos::assistant::prefs::kAssistantContextEnabled);
}
bool IsScreenContextToggleDisabled(PrefService* prefs) {
return prefs->IsManagedPreference(
- arc::prefs::kVoiceInteractionContextEnabled);
+ chromeos::assistant::prefs::kAssistantContextEnabled);
}
} // namespace
@@ -244,8 +245,8 @@ bool IsVoiceMatchEnforcedOff(const PrefService* prefs) {
// If the hotword preference is managed to always disabled, then we should not
// show Voice Match flow.
return prefs->IsManagedPreference(
- arc::prefs::kVoiceInteractionHotwordEnabled) &&
- !prefs->GetBoolean(arc::prefs::kVoiceInteractionHotwordEnabled);
+ assistant::prefs::kAssistantHotwordEnabled) &&
+ !prefs->GetBoolean(assistant::prefs::kAssistantHotwordEnabled);
}
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/bluetooth_pairing_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/bluetooth_pairing_dialog.cc
index 326632a3125..b65490702e4 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/bluetooth_pairing_dialog.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/bluetooth_pairing_dialog.cc
@@ -103,7 +103,7 @@ BluetoothPairingDialogUI::BluetoothPairingDialogUI(content::WebUI* web_ui)
AddBluetoothStrings(source);
source->AddLocalizedString("title", IDS_SETTINGS_BLUETOOTH_PAIR_DEVICE_TITLE);
- source->SetJsonPath("strings.js");
+ source->UseStringsJs();
#if BUILDFLAG(OPTIMIZE_WEBUI)
source->SetDefaultResource(IDR_BLUETOOTH_PAIRING_DIALOG_VULCANIZED_HTML);
source->AddResourcePath("crisper.js",
diff --git a/chromium/chrome/browser/ui/webui/chromeos/bluetooth_pairing_dialog_browsertest-inl.h b/chromium/chrome/browser/ui/webui/chromeos/bluetooth_pairing_dialog_browsertest-inl.h
index 3fd8630b818..3a39cb5c7ab 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/bluetooth_pairing_dialog_browsertest-inl.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/bluetooth_pairing_dialog_browsertest-inl.h
@@ -54,9 +54,10 @@ void BluetoothPairingDialogTest::ShowDialog() {
const bool kNotPaired = false;
const bool kNotConnected = false;
- mock_device_.reset(new testing::NiceMock<device::MockBluetoothDevice>(
- nullptr, 0, "Bluetooth 2.0 Mouse", "28:CF:DA:00:00:00", kNotPaired,
- kNotConnected));
+ mock_device_ =
+ std::make_unique<testing::NiceMock<device::MockBluetoothDevice>>(
+ nullptr, 0, "Bluetooth 2.0 Mouse", "28:CF:DA:00:00:00", kNotPaired,
+ kNotConnected);
EXPECT_CALL(*mock_adapter_, GetDevice(testing::_))
.WillRepeatedly(testing::Return(mock_device_.get()));
diff --git a/chromium/chrome/browser/ui/webui/chromeos/camera/camera_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/camera/camera_ui.cc
index c6110b2fde4..8a40f0cbdba 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/camera/camera_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/camera/camera_ui.cc
@@ -45,15 +45,15 @@ content::WebUIDataSource* CreateCameraUIHTMLSource() {
IDR_CAMERA_CAMERA_METADATA_MOJOM_LITE_JS);
source->AddResourcePath("src/js/mojo/camera_metadata_tags.mojom-lite.js",
IDR_CAMERA_CAMERA_METADATA_TAGS_MOJOM_LITE_JS);
- source->AddResourcePath("src/js/mojo/cros_image_capture.mojom-lite.js",
- IDR_CAMERA_CROS_IMAGE_CAPTURE_MOJOM_LITE_JS);
+ source->AddResourcePath("src/js/mojo/camera_app.mojom-lite.js",
+ IDR_CAMERA_APP_MOJOM_LITE_JS);
source->AddResourcePath("src/js/mojo/mojo_bindings_lite.js",
IDR_MOJO_MOJO_BINDINGS_LITE_JS);
// Add System Web App resources.
source->AddResourcePath("pwa.html", IDR_PWA_HTML);
- source->SetJsonPath("strings.js");
+ source->UseStringsJs();
return source;
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/DEPS b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/DEPS
new file mode 100644
index 00000000000..55ca2bd3041
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+ "+chromeos/services/cellular_setup",
+]
diff --git a/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog.cc
index 4243362e1fc..60d1b64de38 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog.h"
#include "base/bind.h"
+#include "base/supports_user_data.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser_dialogs.h"
@@ -12,9 +13,10 @@
#include "chrome/common/url_constants.h"
#include "chrome/grit/cellular_setup_resources.h"
#include "chrome/grit/cellular_setup_resources_map.h"
-#include "chromeos/services/cellular_setup/public/mojom/constants.mojom.h"
+#include "chromeos/services/cellular_setup/cellular_setup_base.h"
+#include "chromeos/services/cellular_setup/cellular_setup_impl.h"
#include "content/public/browser/web_ui_data_source.h"
-#include "services/service_manager/public/cpp/connector.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/aura/window.h"
namespace chromeos {
@@ -30,6 +32,37 @@ constexpr int kDialogWidthPx = 650;
CellularSetupDialog* dialog_instance = nullptr;
+// Used to attach an instance of the CellularSetup service to a BrowserContext.
+class CellularSetupServiceHolder : public base::SupportsUserData::Data {
+ public:
+ CellularSetupServiceHolder() = default;
+ ~CellularSetupServiceHolder() override = default;
+
+ void BindReceiver(mojo::PendingReceiver<mojom::CellularSetup> receiver) {
+ service_.BindRequest(std::move(receiver));
+ }
+
+ private:
+ CellularSetupImpl service_;
+
+ DISALLOW_COPY_AND_ASSIGN(CellularSetupServiceHolder);
+};
+
+const char kCellularSetupServiceHolderKey[] = "cellular_setup_service_holder";
+
+CellularSetupServiceHolder* GetOrCreateServiceHolder(
+ content::BrowserContext* browser_context) {
+ auto* holder = static_cast<CellularSetupServiceHolder*>(
+ browser_context->GetUserData(kCellularSetupServiceHolderKey));
+ if (!holder) {
+ auto new_holder = std::make_unique<CellularSetupServiceHolder>();
+ holder = new_holder.get();
+ browser_context->SetUserData(kCellularSetupServiceHolderKey,
+ std::move(new_holder));
+ }
+ return holder;
+}
+
} // namespace
// static
@@ -78,7 +111,7 @@ CellularSetupDialogUI::CellularSetupDialogUI(content::WebUI* web_ui)
content::WebUIDataSource::Create(chrome::kChromeUICellularSetupHost);
chromeos::cellular_setup::AddLocalizedStrings(source);
- source->SetJsonPath("strings.js");
+ source->UseStringsJs();
source->SetDefaultResource(IDR_CELLULAR_SETUP_CELLULAR_SETUP_DIALOG_HTML);
// Note: The |kCellularSetupResourcesSize| and |kCellularSetupResources|
@@ -100,10 +133,8 @@ CellularSetupDialogUI::~CellularSetupDialogUI() = default;
void CellularSetupDialogUI::BindCellularSetup(
mojom::CellularSetupRequest request) {
- service_manager::Connector* connector =
- content::BrowserContext::GetConnectorFor(
- web_ui()->GetWebContents()->GetBrowserContext());
- connector->BindInterface(mojom::kServiceName, std::move(request));
+ GetOrCreateServiceHolder(web_ui()->GetWebContents()->GetBrowserContext())
+ ->BindReceiver(std::move(request));
}
} // namespace cellular_setup
diff --git a/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_localized_strings_provider.cc b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_localized_strings_provider.cc
index 981076b2c11..994d31c045b 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_localized_strings_provider.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_localized_strings_provider.cc
@@ -23,7 +23,17 @@ constexpr LocalizedString kLocalizedStringsWithoutPlaceholders[] = {
{"finish", IDS_CELLULAR_SETUP_FINISH_LABEL},
{"tryAgain", IDS_CELLULAR_SETUP_TRY_AGAIN_LABEL},
{"simDetectPageTitle", IDS_CELLULAR_SETUP_SIM_DETECT_PAGE_TITLE},
- {"provisioningPageTitle", IDS_CELLULAR_SETUP_PROVISIONING_PAGE_TITLE},
+ {"simDetectPageErrorTitle", IDS_CELLULAR_SETUP_SIM_DETECT_PAGE_ERROR_TITLE},
+ {"simDetectPageErrorMessage",
+ IDS_CELLULAR_SETUP_SIM_DETECT_PAGE_ERROR_MESSAGE},
+ {"provisioningPageLoadingTitle",
+ IDS_CELLULAR_SETUP_PROVISIONING_PAGE_LOADING_TITLE},
+ {"provisioningPageActiveTitle",
+ IDS_CELLULAR_SETUP_PROVISIONING_PAGE_ACTIVE_TITLE},
+ {"provisioningPageErrorTitle",
+ IDS_CELLULAR_SETUP_PROVISIONING_PAGE_ERROR_TITLE},
+ {"provisioningPageErrorMessage",
+ IDS_CELLULAR_SETUP_PROVISIONING_PAGE_ERROR_MESSAGE},
{"finalPageTitle", IDS_CELLULAR_SETUP_FINAL_PAGE_TITLE},
{"finalPageMessage", IDS_CELLULAR_SETUP_FINAL_PAGE_MESSAGE},
{"finalPageErrorTitle", IDS_CELLULAR_SETUP_FINAL_PAGE_ERROR_TITLE},
diff --git a/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_ui.cc
index 5eaf0f3a48c..6ac7d19882b 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_ui.cc
@@ -178,7 +178,7 @@ class MobileSetupUIHTMLSource : public content::URLDataSource {
std::string GetSource() override;
void StartDataRequest(
const std::string& path,
- const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
+ const content::WebContents::Getter& wc_getter,
const content::URLDataSource::GotDataCallback& callback) override;
std::string GetMimeType(const std::string&) override { return "text/html"; }
bool ShouldAddContentSecurityPolicy() override { return false; }
@@ -189,7 +189,7 @@ class MobileSetupUIHTMLSource : public content::URLDataSource {
}
private:
- base::WeakPtrFactory<MobileSetupUIHTMLSource> weak_ptr_factory_;
+ base::WeakPtrFactory<MobileSetupUIHTMLSource> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(MobileSetupUIHTMLSource);
};
@@ -251,7 +251,7 @@ class MobileSetupHandler : public content::WebUIMessageHandler,
// connection state. This value is reflected in portal webui for lte networks.
// Initial value is true.
bool lte_portal_reachable_;
- base::WeakPtrFactory<MobileSetupHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<MobileSetupHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(MobileSetupHandler);
};
@@ -262,7 +262,7 @@ class MobileSetupHandler : public content::WebUIMessageHandler,
//
////////////////////////////////////////////////////////////////////////////////
-MobileSetupUIHTMLSource::MobileSetupUIHTMLSource() : weak_ptr_factory_(this) {}
+MobileSetupUIHTMLSource::MobileSetupUIHTMLSource() {}
std::string MobileSetupUIHTMLSource::GetSource() {
return chrome::kChromeUIMobileSetupHost;
@@ -270,7 +270,7 @@ std::string MobileSetupUIHTMLSource::GetSource() {
void MobileSetupUIHTMLSource::StartDataRequest(
const std::string& path,
- const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
+ const content::WebContents::Getter& wc_getter,
const content::URLDataSource::GotDataCallback& callback) {
// Sanity checks that activation was requested for an appropriate network.
const NetworkState* network =
@@ -362,10 +362,7 @@ void MobileSetupUIHTMLSource::StartDataRequest(
//
////////////////////////////////////////////////////////////////////////////////
MobileSetupHandler::MobileSetupHandler()
- : type_(TYPE_UNDETERMINED),
- active_(false),
- lte_portal_reachable_(true),
- weak_ptr_factory_(this) {}
+ : type_(TYPE_UNDETERMINED), active_(false), lte_portal_reachable_(true) {}
MobileSetupHandler::~MobileSetupHandler() {
Reset();
diff --git a/chromium/chrome/browser/ui/webui/chromeos/certificate_manager_dialog_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/certificate_manager_dialog_ui.cc
index e3c74610424..36919052a60 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/certificate_manager_dialog_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/certificate_manager_dialog_ui.cc
@@ -55,7 +55,7 @@ CertificateManagerDialogUI::CertificateManagerDialogUI(content::WebUI* web_ui)
user_manager::UserManager::Get()->IsLoggedInAsKioskApp() ||
user_manager::UserManager::Get()->IsLoggedInAsArcKioskApp());
- source->SetJsonPath("strings.js");
+ source->UseStringsJs();
source->SetDefaultResource(IDR_CERT_MANAGER_DIALOG_HTML);
source->DisableContentSecurityPolicy();
diff --git a/chromium/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.cc
index a2b95c06332..52894b68f0e 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.cc
@@ -18,7 +18,7 @@ using content::BrowserThread;
namespace chromeos {
-CryptohomeWebUIHandler::CryptohomeWebUIHandler() : weak_ptr_factory_(this) {}
+CryptohomeWebUIHandler::CryptohomeWebUIHandler() {}
CryptohomeWebUIHandler::~CryptohomeWebUIHandler() {}
@@ -40,7 +40,7 @@ void CryptohomeWebUIHandler::OnPageLoaded(const base::ListValue* args) {
cryptohome_client->Pkcs11IsTpmTokenReady(
GetCryptohomeBoolCallback("pkcs11-is-tpm-token-ready"));
- base::PostTaskWithTraitsAndReplyWithResult(
+ base::PostTaskAndReplyWithResult(
FROM_HERE, {BrowserThread::IO},
base::Bind(&crypto::IsTPMTokenReady, base::Closure()),
base::Bind(&CryptohomeWebUIHandler::DidGetNSSUtilInfoOnUIThread,
diff --git a/chromium/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.h b/chromium/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.h
index b470724610c..890066643bb 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.h
@@ -49,7 +49,7 @@ class CryptohomeWebUIHandler : public content::WebUIMessageHandler {
void SetCryptohomeProperty(const std::string& destination_id,
const base::Value& value);
- base::WeakPtrFactory<CryptohomeWebUIHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<CryptohomeWebUIHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(CryptohomeWebUIHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
index cce737b51cf..686d55faf55 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
@@ -34,6 +34,7 @@
#include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/chromeos/file_manager/path_util.h"
#include "chrome/browser/drive/drive_notification_manager_factory.h"
+#include "chrome/browser/file_util_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
@@ -53,7 +54,6 @@
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_controller.h"
-#include "content/public/browser/system_connector.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
@@ -297,8 +297,7 @@ void ZipLogs(Profile* profile,
// Class to handle messages from chrome://drive-internals.
class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
public:
- DriveInternalsWebUIHandler()
- : last_sent_event_id_(-1), weak_ptr_factory_(this) {}
+ DriveInternalsWebUIHandler() : last_sent_event_id_(-1) {}
~DriveInternalsWebUIHandler() override {}
@@ -694,8 +693,10 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
// Propagate the amount of local free space in bytes.
base::FilePath home_path;
if (base::PathService::Get(base::DIR_HOME, &home_path)) {
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
+ base::PostTaskAndReplyWithResult(
+ FROM_HERE,
+ {base::ThreadPool(), base::MayBlock(),
+ base::TaskPriority::USER_VISIBLE},
base::BindOnce(&base::SysInfo::AmountOfFreeDiskSpace, home_path),
base::BindOnce(&DriveInternalsWebUIHandler::OnGetFreeDiskSpace,
weak_ptr_factory_.GetWeakPtr()));
@@ -793,8 +794,10 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
"updateOtherServiceLogsUrl",
base::Value(net::FilePathToFileURL(log_path.DirName()).spec()));
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
+ base::PostTaskAndReplyWithResult(
+ FROM_HERE,
+ {base::ThreadPool(), base::MayBlock(),
+ base::TaskPriority::USER_VISIBLE},
base::BindOnce(&GetServiceLogContents, log_path,
service_log_file_inode_, last_sent_line_number_),
base::BindOnce(&DriveInternalsWebUIHandler::OnServiceLogRead,
@@ -852,8 +855,10 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
const base::FilePath root_path =
drive::util::GetCacheRootPath(profile()).DirName();
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
+ base::PostTaskAndReplyWithResult(
+ FROM_HERE,
+ {base::ThreadPool(), base::MayBlock(),
+ base::TaskPriority::USER_VISIBLE},
base::BindOnce(&GetGCacheContents, root_path),
base::BindOnce(&DriveInternalsWebUIHandler::OnGetGCacheContents,
weak_ptr_factory_.GetWeakPtr()));
@@ -966,7 +971,7 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
// Service log file is being parsed.
bool service_log_file_is_processing_ = false;
- base::WeakPtrFactory<DriveInternalsWebUIHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<DriveInternalsWebUIHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(DriveInternalsWebUIHandler);
};
@@ -983,8 +988,10 @@ class LogsZipper : public download::AllDownloadItemNotifier::Observer {
drive_internals_(std::move(drive_internals)) {}
void Start() {
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
+ base::PostTaskAndReplyWithResult(
+ FROM_HERE,
+ {base::ThreadPool(), base::MayBlock(),
+ base::TaskPriority::USER_VISIBLE},
base::BindOnce(&LogsZipper::EnumerateLogFiles, logs_directory_,
zip_path_),
base::BindOnce(&LogsZipper::ZipLogFiles, base::Unretained(this)));
@@ -997,7 +1004,7 @@ class LogsZipper : public download::AllDownloadItemNotifier::Observer {
(new ZipFileCreator(
base::BindRepeating(&LogsZipper::OnZipDone, base::Unretained(this)),
logs_directory_, files, zip_path_))
- ->Start(content::GetSystemConnector());
+ ->Start(LaunchFileUtilService());
}
static std::vector<base::FilePath> EnumerateLogFiles(
@@ -1040,8 +1047,9 @@ class LogsZipper : public download::AllDownloadItemNotifier::Observer {
}
void CleanUp() {
- base::PostTaskWithTraits(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
+ base::PostTask(
+ FROM_HERE,
+ {base::ThreadPool(), base::MayBlock(), base::TaskPriority::BEST_EFFORT},
base::BindOnce(base::IgnoreResult(&base::DeleteFile), zip_path_,
false));
download_notifier_.reset();
diff --git a/chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc
index 85c54f11143..1c6ecadb2f3 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc
@@ -198,8 +198,7 @@ DeviceEmulatorMessageHandler::DeviceEmulatorMessageHandler()
: fake_bluetooth_device_client_(
static_cast<bluez::FakeBluetoothDeviceClient*>(
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient())),
- fake_power_manager_client_(chromeos::FakePowerManagerClient::Get()),
- weak_ptr_factory_(this) {
+ fake_power_manager_client_(chromeos::FakePowerManagerClient::Get()) {
device::BluetoothAdapterFactory::GetAdapter(
base::BindOnce(&DeviceEmulatorMessageHandler::BluetoothDeviceAdapterReady,
weak_ptr_factory_.GetWeakPtr()));
@@ -553,9 +552,9 @@ void DeviceEmulatorMessageHandler::RegisterMessages() {
}
void DeviceEmulatorMessageHandler::OnJavascriptAllowed() {
- bluetooth_observer_.reset(new BluetoothObserver(this));
- cras_audio_observer_.reset(new CrasAudioObserver(this));
- power_observer_.reset(new PowerObserver(this));
+ bluetooth_observer_ = std::make_unique<BluetoothObserver>(this);
+ cras_audio_observer_ = std::make_unique<CrasAudioObserver>(this);
+ power_observer_ = std::make_unique<PowerObserver>(this);
system::InputDeviceSettings::Get()->TouchpadExists(
base::BindOnce(&DeviceEmulatorMessageHandler::TouchpadExists,
diff --git a/chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h b/chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h
index 0aca35bab32..3afd435d960 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h
@@ -137,7 +137,7 @@ class DeviceEmulatorMessageHandler :
scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_;
- base::WeakPtrFactory<DeviceEmulatorMessageHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<DeviceEmulatorMessageHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(DeviceEmulatorMessageHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/first_run/first_run_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/first_run/first_run_handler.cc
index d05e0369f39..46afde2fa0d 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/first_run/first_run_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/first_run/first_run_handler.cc
@@ -6,7 +6,7 @@
#include <utility>
-#include "ash/public/interfaces/voice_interaction_controller.mojom.h"
+#include "ash/public/mojom/voice_interaction_controller.mojom.h"
#include "base/bind.h"
#include "base/values.h"
#include "chrome/browser/chromeos/assistant/assistant_util.h"
diff --git a/chromium/chrome/browser/ui/webui/chromeos/first_run/first_run_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/first_run/first_run_ui.cc
index 912347ea86e..a58bf9524c5 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/first_run/first_run_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/first_run/first_run_ui.cc
@@ -86,7 +86,7 @@ void SetLocalizedStrings(Profile* profile,
content::WebUIDataSource* CreateDataSource(Profile* profile) {
content::WebUIDataSource* source =
content::WebUIDataSource::Create(chrome::kChromeUIFirstRunHost);
- source->SetJsonPath("strings.js");
+ source->UseStringsJs();
source->SetDefaultResource(IDR_FIRST_RUN_HTML);
source->AddResourcePath(kFirstRunJSPath, IDR_FIRST_RUN_JS);
base::DictionaryValue localized_strings;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/image_source.cc b/chromium/chrome/browser/ui/webui/chromeos/image_source.cc
index d5942fc36e6..1a9ff112dda 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/image_source.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/image_source.cc
@@ -16,7 +16,7 @@
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/task/post_task.h"
-#include "base/task/thread_pool/thread_pool.h"
+#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/chromeos/login/users/avatar/user_image_loader.h"
#include "chrome/common/url_constants.h"
@@ -40,9 +40,9 @@ void ImageLoaded(
} // namespace
-ImageSource::ImageSource() : weak_factory_(this) {
- task_runner_ = base::CreateSequencedTaskRunnerWithTraits(
- {base::MayBlock(), base::TaskPriority::USER_VISIBLE,
+ImageSource::ImageSource() {
+ task_runner_ = base::CreateSequencedTaskRunner(
+ {base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE,
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN});
}
@@ -55,7 +55,7 @@ std::string ImageSource::GetSource() {
void ImageSource::StartDataRequest(
const std::string& path,
- const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
+ const content::WebContents::Getter& wc_getter,
const content::URLDataSource::GotDataCallback& got_data_callback) {
if (!IsWhitelisted(path)) {
got_data_callback.Run(nullptr);
@@ -64,8 +64,9 @@ void ImageSource::StartDataRequest(
const base::FilePath asset_dir(chrome::kChromeOSAssetPath);
const base::FilePath image_path = asset_dir.AppendASCII(path);
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
+ base::PostTaskAndReplyWithResult(
+ FROM_HERE,
+ {base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE},
base::Bind(&base::PathExists, image_path),
base::Bind(&ImageSource::StartDataRequestAfterPathExists,
weak_factory_.GetWeakPtr(), image_path, got_data_callback));
diff --git a/chromium/chrome/browser/ui/webui/chromeos/image_source.h b/chromium/chrome/browser/ui/webui/chromeos/image_source.h
index 5d7a5afcec0..4bf09ea101a 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/image_source.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/image_source.h
@@ -27,11 +27,10 @@ class ImageSource : public content::URLDataSource {
// content::URLDataSource implementation.
std::string GetSource() override;
- void StartDataRequest(
- const std::string& path,
- const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
- const content::URLDataSource::GotDataCallback& got_data_callback)
- override;
+ void StartDataRequest(const std::string& path,
+ const content::WebContents::Getter& wc_getter,
+ const content::URLDataSource::GotDataCallback&
+ got_data_callback) override;
std::string GetMimeType(const std::string& path) override;
@@ -48,7 +47,7 @@ class ImageSource : public content::URLDataSource {
// The background task runner on which file I/O and image decoding are done.
scoped_refptr<base::SequencedTaskRunner> task_runner_;
- base::WeakPtrFactory<ImageSource> weak_factory_;
+ base::WeakPtrFactory<ImageSource> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ImageSource);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/confirm_password_change_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/confirm_password_change_handler.cc
index e46a6eabfa8..b95907fe477 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/confirm_password_change_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/confirm_password_change_handler.cc
@@ -19,7 +19,29 @@
namespace chromeos {
-ConfirmPasswordChangeHandler::ConfirmPasswordChangeHandler() {
+namespace {
+
+const InSessionPasswordChangeManager::Event kIncorrectPasswordEvent =
+ InSessionPasswordChangeManager::Event::CRYPTOHOME_PASSWORD_CHANGE_FAILURE;
+
+const InSessionPasswordChangeManager::PasswordSource kPasswordSource =
+ InSessionPasswordChangeManager::PasswordSource::PASSWORDS_RETYPED;
+
+// Returns one if it is non-empty, otherwise returns two.
+const std::string& FirstNonEmpty(const std::string& one,
+ const std::string& two) {
+ return !one.empty() ? one : two;
+}
+
+} // namespace
+
+ConfirmPasswordChangeHandler::ConfirmPasswordChangeHandler(
+ const std::string& scraped_old_password,
+ const std::string& scraped_new_password,
+ const bool show_spinner_initially)
+ : scraped_old_password_(scraped_old_password),
+ scraped_new_password_(scraped_new_password),
+ show_spinner_initially_(show_spinner_initially) {
if (InSessionPasswordChangeManager::IsInitialized()) {
InSessionPasswordChangeManager::Get()->AddObserver(this);
}
@@ -31,25 +53,52 @@ ConfirmPasswordChangeHandler::~ConfirmPasswordChangeHandler() {
}
}
-void ConfirmPasswordChangeHandler::OnEvent(
- InSessionPasswordChangeManager::Event event) {
- if (event ==
- InSessionPasswordChangeManager::CRYPTOHOME_PASSWORD_CHANGE_FAILURE) {
- AllowJavascript();
- FireWebUIListener("incorrect-old-password");
- }
+void ConfirmPasswordChangeHandler::HandleGetInitialState(
+ const base::ListValue* params) {
+ const std::string callback_id = params->GetList()[0].GetString();
+
+ base::Value state(base::Value::Type::DICTIONARY);
+ state.SetBoolKey("showOldPasswordPrompt", scraped_old_password_.empty());
+ state.SetBoolKey("showNewPasswordPrompt", scraped_new_password_.empty());
+ state.SetBoolKey("showSpinner", show_spinner_initially_);
+
+ AllowJavascript();
+ ResolveJavascriptCallback(base::Value(callback_id), state);
}
void ConfirmPasswordChangeHandler::HandleChangePassword(
const base::ListValue* params) {
- const std::string old_password = params->GetList()[0].GetString();
- const std::string new_password = params->GetList()[1].GetString();
- InSessionPasswordChangeManager::Get()->ChangePassword(old_password,
- new_password);
+ const std::string old_password =
+ FirstNonEmpty(params->GetList()[0].GetString(), scraped_old_password_);
+ const std::string new_password =
+ FirstNonEmpty(params->GetList()[1].GetString(), scraped_new_password_);
+ DCHECK(!old_password.empty() && !new_password.empty());
+
+ InSessionPasswordChangeManager::Get()->ChangePassword(
+ old_password, new_password, kPasswordSource);
+}
+
+void ConfirmPasswordChangeHandler::OnEvent(
+ InSessionPasswordChangeManager::Event event) {
+ if (event == kIncorrectPasswordEvent) {
+ // If this event comes before getInitialState, then don't show the spinner
+ // initially after all - the initial password change attempt using scraped
+ // passwords already failed before the dialog finished loading.
+ show_spinner_initially_ = false;
+ // Discard the scraped old password and ask the user what it really is.
+ scraped_old_password_.clear();
+ if (IsJavascriptAllowed()) {
+ FireWebUIListener("incorrect-old-password");
+ }
+ }
}
void ConfirmPasswordChangeHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback(
+ "getInitialState",
+ base::BindRepeating(&ConfirmPasswordChangeHandler::HandleGetInitialState,
+ weak_factory_.GetWeakPtr()));
+ web_ui()->RegisterMessageCallback(
"changePassword",
base::BindRepeating(&ConfirmPasswordChangeHandler::HandleChangePassword,
weak_factory_.GetWeakPtr()));
diff --git a/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/confirm_password_change_handler.h b/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/confirm_password_change_handler.h
index 7a69e7c624e..f3104499174 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/confirm_password_change_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/confirm_password_change_handler.h
@@ -16,9 +16,14 @@ class ConfirmPasswordChangeHandler
: public content::WebUIMessageHandler,
public InSessionPasswordChangeManager::Observer {
public:
- ConfirmPasswordChangeHandler();
+ ConfirmPasswordChangeHandler(const std::string& scraped_old_password,
+ const std::string& scraped_new_password,
+ const bool show_spinner_initially);
~ConfirmPasswordChangeHandler() override;
+ // Called by the JS UI to find out what to show and what size to be.
+ void HandleGetInitialState(const base::ListValue* params);
+
// Tries to change the cryptohome password once the confirm-password-change
// dialog is filled in and the password change is confirmed.
void HandleChangePassword(const base::ListValue* passwords);
@@ -30,6 +35,10 @@ class ConfirmPasswordChangeHandler
void RegisterMessages() override;
private:
+ std::string scraped_old_password_;
+ std::string scraped_new_password_;
+ bool show_spinner_initially_ = false;
+
base::WeakPtrFactory<ConfirmPasswordChangeHandler> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ConfirmPasswordChangeHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_dialogs.cc b/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_dialogs.cc
new file mode 100644
index 00000000000..bba646a609d
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_dialogs.cc
@@ -0,0 +1,201 @@
+// 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/chromeos/in_session_password_change/password_change_dialogs.h"
+
+#include <memory>
+
+#include "base/bind.h"
+#include "base/json/json_writer.h"
+#include "chrome/browser/ui/webui/chromeos/in_session_password_change/confirm_password_change_handler.h"
+#include "chrome/common/webui_url_constants.h"
+#include "chrome/grit/browser_resources.h"
+#include "chrome/grit/generated_resources.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/web_ui_data_source.h"
+#include "ui/display/display.h"
+#include "ui/display/screen.h"
+#include "ui/strings/grit/ui_strings.h"
+
+namespace chromeos {
+
+namespace {
+
+PasswordChangeDialog* g_dialog = nullptr;
+
+ConfirmPasswordChangeDialog* g_confirm_dialog = nullptr;
+
+UrgentPasswordExpiryNotificationDialog* g_notification_dialog = nullptr;
+
+constexpr gfx::Size kPasswordChangeSize(768, 640);
+
+constexpr gfx::Size kUrgentPasswordExpiryNotificationSize = kPasswordChangeSize;
+
+// The size of the confirm password change UI depends on which passwords were
+// scraped and which ones we need to prompt for:
+constexpr int kConfirmPasswordsWidth = 520;
+constexpr int kConfirmOldPasswordHeight = 230;
+constexpr int kConfirmNewPasswordHeight = 310;
+constexpr int kConfirmBothPasswordsHeight = 380;
+
+// Given a desired size, returns the same size if it fits on screen,
+// or the closest possible size that will fit on the screen.
+gfx::Size FitSizeToDisplay(const gfx::Size& desired) {
+ const display::Display display =
+ display::Screen::GetScreen()->GetPrimaryDisplay();
+
+ gfx::Size display_size = display.size();
+
+ if (display.rotation() == display::Display::ROTATE_90 ||
+ display.rotation() == display::Display::ROTATE_270) {
+ display_size = gfx::Size(display_size.height(), display_size.width());
+ }
+
+ return gfx::Size(std::min(desired.width(), display_size.width()),
+ std::min(desired.height(), display_size.height()));
+}
+
+} // namespace
+
+BasePasswordDialog::BasePasswordDialog(GURL url, gfx::Size desired_size)
+ : SystemWebDialogDelegate(url, /*title=*/base::string16()),
+ desired_size_(desired_size) {}
+
+BasePasswordDialog::~BasePasswordDialog() {}
+
+void BasePasswordDialog::GetDialogSize(gfx::Size* size) const {
+ *size = FitSizeToDisplay(desired_size_);
+}
+
+void BasePasswordDialog::AdjustWidgetInitParams(
+ views::Widget::InitParams* params) {
+ params->type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS;
+}
+
+ui::ModalType BasePasswordDialog::GetDialogModalType() const {
+ return ui::ModalType::MODAL_TYPE_SYSTEM;
+}
+
+// static
+void PasswordChangeDialog::Show() {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ if (g_dialog) {
+ g_dialog->Focus();
+ return;
+ }
+ g_dialog = new PasswordChangeDialog();
+ g_dialog->ShowSystemDialog();
+}
+
+// static
+void PasswordChangeDialog::Dismiss() {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ if (g_dialog)
+ g_dialog->Close();
+}
+
+PasswordChangeDialog::PasswordChangeDialog()
+ : BasePasswordDialog(GURL(chrome::kChromeUIPasswordChangeUrl),
+ kPasswordChangeSize) {}
+
+PasswordChangeDialog::~PasswordChangeDialog() {
+ DCHECK_EQ(this, g_dialog);
+ g_dialog = nullptr;
+}
+
+// static
+void ConfirmPasswordChangeDialog::Show(const std::string& scraped_old_password,
+ const std::string& scraped_new_password,
+ bool show_spinner_initially) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ if (g_confirm_dialog) {
+ g_confirm_dialog->Focus();
+ return;
+ }
+ g_confirm_dialog = new ConfirmPasswordChangeDialog(
+ scraped_old_password, scraped_new_password, show_spinner_initially);
+ g_confirm_dialog->ShowSystemDialog();
+}
+
+// static
+void ConfirmPasswordChangeDialog::Dismiss() {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ if (g_confirm_dialog)
+ g_confirm_dialog->Close();
+}
+
+ConfirmPasswordChangeDialog::ConfirmPasswordChangeDialog(
+ const std::string& scraped_old_password,
+ const std::string& scraped_new_password,
+ bool show_spinner_initially)
+ : BasePasswordDialog(
+ GURL(chrome::kChromeUIConfirmPasswordChangeUrl),
+ GetSize(scraped_old_password.empty(), scraped_new_password.empty())),
+ scraped_old_password_(scraped_old_password),
+ scraped_new_password_(scraped_new_password),
+ show_spinner_initially_(show_spinner_initially) {}
+
+ConfirmPasswordChangeDialog::~ConfirmPasswordChangeDialog() {
+ DCHECK_EQ(this, g_confirm_dialog);
+ g_confirm_dialog = nullptr;
+}
+
+// static
+gfx::Size ConfirmPasswordChangeDialog::GetSize(
+ const bool show_old_password_prompt,
+ const bool show_new_password_prompt) {
+ const int desired_width = kConfirmPasswordsWidth;
+ if (show_old_password_prompt && show_new_password_prompt) {
+ return gfx::Size(desired_width, kConfirmBothPasswordsHeight);
+ }
+ if (show_new_password_prompt) {
+ return gfx::Size(desired_width, kConfirmNewPasswordHeight);
+ }
+ // Use the same size for these two cases:
+ // 1) We scraped new password, but not old, so we need to prompt for that.
+ // 2) We scraped both passwords, so we don't need to prompt for anything.
+
+ // In case 2, we need to show a spinner. That spinner could be any size, so
+ // we size it the same as in case 1, because there is a chance that the
+ // scraped password will be wrong and so we will need to show the old password
+ // prompt. So it looks best if the dialog is already the right size.
+ return gfx::Size(desired_width, kConfirmOldPasswordHeight);
+}
+
+void ConfirmPasswordChangeDialog::GetWebUIMessageHandlers(
+ std::vector<content::WebUIMessageHandler*>* handlers) const {
+ handlers->push_back(new ConfirmPasswordChangeHandler(
+ scraped_old_password_, scraped_new_password_, show_spinner_initially_));
+}
+
+// static
+void UrgentPasswordExpiryNotificationDialog::Show() {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ if (g_notification_dialog) {
+ g_notification_dialog->Focus();
+ return;
+ }
+ g_notification_dialog = new UrgentPasswordExpiryNotificationDialog();
+ g_notification_dialog->ShowSystemDialog();
+}
+
+// static
+void UrgentPasswordExpiryNotificationDialog::Dismiss() {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ if (g_notification_dialog)
+ g_notification_dialog->Close();
+}
+
+UrgentPasswordExpiryNotificationDialog::UrgentPasswordExpiryNotificationDialog()
+ : BasePasswordDialog(
+ GURL(chrome::kChromeUIUrgentPasswordExpiryNotificationUrl),
+ kUrgentPasswordExpiryNotificationSize) {}
+
+UrgentPasswordExpiryNotificationDialog::
+ ~UrgentPasswordExpiryNotificationDialog() {
+ DCHECK_EQ(this, g_notification_dialog);
+ g_notification_dialog = nullptr;
+}
+
+} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_dialogs.h b/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_dialogs.h
new file mode 100644
index 00000000000..d8c2b144e2c
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_dialogs.h
@@ -0,0 +1,92 @@
+// 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_CHROMEOS_IN_SESSION_PASSWORD_CHANGE_PASSWORD_CHANGE_DIALOGS_H_
+#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_IN_SESSION_PASSWORD_CHANGE_PASSWORD_CHANGE_DIALOGS_H_
+
+#include "base/macros.h"
+#include "base/strings/string16.h"
+#include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h"
+#include "ui/web_dialogs/web_dialog_ui.h"
+
+namespace chromeos {
+
+// A modal system dialog without any frame decorating it.
+class BasePasswordDialog : public SystemWebDialogDelegate {
+ protected:
+ BasePasswordDialog(GURL url, gfx::Size desired_size);
+ ~BasePasswordDialog() override;
+
+ // ui::WebDialogDelegate:
+ void GetDialogSize(gfx::Size* size) const override;
+ void AdjustWidgetInitParams(views::Widget::InitParams* params) override;
+ ui::ModalType GetDialogModalType() const override;
+
+ private:
+ gfx::Size desired_size_;
+
+ DISALLOW_COPY_AND_ASSIGN(BasePasswordDialog);
+};
+
+// System dialog wrapping chrome:://password-change
+class PasswordChangeDialog : public BasePasswordDialog {
+ public:
+ static void Show();
+ static void Dismiss();
+
+ protected:
+ PasswordChangeDialog();
+ ~PasswordChangeDialog() override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PasswordChangeDialog);
+};
+
+// System dialog wrapping chrome://confirm-password-change
+class ConfirmPasswordChangeDialog : public BasePasswordDialog {
+ public:
+ static void Show(const std::string& scraped_old_password,
+ const std::string& scraped_new_password,
+ bool show_spinner_initially);
+ static void Dismiss();
+
+ // How big does this dialog need to be to show these prompts:
+ static gfx::Size GetSize(bool show_old_password_prompt,
+ bool show_new_password_prompt);
+
+ protected:
+ ConfirmPasswordChangeDialog(const std::string& scraped_old_password,
+ const std::string& scraped_new_password,
+ bool show_spinner_initially);
+ ~ConfirmPasswordChangeDialog() override;
+
+ // ui::WebDialogDelegate:
+ void GetWebUIMessageHandlers(
+ std::vector<content::WebUIMessageHandler*>* handlers) const override;
+
+ private:
+ std::string scraped_old_password_;
+ std::string scraped_new_password_;
+ bool show_spinner_initially_ = false;
+
+ DISALLOW_COPY_AND_ASSIGN(ConfirmPasswordChangeDialog);
+};
+
+// System dialog wrapping chrome://urgent-password-expiry-notification
+class UrgentPasswordExpiryNotificationDialog : public BasePasswordDialog {
+ public:
+ static void Show();
+ static void Dismiss();
+
+ protected:
+ UrgentPasswordExpiryNotificationDialog();
+ ~UrgentPasswordExpiryNotificationDialog() override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UrgentPasswordExpiryNotificationDialog);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_IN_SESSION_PASSWORD_CHANGE_PASSWORD_CHANGE_DIALOGS_H_
diff --git a/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_ui.cc
index 8b85995d13c..04a7c285025 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_ui.cc
@@ -13,7 +13,7 @@
#include "chrome/browser/chromeos/login/saml/password_expiry_notification.h"
#include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/webui/chromeos/in_session_password_change/confirm_password_change_handler.h"
+#include "chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_dialogs.h"
#include "chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_handler.h"
#include "chrome/browser/ui/webui/chromeos/in_session_password_change/urgent_password_expiry_notification_handler.h"
#include "chrome/browser/ui/webui/localized_string.h"
@@ -38,12 +38,6 @@ namespace chromeos {
namespace {
-PasswordChangeDialog* g_dialog = nullptr;
-
-ConfirmPasswordChangeDialog* g_confirm_dialog = nullptr;
-
-UrgentPasswordExpiryNotificationDialog* g_notification_dialog = nullptr;
-
std::string GetPasswordChangeUrl(Profile* profile) {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kSamlPasswordChangeUrl)) {
@@ -73,79 +67,15 @@ base::string16 GetHostedHeaderText(const std::string& password_change_url) {
host);
}
-constexpr int kMaxPasswordChangeDialogWidth = 768;
-constexpr int kMaxPasswordChangeDialogHeight = 640;
-
-// TODO(https://crbug.com/930109): Change these numbers depending on what is
-// shown in the dialog.
-constexpr int kMaxConfirmPasswordChangeDialogWidth = 520;
-constexpr int kMaxConfirmPasswordChangeDialogHeight = 380;
-
-constexpr int kMaxNotificationDialogWidth = 768;
-constexpr int kMaxNotificationDialogHeight = 640;
-
-// Given a desired width and height, returns the same size if it fits on screen,
-// or the closest possible size that will fit on the screen.
-gfx::Size FitSizeToDisplay(int max_width, int max_height) {
- const display::Display display =
- display::Screen::GetScreen()->GetPrimaryDisplay();
-
- gfx::Size display_size = display.size();
-
- if (display.rotation() == display::Display::ROTATE_90 ||
- display.rotation() == display::Display::ROTATE_270) {
- display_size = gfx::Size(display_size.height(), display_size.width());
- }
-
- display_size = gfx::Size(std::min(display_size.width(), max_width),
- std::min(display_size.height(), max_height));
-
- return display_size;
+void AddSize(content::WebUIDataSource* source,
+ const std::string& suffix,
+ const gfx::Size& size) {
+ source->AddInteger("width" + suffix, size.width());
+ source->AddInteger("height" + suffix, size.height());
}
} // namespace
-PasswordChangeDialog::PasswordChangeDialog()
- : SystemWebDialogDelegate(GURL(chrome::kChromeUIPasswordChangeUrl),
- /*title=*/base::string16()) {}
-
-PasswordChangeDialog::~PasswordChangeDialog() {
- DCHECK_EQ(this, g_dialog);
- g_dialog = nullptr;
-}
-
-void PasswordChangeDialog::GetDialogSize(gfx::Size* size) const {
- *size = FitSizeToDisplay(kMaxPasswordChangeDialogWidth,
- kMaxPasswordChangeDialogHeight);
-}
-
-void PasswordChangeDialog::AdjustWidgetInitParams(
- views::Widget::InitParams* params) {
- params->type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS;
-}
-
-ui::ModalType PasswordChangeDialog::GetDialogModalType() const {
- return ui::ModalType::MODAL_TYPE_SYSTEM;
-}
-
-// static
-void PasswordChangeDialog::Show() {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (g_dialog) {
- g_dialog->Focus();
- return;
- }
- g_dialog = new PasswordChangeDialog();
- g_dialog->ShowSystemDialog();
-}
-
-// static
-void PasswordChangeDialog::Dismiss() {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (g_dialog)
- g_dialog->Close();
-}
-
PasswordChangeUI::PasswordChangeUI(content::WebUI* web_ui)
: ui::WebDialogUI(web_ui) {
Profile* profile = Profile::FromWebUI(web_ui);
@@ -159,7 +89,7 @@ PasswordChangeUI::PasswordChangeUI(content::WebUI* web_ui)
std::make_unique<PasswordChangeHandler>(password_change_url));
source->AddString("hostedHeader", GetHostedHeaderText(password_change_url));
- source->SetJsonPath("strings.js");
+ source->UseStringsJs();
source->SetDefaultResource(IDR_PASSWORD_CHANGE_HTML);
@@ -173,66 +103,6 @@ PasswordChangeUI::PasswordChangeUI(content::WebUI* web_ui)
PasswordChangeUI::~PasswordChangeUI() = default;
-// static
-void ConfirmPasswordChangeDialog::Show(const std::string& scraped_old_password,
- const std::string& scraped_new_password,
- bool show_spinner_initially) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (g_confirm_dialog) {
- g_confirm_dialog->Focus();
- return;
- }
- g_confirm_dialog = new ConfirmPasswordChangeDialog(
- scraped_old_password, scraped_new_password, show_spinner_initially);
- g_confirm_dialog->ShowSystemDialog();
-}
-
-// static
-void ConfirmPasswordChangeDialog::Dismiss() {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (g_confirm_dialog)
- g_confirm_dialog->Close();
-}
-
-ConfirmPasswordChangeDialog::ConfirmPasswordChangeDialog(
- const std::string& scraped_old_password,
- const std::string& scraped_new_password,
- bool show_spinner_initially)
- : SystemWebDialogDelegate(GURL(chrome::kChromeUIConfirmPasswordChangeUrl),
- /*title=*/base::string16()),
- scraped_old_password_(scraped_old_password),
- scraped_new_password_(scraped_new_password),
- show_spinner_initially_(show_spinner_initially) {}
-
-ConfirmPasswordChangeDialog::~ConfirmPasswordChangeDialog() {
- DCHECK_EQ(this, g_confirm_dialog);
- g_confirm_dialog = nullptr;
-}
-
-void ConfirmPasswordChangeDialog::GetDialogSize(gfx::Size* size) const {
- *size = FitSizeToDisplay(kMaxConfirmPasswordChangeDialogWidth,
- kMaxConfirmPasswordChangeDialogHeight);
-}
-
-std::string ConfirmPasswordChangeDialog::GetDialogArgs() const {
- // TODO(https://crbug.com/930109): Configure the embedded UI to only display
- // prompts for the passwords that were not scraped.
- std::string data;
- base::DictionaryValue dialog_args;
- dialog_args.SetBoolean("showSpinnerInitially", show_spinner_initially_);
- base::JSONWriter::Write(dialog_args, &data);
- return data;
-}
-
-void ConfirmPasswordChangeDialog::AdjustWidgetInitParams(
- views::Widget::InitParams* params) {
- params->type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS;
-}
-
-ui::ModalType ConfirmPasswordChangeDialog::GetDialogModalType() const {
- return ui::ModalType::MODAL_TYPE_SYSTEM;
-}
-
ConfirmPasswordChangeUI::ConfirmPasswordChangeUI(content::WebUI* web_ui)
: ui::WebDialogUI(web_ui) {
Profile* profile = Profile::FromWebUI(web_ui);
@@ -252,69 +122,31 @@ ConfirmPasswordChangeUI::ConfirmPasswordChangeUI(content::WebUI* web_ui)
{"oldPassword", IDS_PASSWORD_CHANGE_OLD_PASSWORD_LABEL},
{"newPassword", IDS_PASSWORD_CHANGE_NEW_PASSWORD_LABEL},
{"confirmNewPassword", IDS_PASSWORD_CHANGE_CONFIRM_NEW_PASSWORD_LABEL},
+ {"incorrectPassword", IDS_LOGIN_CONFIRM_PASSWORD_INCORRECT_PASSWORD},
{"matchError", IDS_PASSWORD_CHANGE_PASSWORDS_DONT_MATCH},
{"save", IDS_PASSWORD_CHANGE_CONFIRM_SAVE_BUTTON}};
AddLocalizedStringsBulk(source, kLocalizedStrings,
base::size(kLocalizedStrings));
- source->SetJsonPath("strings.js");
+ AddSize(source, "", ConfirmPasswordChangeDialog::GetSize(false, false));
+ AddSize(source, "Old", ConfirmPasswordChangeDialog::GetSize(true, false));
+ AddSize(source, "New", ConfirmPasswordChangeDialog::GetSize(false, true));
+ AddSize(source, "OldNew", ConfirmPasswordChangeDialog::GetSize(true, true));
+
+ source->UseStringsJs();
source->SetDefaultResource(IDR_CONFIRM_PASSWORD_CHANGE_HTML);
source->AddResourcePath("confirm_password_change.js",
IDR_CONFIRM_PASSWORD_CHANGE_JS);
- web_ui->AddMessageHandler(std::make_unique<ConfirmPasswordChangeHandler>());
+ // The ConfirmPasswordChangeHandler is added by the dialog, so no need to add
+ // it here.
content::WebUIDataSource::Add(profile, source);
}
ConfirmPasswordChangeUI::~ConfirmPasswordChangeUI() = default;
-UrgentPasswordExpiryNotificationDialog::UrgentPasswordExpiryNotificationDialog()
- : SystemWebDialogDelegate(
- GURL(chrome::kChromeUIUrgentPasswordExpiryNotificationUrl),
- /*title=*/base::string16()) {}
-
-UrgentPasswordExpiryNotificationDialog::
- ~UrgentPasswordExpiryNotificationDialog() {
- DCHECK_EQ(this, g_notification_dialog);
- g_notification_dialog = nullptr;
-}
-
-void UrgentPasswordExpiryNotificationDialog::GetDialogSize(
- gfx::Size* size) const {
- *size = FitSizeToDisplay(kMaxNotificationDialogWidth,
- kMaxNotificationDialogHeight);
-}
-
-void UrgentPasswordExpiryNotificationDialog::AdjustWidgetInitParams(
- views::Widget::InitParams* params) {
- params->type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS;
-}
-
-ui::ModalType UrgentPasswordExpiryNotificationDialog::GetDialogModalType()
- const {
- return ui::ModalType::MODAL_TYPE_SYSTEM;
-}
-
-// static
-void UrgentPasswordExpiryNotificationDialog::Show() {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (g_notification_dialog) {
- g_notification_dialog->Focus();
- return;
- }
- g_notification_dialog = new UrgentPasswordExpiryNotificationDialog();
- g_notification_dialog->ShowSystemDialog();
-}
-
-// static
-void UrgentPasswordExpiryNotificationDialog::Dismiss() {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (g_notification_dialog)
- g_notification_dialog->Close();
-}
-
UrgentPasswordExpiryNotificationUI::UrgentPasswordExpiryNotificationUI(
content::WebUI* web_ui)
: ui::WebDialogUI(web_ui) {
@@ -340,7 +172,7 @@ UrgentPasswordExpiryNotificationUI::UrgentPasswordExpiryNotificationUI(
AddLocalizedStringsBulk(source, kLocalizedStrings,
base::size(kLocalizedStrings));
- source->SetJsonPath("strings.js");
+ source->UseStringsJs();
source->SetDefaultResource(IDR_URGENT_PASSWORD_EXPIRY_NOTIFICATION_HTML);
source->AddResourcePath("urgent_password_expiry_notification.js",
IDR_URGENT_PASSWORD_EXPIRY_NOTIFICATION_JS);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_ui.h b/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_ui.h
index d1b2cb7e877..b8d19af17e1 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_ui.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_ui.h
@@ -12,25 +12,6 @@
namespace chromeos {
-// System dialog wrapping chrome:://password-change
-class PasswordChangeDialog : public SystemWebDialogDelegate {
- public:
- static void Show();
- static void Dismiss();
-
- protected:
- PasswordChangeDialog();
- ~PasswordChangeDialog() override;
-
- // ui::WebDialogDelegate:
- void GetDialogSize(gfx::Size* size) const override;
- void AdjustWidgetInitParams(views::Widget::InitParams* params) override;
- ui::ModalType GetDialogModalType() const override;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(PasswordChangeDialog);
-};
-
// For chrome:://password-change
class PasswordChangeUI : public ui::WebDialogUI {
public:
@@ -41,34 +22,6 @@ class PasswordChangeUI : public ui::WebDialogUI {
DISALLOW_COPY_AND_ASSIGN(PasswordChangeUI);
};
-// System dialog wrapping chrome://confirm-password-change
-class ConfirmPasswordChangeDialog : public SystemWebDialogDelegate {
- public:
- static void Show(const std::string& scraped_old_password,
- const std::string& scraped_new_password,
- bool show_spinner_initially);
- static void Dismiss();
-
- protected:
- ConfirmPasswordChangeDialog(const std::string& scraped_old_password,
- const std::string& scraped_new_password,
- bool show_spinner_initially);
- ~ConfirmPasswordChangeDialog() override;
-
- // ui::WebDialogDelegate:
- void GetDialogSize(gfx::Size* size) const override;
- std::string GetDialogArgs() const override;
- void AdjustWidgetInitParams(views::Widget::InitParams* params) override;
- ui::ModalType GetDialogModalType() const override;
-
- private:
- std::string scraped_old_password_;
- std::string scraped_new_password_;
- bool show_spinner_initially_ = false;
-
- DISALLOW_COPY_AND_ASSIGN(ConfirmPasswordChangeDialog);
-};
-
// For chrome:://confirm-password-change
class ConfirmPasswordChangeUI : public ui::WebDialogUI {
public:
@@ -79,25 +32,6 @@ class ConfirmPasswordChangeUI : public ui::WebDialogUI {
DISALLOW_COPY_AND_ASSIGN(ConfirmPasswordChangeUI);
};
-// System dialog wrapping chrome://urgent-password-expiry-notification
-class UrgentPasswordExpiryNotificationDialog : public SystemWebDialogDelegate {
- public:
- static void Show();
- static void Dismiss();
-
- protected:
- UrgentPasswordExpiryNotificationDialog();
- ~UrgentPasswordExpiryNotificationDialog() override;
-
- // ui::WebDialogDelegate:
- void GetDialogSize(gfx::Size* size) const override;
- void AdjustWidgetInitParams(views::Widget::InitParams* params) override;
- ui::ModalType GetDialogModalType() const override;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(UrgentPasswordExpiryNotificationDialog);
-};
-
// For chrome:://urgent-password-expiry-notification
class UrgentPasswordExpiryNotificationUI : public ui::WebDialogUI {
public:
diff --git a/chromium/chrome/browser/ui/webui/chromeos/internet_config_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/internet_config_dialog.cc
index 24c46c4c6c8..4d8cca34874 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/internet_config_dialog.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/internet_config_dialog.cc
@@ -142,7 +142,7 @@ InternetConfigDialogUI::InternetConfigDialogUI(content::WebUI* web_ui)
AddInternetStrings(source);
source->AddLocalizedString("title", IDS_SETTINGS_INTERNET_CONFIG);
- source->SetJsonPath("strings.js");
+ source->UseStringsJs();
#if BUILDFLAG(OPTIMIZE_WEBUI)
source->SetDefaultResource(IDR_INTERNET_CONFIG_DIALOG_VULCANIZED_HTML);
source->AddResourcePath("crisper.js", IDR_INTERNET_CONFIG_DIALOG_CRISPER_JS);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/internet_detail_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/internet_detail_dialog.cc
index b1faef7f2de..2489cb2e124 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/internet_detail_dialog.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/internet_detail_dialog.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/webui/chromeos/internet_detail_dialog.h"
#include "ash/public/cpp/ash_features.h"
+#include "ash/public/cpp/network_config_service.h"
#include "base/json/json_writer.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
@@ -16,11 +17,9 @@
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "chromeos/network/network_util.h"
-#include "chromeos/services/network_config/public/mojom/constants.mojom.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
-#include "services/service_manager/public/cpp/connector.h"
#include "ui/base/l10n/l10n_util.h"
namespace chromeos {
@@ -142,7 +141,7 @@ InternetDetailDialogUI::InternetDetailDialogUI(content::WebUI* web_ui)
!ash::features::IsSeparateNetworkIconsEnabled());
AddInternetStrings(source);
source->AddLocalizedString("title", IDS_SETTINGS_INTERNET_DETAIL);
- source->SetJsonPath("strings.js");
+ source->UseStringsJs();
#if BUILDFLAG(OPTIMIZE_WEBUI)
source->SetDefaultResource(IDR_INTERNET_DETAIL_DIALOG_VULCANIZED_HTML);
source->AddResourcePath("crisper.js", IDR_INTERNET_DETAIL_DIALOG_CRISPER_JS);
@@ -162,10 +161,7 @@ InternetDetailDialogUI::~InternetDetailDialogUI() {}
void InternetDetailDialogUI::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));
}
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.cc
index a31ce2c2566..f2882ee9ec6 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.cc
@@ -42,9 +42,7 @@ ActiveDirectoryPasswordChangeScreenHandler::
: BaseScreenHandler(OobeScreen::SCREEN_ACTIVE_DIRECTORY_PASSWORD_CHANGE,
js_calls_container),
authpolicy_login_helper_(std::make_unique<AuthPolicyHelper>()),
- core_oobe_view_(core_oobe_view),
- weak_factory_(this) {
-}
+ core_oobe_view_(core_oobe_view) {}
ActiveDirectoryPasswordChangeScreenHandler::
~ActiveDirectoryPasswordChangeScreenHandler() {}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.h
index 74b41552268..8768175e503 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.h
@@ -65,7 +65,7 @@ class ActiveDirectoryPasswordChangeScreenHandler : public BaseScreenHandler {
CoreOobeView* core_oobe_view_ = nullptr;
base::WeakPtrFactory<ActiveDirectoryPasswordChangeScreenHandler>
- weak_factory_;
+ weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ActiveDirectoryPasswordChangeScreenHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.cc
index 29601c934c8..e6b65a80a77 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.cc
@@ -294,8 +294,8 @@ void ArcTermsOfServiceScreenHandler::DoShow() {
MaybeLoadPlayStoreToS(true);
StartNetworkAndTimeZoneObserving();
- pref_handler_.reset(new arc::ArcOptInPreferenceHandler(
- this, profile->GetPrefs()));
+ pref_handler_ = std::make_unique<arc::ArcOptInPreferenceHandler>(
+ this, profile->GetPrefs());
pref_handler_->Start();
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.cc
index 622537cfdff..f53cede13a4 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.cc
@@ -15,17 +15,16 @@
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/ui/ash/assistant/assistant_service_connection.h"
#include "chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_utils.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/services/assistant/public/cpp/assistant_prefs.h"
#include "chromeos/services/assistant/public/features.h"
-#include "chromeos/services/assistant/public/mojom/constants.mojom.h"
#include "chromeos/services/assistant/public/proto/settings_ui.pb.h"
-#include "components/arc/arc_prefs.h"
#include "components/login/localized_values_builder.h"
#include "components/prefs/pref_service.h"
#include "components/user_manager/user_manager.h"
-#include "services/service_manager/public/cpp/connector.h"
+#include "ui/chromeos/devicetype_utils.h"
namespace chromeos {
@@ -50,13 +49,13 @@ constexpr StaticOobeScreenId AssistantOptInFlowScreenView::kScreenId;
AssistantOptInFlowScreenHandler::AssistantOptInFlowScreenHandler(
JSCallsContainer* js_calls_container)
- : BaseScreenHandler(kScreenId, js_calls_container),
- client_binding_(this),
- weak_factory_(this) {
+ : BaseScreenHandler(kScreenId, js_calls_container), client_binding_(this) {
set_user_acted_method_path("login.AssistantOptInFlowScreen.userActed");
}
AssistantOptInFlowScreenHandler::~AssistantOptInFlowScreenHandler() {
+ if (client_binding_)
+ StopSpeakerIdEnrollment();
if (arc::VoiceInteractionControllerClient::Get()) {
arc::VoiceInteractionControllerClient::Get()->RemoveObserver(this);
}
@@ -113,10 +112,13 @@ void AssistantOptInFlowScreenHandler::DeclareLocalizedValues(
builder->Add("assistantOptinSaveButton", IDS_ASSISTANT_SAVE_BUTTON);
builder->Add("assistantOptinWaitMessage", IDS_ASSISTANT_WAIT_MESSAGE);
builder->Add("assistantReadyTitle", IDS_ASSISTANT_READY_SCREEN_TITLE);
- builder->Add("assistantReadyMessage", IDS_ASSISTANT_READY_SCREEN_MESSAGE);
+ builder->AddF("assistantReadyMessage", IDS_ASSISTANT_READY_SCREEN_MESSAGE,
+ ui::GetChromeOSDeviceName());
builder->Add("assistantReadyButton", IDS_ASSISTANT_DONE_BUTTON);
builder->Add("back", IDS_EULA_BACK_BUTTON);
builder->Add("next", IDS_EULA_NEXT_BUTTON);
+ builder->Add("assistantOobePopupOverlayLoading",
+ IDS_ASSISTANT_OOBE_POPUP_OVERLAY_LOADING);
}
void AssistantOptInFlowScreenHandler::RegisterMessages() {
@@ -214,7 +216,7 @@ void AssistantOptInFlowScreenHandler::SetupAssistantConnection() {
}
// Make sure enable Assistant service since we need it during the flow.
- prefs->SetBoolean(arc::prefs::kVoiceInteractionEnabled, true);
+ prefs->SetBoolean(chromeos::assistant::prefs::kAssistantEnabled, true);
if (arc::VoiceInteractionControllerClient::Get()->voice_interaction_state() ==
ash::mojom::VoiceInteractionState::NOT_READY) {
@@ -266,7 +268,7 @@ void AssistantOptInFlowScreenHandler::OnDialogClosed() {
if (!voice_match_enrollment_done_ &&
flow_type_ == ash::FlowType::kSpeakerIdEnrollment) {
ProfileManager::GetActiveUserProfile()->GetPrefs()->SetBoolean(
- arc::prefs::kVoiceInteractionHotwordEnabled, false);
+ assistant::prefs::kAssistantHotwordEnabled, false);
}
}
@@ -283,11 +285,10 @@ void AssistantOptInFlowScreenHandler::BindAssistantSettingsManager() {
return;
// Set up settings mojom.
- service_manager::Connector* connector =
- content::BrowserContext::GetConnectorFor(
- ProfileManager::GetActiveUserProfile());
- connector->BindInterface(assistant::mojom::kServiceName,
- mojo::MakeRequest(&settings_manager_));
+ AssistantServiceConnection::GetForProfile(
+ ProfileManager::GetActiveUserProfile())
+ ->service()
+ ->BindSettingsManager(mojo::MakeRequest(&settings_manager_));
if (initialized_) {
SendGetSettingsRequest();
@@ -339,7 +340,7 @@ void AssistantOptInFlowScreenHandler::OnGetSettingsResponse(
"opt-in flow.";
PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs();
prefs->SetBoolean(assistant::prefs::kAssistantDisabledByPolicy, true);
- prefs->SetBoolean(arc::prefs::kVoiceInteractionEnabled, false);
+ prefs->SetBoolean(chromeos::assistant::prefs::kAssistantEnabled, false);
HandleFlowFinished();
return;
}
@@ -508,13 +509,13 @@ void AssistantOptInFlowScreenHandler::HandleVoiceMatchScreenUserAction(
RecordAssistantOptInStatus(VOICE_MATCH_ENROLLMENT_SKIPPED);
if (flow_type_ != ash::FlowType::kSpeakerIdRetrain) {
// No need to disable hotword for retrain flow since user has a model.
- prefs->SetBoolean(arc::prefs::kVoiceInteractionHotwordEnabled, false);
+ prefs->SetBoolean(assistant::prefs::kAssistantHotwordEnabled, false);
}
StopSpeakerIdEnrollment();
ShowNextScreen();
} else if (action == kRecordPressed) {
- if (!prefs->GetBoolean(arc::prefs::kVoiceInteractionHotwordEnabled)) {
- prefs->SetBoolean(arc::prefs::kVoiceInteractionHotwordEnabled, true);
+ if (!prefs->GetBoolean(assistant::prefs::kAssistantHotwordEnabled)) {
+ prefs->SetBoolean(assistant::prefs::kAssistantHotwordEnabled, true);
}
assistant::mojom::SpeakerIdEnrollmentClientPtr client_ptr;
@@ -529,8 +530,7 @@ void AssistantOptInFlowScreenHandler::HandleGetMoreScreenUserAction(
const bool email_opted_in) {
RecordAssistantOptInStatus(GET_MORE_CONTINUED);
PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs();
- prefs->SetBoolean(arc::prefs::kVoiceInteractionContextEnabled,
- screen_context);
+ prefs->SetBoolean(assistant::prefs::kAssistantContextEnabled, screen_context);
OnEmailOptInResult(email_opted_in);
}
@@ -576,7 +576,7 @@ void AssistantOptInFlowScreenHandler::HandleFlowFinished() {
void AssistantOptInFlowScreenHandler::HandleFlowInitialized(
const int flow_type) {
auto* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs();
- if (!prefs->GetBoolean(arc::prefs::kVoiceInteractionEnabled)) {
+ if (!prefs->GetBoolean(chromeos::assistant::prefs::kAssistantEnabled)) {
HandleFlowFinished();
return;
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.h
index 8a24e879ca3..9810c088aea 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.h
@@ -163,7 +163,7 @@ class AssistantOptInFlowScreenHandler
mojo::Binding<assistant::mojom::SpeakerIdEnrollmentClient> client_binding_;
assistant::mojom::AssistantSettingsManagerPtr settings_manager_;
- base::WeakPtrFactory<AssistantOptInFlowScreenHandler> weak_factory_;
+ base::WeakPtrFactory<AssistantOptInFlowScreenHandler> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(AssistantOptInFlowScreenHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
index 5326b0b1233..5474107730b 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
@@ -8,7 +8,8 @@
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/event_rewriter_controller.h"
-#include "ash/public/interfaces/constants.mojom.h"
+#include "ash/public/cpp/tablet_mode.h"
+#include "ash/public/mojom/constants.mojom.h"
#include "ash/shell.h"
#include "base/bind.h"
#include "base/command_line.h"
@@ -32,7 +33,6 @@
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/ui/ash/ash_util.h"
#include "chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client.h"
-#include "chrome/browser/ui/ash/tablet_mode_client.h"
#include "chrome/browser/ui/webui/chromeos/login/demo_setup_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
@@ -88,9 +88,7 @@ void LaunchResetScreen() {
// Note that show_oobe_ui_ defaults to false because WizardController assumes
// OOBE UI is not visible by default.
CoreOobeHandler::CoreOobeHandler(JSCallsContainer* js_calls_container)
- : BaseWebUIHandler(js_calls_container),
- version_info_updater_(this),
- weak_ptr_factory_(this) {
+ : BaseWebUIHandler(js_calls_container), version_info_updater_(this) {
DCHECK(js_calls_container);
AccessibilityManager* accessibility_manager = AccessibilityManager::Get();
CHECK(accessibility_manager);
@@ -98,8 +96,7 @@ CoreOobeHandler::CoreOobeHandler(JSCallsContainer* js_calls_container)
base::Bind(&CoreOobeHandler::OnAccessibilityStatusChanged,
base::Unretained(this)));
- TabletModeClient* tablet_mode_client = TabletModeClient::Get();
- tablet_mode_client->AddObserver(this);
+ ash::TabletMode::Get()->AddObserver(this);
// |connector| may be null in tests.
auto* connector = content::GetSystemConnector();
@@ -112,7 +109,10 @@ CoreOobeHandler::CoreOobeHandler(JSCallsContainer* js_calls_container)
CoreOobeHandler::~CoreOobeHandler() {
OobeConfiguration::Get()->RemoveObserver(this);
- TabletModeClient::Get()->RemoveObserver(this);
+
+ // Ash may be released before us.
+ if (ash::TabletMode::Get())
+ ash::TabletMode::Get()->RemoveObserver(this);
}
void CoreOobeHandler::DeclareLocalizedValues(
@@ -178,7 +178,7 @@ void CoreOobeHandler::Initialize() {
void CoreOobeHandler::GetAdditionalParameters(base::DictionaryValue* dict) {
dict->SetKey("isInTabletMode",
- base::Value(TabletModeClient::Get()->tablet_mode_enabled()));
+ base::Value(ash::TabletMode::Get()->InTabletMode()));
dict->SetKey("isDemoModeEnabled",
base::Value(DemoSetupController::IsDemoModeAllowed()));
dict->SetKey("showTechnologyBadge",
@@ -534,8 +534,12 @@ void CoreOobeHandler::UpdateKeyboardState() {
SetVirtualKeyboardShown(is_keyboard_shown);
}
-void CoreOobeHandler::OnTabletModeToggled(bool enabled) {
- CallJS("cr.ui.Oobe.setTabletModeState", enabled);
+void CoreOobeHandler::OnTabletModeStarted() {
+ CallJS("cr.ui.Oobe.setTabletModeState", true);
+}
+
+void CoreOobeHandler::OnTabletModeEnded() {
+ CallJS("cr.ui.Oobe.setTabletModeState", false);
}
void CoreOobeHandler::UpdateClientAreaSize() {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h
index cb7db18c545..8e30d2b5363 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h
@@ -9,7 +9,8 @@
#include <string>
#include <vector>
-#include "ash/public/interfaces/cros_display_config.mojom.h"
+#include "ash/public/cpp/tablet_mode_observer.h"
+#include "ash/public/mojom/cros_display_config.mojom.h"
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
@@ -21,7 +22,6 @@
#include "chrome/browser/chromeos/login/oobe_configuration.h"
#include "chrome/browser/chromeos/login/version_info_updater.h"
#include "chrome/browser/chromeos/tpm_firmware_update.h"
-#include "chrome/browser/ui/ash/tablet_mode_client_observer.h"
#include "chrome/browser/ui/webui/chromeos/login/base_webui_handler.h"
#include "ui/events/event_source.h"
@@ -72,7 +72,7 @@ class CoreOobeHandler : public BaseWebUIHandler,
public VersionInfoUpdater::Delegate,
public CoreOobeView,
public ui::EventSource,
- public TabletModeClientObserver,
+ public ash::TabletModeObserver,
public OobeConfiguration::Observer {
public:
explicit CoreOobeHandler(JSCallsContainer* js_calls_container);
@@ -146,8 +146,9 @@ class CoreOobeHandler : public BaseWebUIHandler,
void StopDemoModeDetection() override;
void UpdateKeyboardState() override;
- // TabletModeClientObserver:
- void OnTabletModeToggled(bool enabled) override;
+ // ash::TabletModeObserver:
+ void OnTabletModeStarted() override;
+ void OnTabletModeEnded() override;
// OobeConfiguration::Observer:
void OnOobeConfigurationChanged() override;
@@ -223,7 +224,7 @@ class CoreOobeHandler : public BaseWebUIHandler,
ash::mojom::CrosDisplayConfigControllerPtr cros_display_config_ptr_;
- base::WeakPtrFactory<CoreOobeHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<CoreOobeHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(CoreOobeHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_pin_setup.cc b/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_pin_setup.cc
index b43a2040cf9..c6fce1fdcd0 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_pin_setup.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_pin_setup.cc
@@ -43,16 +43,14 @@ class DiscoverModulePinSetupHandler : public DiscoverHandler {
base::WeakPtr<DiscoverModulePinSetup> module_;
- base::WeakPtrFactory<DiscoverModulePinSetupHandler> weak_factory_;
+ base::WeakPtrFactory<DiscoverModulePinSetupHandler> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(DiscoverModulePinSetupHandler);
};
DiscoverModulePinSetupHandler::DiscoverModulePinSetupHandler(
base::WeakPtr<DiscoverModulePinSetup> module,
JSCallsContainer* js_calls_container)
- : DiscoverHandler(js_calls_container),
- module_(module),
- weak_factory_(this) {}
+ : DiscoverHandler(js_calls_container), module_(module) {}
void DiscoverModulePinSetupHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.cc
index a8d27784548..35e15951f2a 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.cc
@@ -36,9 +36,7 @@ constexpr StaticOobeScreenId EnableDebuggingScreenView::kScreenId;
EnableDebuggingScreenHandler::EnableDebuggingScreenHandler(
JSCallsContainer* js_calls_container)
- : BaseScreenHandler(kScreenId, js_calls_container),
- weak_ptr_factory_(this) {
-}
+ : BaseScreenHandler(kScreenId, js_calls_container) {}
EnableDebuggingScreenHandler::~EnableDebuggingScreenHandler() {
if (screen_)
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.h
index aaa881d0bbf..88dfc9a0a19 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.h
@@ -97,7 +97,7 @@ class EnableDebuggingScreenHandler : public EnableDebuggingScreenView,
// Keeps whether screen should be shown right after initialization.
bool show_on_init_ = false;
- base::WeakPtrFactory<EnableDebuggingScreenHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<EnableDebuggingScreenHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(EnableDebuggingScreenHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc
index ed23aaa3cda..b75aaa8b7cf 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc
@@ -40,7 +40,7 @@
#include "components/user_manager/user_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/system_connector.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "services/device/public/mojom/constants.mojom.h"
#include "services/device/public/mojom/wake_lock_provider.mojom.h"
#include "services/service_manager/public/cpp/connector.h"
@@ -258,8 +258,7 @@ constexpr StaticOobeScreenId EncryptionMigrationScreenView::kScreenId;
EncryptionMigrationScreenHandler::EncryptionMigrationScreenHandler(
JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container),
- tick_clock_(base::DefaultTickClock::GetInstance()),
- weak_ptr_factory_(this) {
+ tick_clock_(base::DefaultTickClock::GetInstance()) {
free_disk_space_fetcher_ = base::Bind(&base::SysInfo::AmountOfFreeDiskSpace,
base::FilePath(kCheckStoragePath));
}
@@ -482,7 +481,8 @@ void EncryptionMigrationScreenHandler::HandleOpenFeedbackDialog() {
"Auto generated feedback for http://crbug.com/719266.\n"
"(uniquifier:%s)",
base::NumberToString(base::Time::Now().ToInternalValue()).c_str());
- login_feedback_.reset(new LoginFeedback(Profile::FromWebUI(web_ui())));
+ login_feedback_ =
+ std::make_unique<LoginFeedback>(Profile::FromWebUI(web_ui()));
login_feedback_->Request(description, base::Closure());
}
@@ -520,8 +520,9 @@ void EncryptionMigrationScreenHandler::UpdateUIState(UIState state) {
}
void EncryptionMigrationScreenHandler::CheckAvailableStorage() {
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
+ base::PostTaskAndReplyWithResult(
+ FROM_HERE,
+ {base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE},
free_disk_space_fetcher_,
base::Bind(&EncryptionMigrationScreenHandler::OnGetAvailableStorage,
weak_ptr_factory_.GetWeakPtr()));
@@ -620,7 +621,8 @@ device::mojom::WakeLock* EncryptionMigrationScreenHandler::GetWakeLock() {
if (wake_lock_)
return wake_lock_.get();
- device::mojom::WakeLockRequest request = mojo::MakeRequest(&wake_lock_);
+ mojo::PendingReceiver<device::mojom::WakeLock> receiver =
+ wake_lock_.BindNewPipeAndPassReceiver();
// Service manager connection might be not initialized in some testing
// contexts.
@@ -629,13 +631,14 @@ device::mojom::WakeLock* EncryptionMigrationScreenHandler::GetWakeLock() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- device::mojom::WakeLockProviderPtr wake_lock_provider;
- content::GetSystemConnector()->BindInterface(
- device::mojom::kServiceName, mojo::MakeRequest(&wake_lock_provider));
+ mojo::Remote<device::mojom::WakeLockProvider> wake_lock_provider;
+ content::GetSystemConnector()->Connect(
+ device::mojom::kServiceName,
+ wake_lock_provider.BindNewPipeAndPassReceiver());
wake_lock_provider->GetWakeLockWithoutContext(
device::mojom::WakeLockType::kPreventAppSuspension,
device::mojom::WakeLockReason::kOther,
- "Encryption migration is in progress...", std::move(request));
+ "Encryption migration is in progress...", std::move(receiver));
return wake_lock_.get();
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h
index 4661fce4ee1..23dd21fc6bb 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h
@@ -18,6 +18,7 @@
#include "chromeos/dbus/cryptohome/rpc.pb.h"
#include "chromeos/dbus/power/power_manager_client.h"
#include "chromeos/login/auth/user_context.h"
+#include "mojo/public/cpp/bindings/remote.h"
#include "services/device/public/mojom/wake_lock.mojom.h"
#include "third_party/cros_system_api/dbus/cryptohome/dbus-constants.h"
@@ -201,7 +202,7 @@ class EncryptionMigrationScreenHandler : public EncryptionMigrationScreenView,
// Point in time when minimal migration started, as reported by |tick_clock_|.
base::TimeTicks minimal_migration_start_;
- device::mojom::WakeLockPtr wake_lock_;
+ mojo::Remote<device::mojom::WakeLock> wake_lock_;
std::unique_ptr<LoginFeedback> login_feedback_;
@@ -210,7 +211,8 @@ class EncryptionMigrationScreenHandler : public EncryptionMigrationScreenView,
FreeDiskSpaceFetcher free_disk_space_fetcher_;
- base::WeakPtrFactory<EncryptionMigrationScreenHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<EncryptionMigrationScreenHandler> weak_ptr_factory_{
+ this};
DISALLOW_COPY_AND_ASSIGN(EncryptionMigrationScreenHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler_unittest.cc b/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler_unittest.cc
index 081fdff1bfb..bca31b6289f 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler_unittest.cc
@@ -7,8 +7,8 @@
#include "base/bind.h"
#include "base/memory/ptr_util.h"
-#include "base/test/scoped_task_environment.h"
#include "base/test/simple_test_tick_clock.h"
+#include "base/test/task_environment.h"
#include "chrome/browser/chromeos/arc/arc_migration_constants.h"
#include "chrome/browser/chromeos/login/screens/encryption_migration_mode.h"
#include "chrome/browser/chromeos/login/users/mock_user_manager.h"
@@ -26,6 +26,7 @@
#include "components/user_manager/scoped_user_manager.h"
#include "components/user_manager/user_names.h"
#include "content/public/test/test_web_ui.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -47,7 +48,8 @@ class FakeWakeLock : public device::mojom::WakeLock {
// Implement device::mojom::WakeLock:
void RequestWakeLock() override { has_wakelock_ = true; }
void CancelWakeLock() override { has_wakelock_ = false; }
- void AddClient(device::mojom::WakeLockRequest request) override {}
+ void AddClient(
+ mojo::PendingReceiver<device::mojom::WakeLock> receiver) override {}
void ChangeType(device::mojom::WakeLockType type,
ChangeTypeCallback callback) override {
NOTIMPLEMENTED();
@@ -167,7 +169,7 @@ class EncryptionMigrationScreenHandlerTest : public testing::Test {
protected:
// Must be the first member.
- base::test::ScopedTaskEnvironment scoped_task_environment_;
+ base::test::TaskEnvironment task_environment_;
std::unique_ptr<user_manager::ScopedUserManager> scoped_user_manager_enabler_;
FakeCryptohomeClient* fake_cryptohome_client_ = nullptr; // unowned
@@ -218,7 +220,7 @@ TEST_F(EncryptionMigrationScreenHandlerTest, MinimalMigration) {
EncryptionMigrationMode::START_MINIMAL_MIGRATION);
encryption_migration_screen_handler_->SetupInitialView();
- scoped_task_environment_.RunUntilIdle();
+ task_environment_.RunUntilIdle();
EXPECT_TRUE(
encryption_migration_screen_handler_->fake_wake_lock()->HasWakeLock());
@@ -247,7 +249,7 @@ TEST_F(EncryptionMigrationScreenHandlerTest, ResumeMinimalMigration) {
EncryptionMigrationMode::RESUME_MINIMAL_MIGRATION);
encryption_migration_screen_handler_->SetupInitialView();
- scoped_task_environment_.RunUntilIdle();
+ task_environment_.RunUntilIdle();
fake_cryptohome_client_->NotifyDircryptoMigrationProgress(
cryptohome::DircryptoMigrationStatus::DIRCRYPTO_MIGRATION_SUCCESS,
@@ -272,7 +274,7 @@ TEST_F(EncryptionMigrationScreenHandlerTest, MinimalMigrationSlow) {
EncryptionMigrationMode::START_MINIMAL_MIGRATION);
encryption_migration_screen_handler_->SetupInitialView();
- scoped_task_environment_.RunUntilIdle();
+ task_environment_.RunUntilIdle();
encryption_migration_screen_handler_->testing_tick_clock()->Advance(
base::TimeDelta::FromMinutes(1));
@@ -297,7 +299,7 @@ TEST_F(EncryptionMigrationScreenHandlerTest, MinimalMigrationFails) {
EncryptionMigrationMode::START_MINIMAL_MIGRATION);
encryption_migration_screen_handler_->SetupInitialView();
- scoped_task_environment_.RunUntilIdle();
+ task_environment_.RunUntilIdle();
encryption_migration_screen_handler_->testing_tick_clock()->Advance(
base::TimeDelta::FromMinutes(1));
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc
index 5c9688e360d..d0fa17ef808 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc
@@ -182,8 +182,7 @@ EnrollmentScreenHandler::EnrollmentScreenHandler(
: BaseScreenHandler(kScreenId, js_calls_container),
network_state_informer_(network_state_informer),
error_screen_(error_screen),
- histogram_helper_(new ErrorScreensHistogramHelper("Enrollment")),
- weak_ptr_factory_(this) {
+ histogram_helper_(new ErrorScreensHistogramHelper("Enrollment")) {
DCHECK(network_state_informer_.get());
DCHECK(error_screen_);
network_state_informer_->AddObserver(this);
@@ -800,12 +799,12 @@ void EnrollmentScreenHandler::HandleCompleteLogin(const std::string& user) {
void EnrollmentScreenHandler::OnGetCookiesForCompleteLogin(
const std::string& user,
- const std::vector<net::CanonicalCookie>& cookies,
+ const net::CookieStatusList& cookies,
const net::CookieStatusList& excluded_cookies) {
std::string auth_code;
- for (const auto& cookie : cookies) {
- if (cookie.Name() == "oauth_code") {
- auth_code = cookie.Value();
+ for (const auto& cookie_with_status : cookies) {
+ if (cookie_with_status.cookie.Name() == "oauth_code") {
+ auth_code = cookie_with_status.cookie.Value();
break;
}
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h
index 0d4ff94c225..2580ce653f0 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h
@@ -17,10 +17,7 @@
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h"
#include "net/base/net_errors.h"
-
-namespace net {
-class CanonicalCookie;
-}
+#include "net/cookies/canonical_cookie.h"
namespace chromeos {
@@ -107,7 +104,7 @@ class EnrollmentScreenHandler
void HandleCompleteLogin(const std::string& user);
void OnGetCookiesForCompleteLogin(
const std::string& user,
- const std::vector<net::CanonicalCookie>& cookies,
+ const net::CookieStatusList& cookies,
const net::CookieStatusList& excluded_cookies);
void HandleAdCompleteLogin(const std::string& machine_name,
const std::string& distinguished_name,
@@ -191,8 +188,7 @@ class EnrollmentScreenHandler
// Help application used for help dialogs.
scoped_refptr<HelpAppLauncher> help_app_;
-
- base::WeakPtrFactory<EnrollmentScreenHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<EnrollmentScreenHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(EnrollmentScreenHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.cc
index e0638ca7a4a..b61b4f7bb1f 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.cc
@@ -32,8 +32,7 @@ constexpr StaticOobeScreenId EulaView::kScreenId;
EulaScreenHandler::EulaScreenHandler(JSCallsContainer* js_calls_container,
CoreOobeView* core_oobe_view)
: BaseScreenHandler(kScreenId, js_calls_container),
- core_oobe_view_(core_oobe_view),
- weak_factory_(this) {
+ core_oobe_view_(core_oobe_view) {
set_user_acted_method_path("login.EulaScreen.userActed");
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h
index 395a459a27a..c6ace1d9492 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h
@@ -79,7 +79,7 @@ class EulaScreenHandler : public EulaView, public BaseScreenHandler {
// Keeps whether screen should be shown right after initialization.
bool show_on_init_ = false;
- base::WeakPtrFactory<EulaScreenHandler> weak_factory_;
+ base::WeakPtrFactory<EulaScreenHandler> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(EulaScreenHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
index 7ea94468de3..ee389c1f193 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
@@ -18,6 +18,7 @@
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/metrics/histogram_macros.h"
+#include "base/optional.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -26,6 +27,9 @@
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/authpolicy/authpolicy_helper.h"
+#include "chrome/browser/chromeos/certificate_provider/certificate_provider_service.h"
+#include "chrome/browser/chromeos/certificate_provider/certificate_provider_service_factory.h"
+#include "chrome/browser/chromeos/certificate_provider/pin_dialog_manager.h"
#include "chrome/browser/chromeos/language_preferences.h"
#include "chrome/browser/chromeos/login/lock_screen_utils.h"
#include "chrome/browser/chromeos/login/reauth_stats.h"
@@ -58,11 +62,13 @@
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/constants/chromeos_switches.h"
#include "chromeos/constants/devicetype.h"
+#include "chromeos/constants/security_token_pin_types.h"
#include "chromeos/dbus/util/version_loader.h"
#include "chromeos/login/auth/challenge_response/cert_utils.h"
#include "chromeos/login/auth/cryptohome_key_constants.h"
#include "chromeos/login/auth/saml_password_attributes.h"
#include "chromeos/login/auth/user_context.h"
+#include "chromeos/network/onc/certificate_scope.h"
#include "chromeos/settings/cros_settings_names.h"
#include "components/login/localized_values_builder.h"
#include "components/policy/proto/chrome_device_policy.pb.h"
@@ -77,6 +83,7 @@
#include "google_apis/gaia/gaia_auth_util.h"
#include "google_apis/gaia/gaia_urls.h"
#include "mojo/public/cpp/bindings/callback_helpers.h"
+#include "net/base/net_errors.h"
#include "net/cert/x509_certificate.h"
#include "services/network/nss_temp_certs_cache_chromeos.h"
#include "services/network/public/mojom/network_context.mojom.h"
@@ -253,6 +260,27 @@ bool GaiaActionButtonsEnabled() {
return base::FeatureList::IsEnabled(chromeos::features::kGaiaActionButtons);
}
+PinDialogManager* GetLoginScreenPinDialogManager() {
+ DCHECK(ProfileHelper::IsSigninProfileInitialized());
+ CertificateProviderService* certificate_provider_service =
+ CertificateProviderServiceFactory::GetForBrowserContext(
+ ProfileHelper::GetSigninProfile());
+ return certificate_provider_service->pin_dialog_manager();
+}
+
+base::Value MakeSecurityTokenPinDialogParameters(
+ SecurityTokenPinCodeType code_type,
+ bool enable_user_input,
+ SecurityTokenPinErrorLabel error_label,
+ int attempts_left) {
+ base::Value params(base::Value::Type::DICTIONARY);
+ params.SetIntKey("codeType", static_cast<int>(code_type));
+ params.SetBoolKey("enableUserInput", enable_user_input);
+ params.SetIntKey("errorLabel", static_cast<int>(error_label));
+ params.SetIntKey("attemptsLeft", attempts_left);
+ return params;
+}
+
} // namespace
constexpr StaticOobeScreenId GaiaView::kScreenId;
@@ -289,14 +317,15 @@ GaiaScreenHandler::GaiaScreenHandler(
network_state_informer_(network_state_informer),
core_oobe_view_(core_oobe_view),
active_directory_password_change_screen_handler_(
- active_directory_password_change_screen_handler),
- weak_factory_(this) {
+ active_directory_password_change_screen_handler) {
DCHECK(network_state_informer_.get());
}
GaiaScreenHandler::~GaiaScreenHandler() {
if (network_portal_detector_)
network_portal_detector_->RemoveObserver(this);
+ if (is_security_token_pin_enabled_)
+ GetLoginScreenPinDialogManager()->RemovePinDialogHost(this);
}
void GaiaScreenHandler::MaybePreloadAuthExtension() {
@@ -349,8 +378,7 @@ void GaiaScreenHandler::LoadGaiaWithPartition(
base::BindOnce(&GaiaScreenHandler::OnSetCookieForLoadGaiaWithPartition,
weak_factory_.GetWeakPtr(), context, partition_name);
if (context.gaps_cookie.empty()) {
- std::move(callback).Run(
- net::CanonicalCookie::CookieInclusionStatus::INCLUDE);
+ std::move(callback).Run(net::CanonicalCookie::CookieInclusionStatus());
return;
}
@@ -367,15 +395,15 @@ void GaiaScreenHandler::LoadGaiaWithPartition(
std::string gaps_cookie_value(kGAPSCookie);
gaps_cookie_value += "=" + context.gaps_cookie;
+ std::unique_ptr<net::CanonicalCookie> cc(net::CanonicalCookie::Create(
+ GaiaUrls::GetInstance()->gaia_url(), gaps_cookie_value, base::Time::Now(),
+ base::nullopt /* server_time */));
+
net::CookieOptions options;
options.set_include_httponly();
// Permit it to set a SameSite cookie if it wants to.
options.set_same_site_cookie_context(
net::CookieOptions::SameSiteCookieContext::SAME_SITE_STRICT);
- std::unique_ptr<net::CanonicalCookie> cc(net::CanonicalCookie::Create(
- GaiaUrls::GetInstance()->gaia_url(), gaps_cookie_value, base::Time::Now(),
- options));
-
partition->GetCookieManagerForBrowserProcess()->SetCanonicalCookie(
*cc.get(), "https", options, std::move(callback));
}
@@ -393,8 +421,9 @@ void GaiaScreenHandler::OnSetCookieForLoadGaiaWithPartition(
&GaiaScreenHandler::LoadGaiaWithPartitionAndVersionAndConsent,
weak_factory_.GetWeakPtr(), context, partition_name,
base::Owned(version.release()), base::Owned(consent.release()));
- base::PostTaskWithTraitsAndReply(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
+ base::PostTaskAndReply(
+ FROM_HERE,
+ {base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE},
std::move(get_version_and_consent), std::move(load_gaia));
}
@@ -415,6 +444,30 @@ void GaiaScreenHandler::LoadGaiaWithPartitionAndVersionAndConsent(
screen_mode_ = GetGaiaScreenMode(context.email, context.use_offline);
params.SetInteger("screenMode", screen_mode_);
+ if (!context.email.empty()) {
+ const AccountId account_id = GetAccountId(
+ context.email, std::string() /* id */, AccountType::UNKNOWN);
+ const user_manager::User* const user =
+ user_manager::UserManager::Get()->FindUser(account_id);
+ if (user && user->using_saml() &&
+ user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT &&
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kPublicAccountsSamlUrl)) {
+ std::string saml_url =
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kPublicAccountsSamlUrl);
+ params.SetBoolean("startsOnSamlPage", true);
+ params.SetString("frameUrl", saml_url);
+ params.SetString("email", account_id.GetUserEmail());
+ CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kPublicAccountsSamlAclUrl));
+ std::string saml_acl_url =
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kPublicAccountsSamlAclUrl);
+ params.SetString("samlAclUrl", saml_acl_url);
+ }
+ }
+
if (screen_mode_ == GAIA_SCREEN_MODE_AD && !authpolicy_login_helper_)
authpolicy_login_helper_ = std::make_unique<AuthPolicyHelper>();
@@ -573,6 +626,23 @@ void GaiaScreenHandler::DeclareLocalizedValues(
IDS_AD_PASSWORD_CHANGE_NEW_PASSWORD_REJECTED_SHORT_ERROR);
builder->Add("adPassChangePasswordsMismatch",
IDS_AD_PASSWORD_CHANGE_PASSWORDS_MISMATCH_ERROR);
+
+ builder->Add("securityTokenPinDialogTitle",
+ IDS_SAML_SECURITY_TOKEN_PIN_DIALOG_TITLE);
+ builder->Add("securityTokenPinDialogSubtitle",
+ IDS_SAML_SECURITY_TOKEN_PIN_DIALOG_SUBTITLE);
+ builder->Add("securityTokenPinDialogTryAgain",
+ IDS_SAML_SECURITY_TOKEN_PIN_DIALOG_TRY_AGAIN);
+ builder->Add("securityTokenPinDialogAttemptsLeft",
+ IDS_REQUEST_PIN_DIALOG_ATTEMPTS_LEFT);
+ builder->Add("securityTokenPinDialogUnknownError",
+ IDS_REQUEST_PIN_DIALOG_UNKNOWN_ERROR);
+ builder->Add("securityTokenPinDialogUnknownInvalidPin",
+ IDS_REQUEST_PIN_DIALOG_INVALID_PIN_ERROR);
+ builder->Add("securityTokenPinDialogUnknownInvalidPuk",
+ IDS_REQUEST_PIN_DIALOG_INVALID_PUK_ERROR);
+ builder->Add("securityTokenPinDialogUnknownMaxAttemptsExceeded",
+ IDS_REQUEST_PIN_DIALOG_MAX_ATTEMPTS_EXCEEDED_ERROR);
}
void GaiaScreenHandler::Initialize() {
@@ -612,6 +682,9 @@ void GaiaScreenHandler::RegisterMessages() {
AddCallback("updateSigninUIState",
&GaiaScreenHandler::HandleUpdateSigninUIState);
AddCallback("showGuestInOobe", &GaiaScreenHandler::HandleShowGuestInOobe);
+ AddCallback("samlStateChanged", &GaiaScreenHandler::HandleSamlStateChanged);
+ AddCallback("securityTokenPinEntered",
+ &GaiaScreenHandler::HandleSecurityTokenPinEntered);
// Allow UMA metrics collection from JS.
web_ui()->AddMessageHandler(std::make_unique<MetricsHandler>());
@@ -653,34 +726,15 @@ void GaiaScreenHandler::HandleAuthExtensionLoaded() {
std::make_unique<LoginClientCertUsageObserver>();
}
-void GaiaScreenHandler::HandleWebviewLoadAborted(
- const std::string& error_reason_str) {
- // TODO(nkostylev): Switch to int code once webview supports that.
- // http://crbug.com/470483
- if (error_reason_str == "ERR_ABORTED") {
- LOG(WARNING) << "Ignoring Gaia webview error: " << error_reason_str;
+void GaiaScreenHandler::HandleWebviewLoadAborted(int error_code) {
+ if (error_code == net::ERR_ABORTED) {
+ LOG(WARNING) << "Ignoring Gaia webview error: "
+ << net::ErrorToShortString(error_code);
return;
}
- // TODO(nkostylev): Switch to int code once webview supports that.
- // http://crbug.com/470483
- // Extract some common codes used by SigninScreenHandler for now.
- if (error_reason_str == "ERR_NAME_NOT_RESOLVED")
- frame_error_ = net::ERR_NAME_NOT_RESOLVED;
- else if (error_reason_str == "ERR_INTERNET_DISCONNECTED")
- frame_error_ = net::ERR_INTERNET_DISCONNECTED;
- else if (error_reason_str == "ERR_NETWORK_CHANGED")
- frame_error_ = net::ERR_NETWORK_CHANGED;
- else if (error_reason_str == "ERR_INTERNET_DISCONNECTED")
- frame_error_ = net::ERR_INTERNET_DISCONNECTED;
- else if (error_reason_str == "ERR_PROXY_CONNECTION_FAILED")
- frame_error_ = net::ERR_PROXY_CONNECTION_FAILED;
- else if (error_reason_str == "ERR_TUNNEL_CONNECTION_FAILED")
- frame_error_ = net::ERR_TUNNEL_CONNECTION_FAILED;
- else
- frame_error_ = net::ERR_INTERNET_DISCONNECTED;
-
- LOG(ERROR) << "Gaia webview error: " << error_reason_str;
+ frame_error_ = static_cast<net::Error>(error_code);
+ LOG(ERROR) << "Gaia webview error: " << net::ErrorToShortString(error_code);
NetworkError::ErrorReason error_reason =
NetworkError::ERROR_REASON_FRAME_ERROR;
frame_state_ = FRAME_STATE_ERROR;
@@ -812,10 +866,11 @@ void GaiaScreenHandler::OnGetCookiesForCompleteAuthentication(
bool using_saml,
const ::login::StringList& services,
const SamlPasswordAttributes& password_attributes,
- const std::vector<net::CanonicalCookie>& cookies,
+ const net::CookieStatusList& cookies,
const net::CookieStatusList& excluded_cookies) {
std::string auth_code, gaps_cookie;
- for (const auto& cookie : cookies) {
+ for (const auto& cookie_with_status : cookies) {
+ const auto& cookie = cookie_with_status.cookie;
if (cookie.Name() == kOAUTHCodeCookie)
auth_code = cookie.Value();
else if (cookie.Name() == kGAPSCookie)
@@ -948,6 +1003,48 @@ void GaiaScreenHandler::HandleShowGuestInOobe(bool show) {
ash::LoginScreen::Get()->ShowGuestButtonInOobe(show);
}
+void GaiaScreenHandler::HandleSamlStateChanged(bool is_saml) {
+ if (is_saml == is_security_token_pin_enabled_) {
+ // We're already in the needed |is_security_token_pin_enabled_| state.
+ return;
+ }
+ // Enable ourselves as a security token PIN dialog host during the SAML
+ // sign-in, so that when the SAML page requires client authentication (e.g.,
+ // against a smart card), this PIN request is embedded into the SAML login UI.
+ if (is_saml) {
+ GetLoginScreenPinDialogManager()->AddPinDialogHost(this);
+ } else {
+ security_token_pin_entered_callback_.Reset();
+ security_token_pin_dialog_closed_callback_.Reset();
+ GetLoginScreenPinDialogManager()->RemovePinDialogHost(this);
+ }
+ is_security_token_pin_enabled_ = is_saml;
+}
+
+void GaiaScreenHandler::HandleSecurityTokenPinEntered(
+ const std::string& user_input) {
+ // Invariant: when the pin_entered_callback is present, the closed_callback
+ // must be present as well.
+ DCHECK(!security_token_pin_entered_callback_ ||
+ security_token_pin_dialog_closed_callback_);
+
+ if (!security_token_pin_dialog_closed_callback_) {
+ // The PIN request has already been canceled on the handler side.
+ return;
+ }
+
+ if (user_input.empty()) {
+ security_token_pin_entered_callback_.Reset();
+ std::move(security_token_pin_dialog_closed_callback_).Run();
+ } else {
+ // The callback must be non-null, since the UI implementation should not
+ // send multiple non-empty results.
+ std::move(security_token_pin_entered_callback_).Run(user_input);
+ // Keep |security_token_pin_dialog_closed_callback_|, in order to be able to
+ // notify about the dialog closing afterwards.
+ }
+}
+
void GaiaScreenHandler::OnShowAddUser() {
signin_screen_handler_->is_account_picker_showing_first_time_ = false;
lock_screen_utils::EnforcePolicyInputMethods(std::string());
@@ -1123,6 +1220,49 @@ void GaiaScreenHandler::ShowSigninScreenForTest(const std::string& username,
}
}
+void GaiaScreenHandler::ShowSecurityTokenPinDialog(
+ const std::string& /*caller_extension_name*/,
+ SecurityTokenPinCodeType code_type,
+ bool enable_user_input,
+ SecurityTokenPinErrorLabel error_label,
+ int attempts_left,
+ const base::Optional<AccountId>& /*authenticating_user_account_id*/,
+ SecurityTokenPinEnteredCallback pin_entered_callback,
+ SecurityTokenPinDialogClosedCallback pin_dialog_closed_callback) {
+ DCHECK(is_security_token_pin_enabled_);
+ // There must be either no active PIN dialog, or the active dialog for which
+ // the PIN has already been entered.
+ DCHECK(!security_token_pin_entered_callback_);
+
+ security_token_pin_entered_callback_ = std::move(pin_entered_callback);
+ // Note that this overwrites the previous closed_callback in the case where
+ // the dialog was already shown. This is intended, since the closing callback
+ // should only be used to notify that the dialog got canceled, which imposes a
+ // stricter quota on the PIN request caller.
+ security_token_pin_dialog_closed_callback_ =
+ std::move(pin_dialog_closed_callback);
+
+ CallJS("login.GaiaSigninScreen.showPinDialog",
+ MakeSecurityTokenPinDialogParameters(code_type, enable_user_input,
+ error_label, attempts_left));
+}
+
+void GaiaScreenHandler::CloseSecurityTokenPinDialog() {
+ DCHECK(is_security_token_pin_enabled_);
+ // Invariant: when the pin_entered_callback is present, the closed_callback
+ // must be present as well.
+ DCHECK(!security_token_pin_entered_callback_ ||
+ security_token_pin_dialog_closed_callback_);
+
+ security_token_pin_entered_callback_.Reset();
+ security_token_pin_dialog_closed_callback_.Reset();
+
+ // Notify the page, unless it's already being shut down (which may happen if
+ // we're called from the destructor).
+ if (IsJavascriptAllowed())
+ CallJS("login.GaiaSigninScreen.closePinDialog");
+}
+
bool GaiaScreenHandler::IsOfflineLoginActive() const {
return (screen_mode_ == GAIA_SCREEN_MODE_OFFLINE) || offline_login_is_active_;
}
@@ -1207,7 +1347,8 @@ void GaiaScreenHandler::ShowGaiaScreenIfReady() {
g_browser_process->platform_part()
->browser_policy_connector_chromeos()
->GetDeviceNetworkConfigurationUpdater()
- ->GetAllAuthorityCertificates());
+ ->GetAllAuthorityCertificates(
+ chromeos::onc::CertificateScope::Default()));
}
LoadAuthExtension(!gaia_silent_load_ /* force */, false /* offline */);
@@ -1296,7 +1437,6 @@ bool GaiaScreenHandler::BuildUserContextForGaiaSignIn(
const SamlPasswordAttributes& password_attributes,
UserContext* user_context,
std::string* error_message) {
- // TODO(emaxx,https://crbug.com/826417): Localize the error messages.
*user_context = UserContext(user_type, account_id);
if (using_saml && extension_provided_client_cert_usage_observer_ &&
extension_provided_client_cert_usage_observer_->ClientCertsWereUsed()) {
@@ -1304,13 +1444,15 @@ bool GaiaScreenHandler::BuildUserContextForGaiaSignIn(
std::vector<ChallengeResponseKey::SignatureAlgorithm> signature_algorithms;
if (!extension_provided_client_cert_usage_observer_->GetOnlyUsedClientCert(
&saml_client_cert, &signature_algorithms)) {
- *error_message = "Multiple client certificates are not supported";
+ *error_message = l10n_util::GetStringUTF8(
+ IDS_CHALLENGE_RESPONSE_AUTH_MULTIPLE_CLIENT_CERTS_ERROR);
return false;
}
ChallengeResponseKey challenge_response_key;
if (!ExtractChallengeResponseKeyFromCert(
*saml_client_cert, signature_algorithms, &challenge_response_key)) {
- *error_message = "Internal error";
+ *error_message = l10n_util::GetStringUTF8(
+ IDS_CHALLENGE_RESPONSE_AUTH_INVALID_CLIENT_CERT_ERROR);
return false;
}
user_context->GetMutableChallengeResponseKeys()->push_back(
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h
index 1b1dd70e282..9cba09d99ff 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h
@@ -12,6 +12,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "chrome/browser/chromeos/authpolicy/authpolicy_helper.h"
+#include "chrome/browser/chromeos/certificate_provider/security_token_pin_dialog_host.h"
#include "chrome/browser/chromeos/login/login_client_cert_usage_observer.h"
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h"
@@ -19,6 +20,7 @@
#include "chromeos/network/portal_detector/network_portal_detector.h"
#include "components/user_manager/user_type.h"
#include "net/base/net_errors.h"
+#include "net/cookies/canonical_cookie.h"
class AccountId;
@@ -26,10 +28,6 @@ namespace base {
class DictionaryValue;
} // namespace base
-namespace net {
-class CanonicalCookie;
-}
-
namespace network {
class NSSTempCertsCacheChromeOS;
}
@@ -75,7 +73,8 @@ class GaiaView {
// A class that handles WebUI hooks in Gaia screen.
class GaiaScreenHandler : public BaseScreenHandler,
public GaiaView,
- public NetworkPortalDetector::Observer {
+ public NetworkPortalDetector::Observer,
+ public SecurityTokenPinDialogHost {
public:
using TView = GaiaView;
@@ -117,6 +116,18 @@ class GaiaScreenHandler : public BaseScreenHandler,
const std::string& password,
const std::string& services) override;
+ // SecurityTokenPinDialogHost:
+ void ShowSecurityTokenPinDialog(
+ const std::string& caller_extension_name,
+ SecurityTokenPinCodeType code_type,
+ bool enable_user_input,
+ SecurityTokenPinErrorLabel error_label,
+ int attempts_left,
+ const base::Optional<AccountId>& authenticating_user_account_id,
+ SecurityTokenPinEnteredCallback pin_entered_callback,
+ SecurityTokenPinDialogClosedCallback pin_dialog_closed_callback) override;
+ void CloseSecurityTokenPinDialog() override;
+
// Returns true if offline login mode was either required, or reported by the
// WebUI (i.e. WebUI mignt not have completed transition to the new mode).
bool IsOfflineLoginActive() const;
@@ -174,7 +185,7 @@ class GaiaScreenHandler : public BaseScreenHandler,
const NetworkPortalDetector::CaptivePortalState& state) override;
// WebUI message handlers.
- void HandleWebviewLoadAborted(const std::string& error_reason_str);
+ void HandleWebviewLoadAborted(int error_code);
void HandleCompleteAuthentication(
const std::string& gaia_id,
const std::string& email,
@@ -189,7 +200,7 @@ class GaiaScreenHandler : public BaseScreenHandler,
bool using_saml,
const ::login::StringList& services,
const SamlPasswordAttributes& password_attributes,
- const std::vector<net::CanonicalCookie>& cookies,
+ const net::CookieStatusList& cookies,
const net::CookieStatusList& excluded_cookies);
void HandleCompleteLogin(const std::string& gaia_id,
const std::string& typed_email,
@@ -222,6 +233,12 @@ class GaiaScreenHandler : public BaseScreenHandler,
// OOBE.
void HandleShowGuestInOobe(bool show);
+ // Called to notify whether the SAML sign-in is currently happening.
+ void HandleSamlStateChanged(bool is_saml);
+ // Called to deliver the result of the security token PIN request. Called with
+ // an empty string when the request is canceled.
+ void HandleSecurityTokenPinEntered(const std::string& user_input);
+
void OnShowAddUser();
// Really handles the complete login message.
@@ -397,7 +414,23 @@ class GaiaScreenHandler : public BaseScreenHandler,
std::unique_ptr<LoginClientCertUsageObserver>
extension_provided_client_cert_usage_observer_;
- base::WeakPtrFactory<GaiaScreenHandler> weak_factory_;
+ // State of the security token PIN dialogs:
+
+ // Whether this instance is currently registered as a host for showing the
+ // security token PIN dialogs. (See PinDialogManager for the default host.)
+ bool is_security_token_pin_enabled_ = false;
+ // The callback to run when the user submits a non-empty input to the security
+ // token PIN dialog.
+ // Is non-empty iff the dialog is active and the input wasn't sent yet.
+ SecurityTokenPinEnteredCallback security_token_pin_entered_callback_;
+ // The callback to run when the security token PIN dialog gets closed - either
+ // due to the user canceling the dialog or the whole sign-in attempt being
+ // aborted.
+ // Is non-empty iff the dialog is active.
+ SecurityTokenPinDialogClosedCallback
+ security_token_pin_dialog_closed_callback_;
+
+ base::WeakPtrFactory<GaiaScreenHandler> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(GaiaScreenHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.cc
index 476a82cbb5b..cc9f15d605b 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.cc
@@ -24,9 +24,7 @@ constexpr StaticOobeScreenId KioskEnableScreenView::kScreenId;
KioskEnableScreenHandler::KioskEnableScreenHandler(
JSCallsContainer* js_calls_container)
- : BaseScreenHandler(kScreenId, js_calls_container),
- weak_ptr_factory_(this) {
-}
+ : BaseScreenHandler(kScreenId, js_calls_container) {}
KioskEnableScreenHandler::~KioskEnableScreenHandler() {
if (delegate_)
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.h
index 7e7a8de528d..c6aa06760f7 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.h
@@ -68,7 +68,7 @@ class KioskEnableScreenHandler : public KioskEnableScreenView,
// True if machine's consumer kiosk mode is in a configurable state.
bool is_configurable_ = false;
- base::WeakPtrFactory<KioskEnableScreenHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<KioskEnableScreenHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(KioskEnableScreenHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util.cc b/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util.cc
index c3dbe6c9ffb..8ec89e865c7 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util.cc
@@ -426,8 +426,8 @@ void ResolveUILanguageList(
const UILanguageListResolvedCallback& callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- base::PostTaskWithTraits(
- FROM_HERE, {base::MayBlock()},
+ base::PostTask(
+ FROM_HERE, {base::ThreadPool(), base::MayBlock()},
base::BindOnce(&ResolveLanguageListInThreadPool,
base::Passed(&language_switch_result),
base::SequencedTaskRunnerHandle::Get(), callback));
@@ -581,9 +581,10 @@ void GetKeyboardLayoutsForLocale(
// thread.
std::string (*get_application_locale)(const std::string&, bool) =
&l10n_util::GetApplicationLocale;
- base::PostTaskWithTraitsAndReplyWithResult(
+ base::PostTaskAndReplyWithResult(
FROM_HERE,
- {base::MayBlock(), base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
+ {base::ThreadPool(), base::MayBlock(),
+ base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
base::BindOnce(get_application_locale, locale,
false /* set_icu_locale */),
base::BindOnce(&GetKeyboardLayoutsForResolvedLocale, locale, callback));
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc b/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc
index 7449e5194ca..25586cf34dd 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc
@@ -11,7 +11,7 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/run_loop.h"
-#include "base/test/scoped_task_environment.h"
+#include "base/test/task_environment.h"
#include "base/values.h"
#include "chrome/browser/chromeos/customization/customization_document.h"
#include "chrome/browser/chromeos/input_method/input_method_configuration.h"
@@ -58,7 +58,7 @@ class L10nUtilTest : public testing::Test {
void SetInputMethods2();
private:
- base::test::ScopedTaskEnvironment scoped_task_environment_;
+ base::test::TaskEnvironment task_environment_;
system::ScopedFakeStatisticsProvider scoped_fake_statistics_provider_;
MockInputMethodManagerWithInputMethods* input_manager_;
@@ -107,10 +107,10 @@ TEST_F(L10nUtilTest, FindMostRelevantLocale) {
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
dict->SetString("value", "de");
available_locales.Append(std::move(dict));
- dict.reset(new base::DictionaryValue);
+ dict = std::make_unique<base::DictionaryValue>();
dict->SetString("value", "fr");
available_locales.Append(std::move(dict));
- dict.reset(new base::DictionaryValue);
+ dict = std::make_unique<base::DictionaryValue>();
dict->SetString("value", "en-GB");
available_locales.Append(std::move(dict));
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/network_state_informer.cc b/chromium/chrome/browser/ui/webui/chromeos/login/network_state_informer.cc
index 564cfbe0f74..e990f0f0868 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/network_state_informer.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/network_state_informer.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/logging.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/login/screens/network_error.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chromeos/network/network_state.h"
@@ -89,10 +88,7 @@ NetworkStateInformer::State GetStateForDefaultNetwork() {
} // namespace
-NetworkStateInformer::NetworkStateInformer()
- : state_(OFFLINE),
- weak_ptr_factory_(this) {
-}
+NetworkStateInformer::NetworkStateInformer() : state_(OFFLINE) {}
NetworkStateInformer::~NetworkStateInformer() {
if (NetworkHandler::IsInitialized()) {
@@ -108,10 +104,6 @@ void NetworkStateInformer::Init() {
this, FROM_HERE);
network_portal_detector::GetInstance()->AddAndFireObserver(this);
-
- registrar_.Add(this,
- chrome::NOTIFICATION_SESSION_STARTED,
- content::NotificationService::AllSources());
}
void NetworkStateInformer::AddObserver(NetworkStateInformerObserver* observer) {
@@ -134,16 +126,6 @@ void NetworkStateInformer::OnPortalDetectionCompleted(
UpdateStateAndNotify();
}
-void NetworkStateInformer::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- if (type == chrome::NOTIFICATION_SESSION_STARTED)
- registrar_.RemoveAll();
- else
- NOTREACHED() << "Unknown notification: " << type;
-}
-
void NetworkStateInformer::OnPortalDetected() {
UpdateStateAndNotify();
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/network_state_informer.h b/chromium/chrome/browser/ui/webui/chromeos/login/network_state_informer.h
index df2306eb8ec..32d79f0dc48 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/network_state_informer.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/network_state_informer.h
@@ -18,9 +18,6 @@
#include "chrome/browser/chromeos/login/ui/captive_portal_window_proxy.h"
#include "chromeos/network/network_state_handler_observer.h"
#include "chromeos/network/portal_detector/network_portal_detector.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
-#include "content/public/browser/notification_service.h"
namespace base {
class Value;
@@ -34,7 +31,6 @@ namespace chromeos {
class NetworkStateInformer
: public chromeos::NetworkStateHandlerObserver,
public chromeos::NetworkPortalDetector::Observer,
- public content::NotificationObserver,
public CaptivePortalWindowProxyDelegate,
public base::RefCounted<NetworkStateInformer> {
public:
@@ -74,11 +70,6 @@ class NetworkStateInformer
const NetworkState* network,
const NetworkPortalDetector::CaptivePortalState& state) override;
- // content::NotificationObserver implementation.
- void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) override;
-
// CaptivePortalWindowProxyDelegate implementation:
void OnPortalDetected() override;
@@ -102,9 +93,8 @@ class NetworkStateInformer
std::unique_ptr<base::Value> proxy_config_;
base::ObserverList<NetworkStateInformerObserver>::Unchecked observers_;
- content::NotificationRegistrar registrar_;
- base::WeakPtrFactory<NetworkStateInformer> weak_ptr_factory_;
+ base::WeakPtrFactory<NetworkStateInformer> weak_ptr_factory_{this};
};
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc
index 57c06c6fd28..0b45e2d2f8f 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc
@@ -6,7 +6,7 @@
#include <stdint.h>
-#include "ash/public/interfaces/constants.mojom.h"
+#include "ash/public/mojom/constants.mojom.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/strings/string_number_conversions.h"
@@ -42,8 +42,7 @@ bool IsWhiteListedVendorId(uint16_t vendor_id) {
} // namespace
-OobeDisplayChooser::OobeDisplayChooser()
- : scoped_observer_(this), weak_ptr_factory_(this) {
+OobeDisplayChooser::OobeDisplayChooser() : scoped_observer_(this) {
// |connector| may be null in tests.
auto* connector = content::GetSystemConnector();
if (connector) {
@@ -66,10 +65,9 @@ void OobeDisplayChooser::TryToPlaceUiOnTouchDisplay() {
display::Screen::GetScreen()->GetPrimaryDisplay();
if (primary_display.is_valid() && !TouchSupportAvailable(primary_display)) {
- base::PostTaskWithTraits(
- FROM_HERE, {BrowserThread::UI},
- base::BindOnce(&OobeDisplayChooser::MaybeMoveToTouchDisplay,
- weak_ptr_factory_.GetWeakPtr()));
+ base::PostTask(FROM_HERE, {BrowserThread::UI},
+ base::BindOnce(&OobeDisplayChooser::MaybeMoveToTouchDisplay,
+ weak_ptr_factory_.GetWeakPtr()));
}
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.h b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.h
index 5f2c67645d4..555050c7f87 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_OOBE_DISPLAY_CHOOSER_H_
#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_OOBE_DISPLAY_CHOOSER_H_
-#include "ash/public/interfaces/cros_display_config.mojom.h"
+#include "ash/public/mojom/cros_display_config.mojom.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
@@ -47,7 +47,7 @@ class OobeDisplayChooser : public ui::InputDeviceEventObserver {
scoped_observer_;
ash::mojom::CrosDisplayConfigControllerPtr cros_display_config_ptr_;
- base::WeakPtrFactory<OobeDisplayChooser> weak_ptr_factory_;
+ base::WeakPtrFactory<OobeDisplayChooser> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(OobeDisplayChooser);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
index b780e5acb2d..67f444cbacd 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
@@ -12,6 +12,7 @@
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/ash_switches.h"
+#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/command_line.h"
@@ -20,6 +21,7 @@
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
+#include "build/branding_buildflags.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_view.h"
@@ -88,7 +90,6 @@
#include "chrome/grit/component_extension_resources.h"
#include "chromeos/constants/chromeos_switches.h"
#include "chromeos/services/multidevice_setup/public/mojom/constants.mojom.h"
-#include "chromeos/services/network_config/public/mojom/constants.mojom.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_context.h"
@@ -133,9 +134,8 @@ constexpr char kOobeJSPath[] = "oobe.js";
constexpr char kProductLogoPath[] = "product-logo.png";
constexpr char kRecommendAppListViewHTMLPath[] = "recommend_app_list_view.html";
constexpr char kRecommendAppListViewJSPath[] = "recommend_app_list_view.js";
-constexpr char kStringsJSPath[] = "strings.js";
-#if defined(GOOGLE_CHROME_BUILD)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
constexpr char kLogo24PX1XSvgPath[] = "logo_24px-1x.svg";
constexpr char kLogo24PX2XSvgPath[] = "logo_24px-2x.svg";
constexpr char kSyncConsentIcons[] = "sync-consent-icons.html";
@@ -147,7 +147,7 @@ void AddProductLogoResources(content::WebUIDataSource* source) {
source->AddResourcePath(kArcAssistantLogoPath, IDR_ASSISTANT_LOGO_PNG);
source->AddResourcePath(kArcSupervisionIconPath, IDR_SUPERVISION_ICON_PNG);
-#if defined(GOOGLE_CHROME_BUILD)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
source->AddResourcePath(kLogo24PX1XSvgPath, IDR_PRODUCT_LOGO_24PX_1X);
source->AddResourcePath(kLogo24PX2XSvgPath, IDR_PRODUCT_LOGO_24PX_2X);
#endif
@@ -157,7 +157,7 @@ void AddProductLogoResources(content::WebUIDataSource* source) {
}
void AddSyncConsentResources(content::WebUIDataSource* source) {
-#if defined(GOOGLE_CHROME_BUILD)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
source->AddResourcePath(kSyncConsentIcons,
IDR_PRODUCT_CHROMEOS_SYNC_CONSENT_SCREEN_ICONS);
// No #else section here as Sync Settings screen is Chrome-specific.
@@ -179,12 +179,19 @@ void AddArcScreensResources(content::WebUIDataSource* source) {
IDR_ARC_SUPPORT_RECOMMEND_APP_LIST_VIEW_HTML);
}
+void AddAssistantScreensResources(content::WebUIDataSource* source) {
+ source->AddResourcePath("voice_match_animation.json",
+ IDR_ASSISTANT_VOICE_MATCH_ANIMATION);
+ source->OverrideContentSecurityPolicyWorkerSrc("worker-src blob: 'self';");
+}
+
void AddFingerprintResources(content::WebUIDataSource* source) {
int animation_id;
+ bool is_lottie_animation = false;
switch (quick_unlock::GetFingerprintLocation()) {
case quick_unlock::FingerprintLocation::TABLET_POWER_BUTTON:
- animation_id =
- IDR_LOGIN_FINGERPRINT_SCANNER_TABLET_POWER_BUTTON_ANIMATION;
+ is_lottie_animation = true;
+ animation_id = IDR_LOGIN_FINGER_PRINT_TABLET_ANIMATION;
break;
case quick_unlock::FingerprintLocation::KEYBOARD_BOTTOM_RIGHT:
animation_id =
@@ -194,7 +201,20 @@ void AddFingerprintResources(content::WebUIDataSource* source) {
animation_id = IDR_LOGIN_FINGERPRINT_SCANNER_LAPTOP_TOP_RIGHT_ANIMATION;
break;
}
- source->AddResourcePath("fingerprint_scanner_animation.png", animation_id);
+ if (is_lottie_animation) {
+ source->AddResourcePath("fingerprint_scanner_animation.json", animation_id);
+
+ // 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.
+ source->OverrideContentSecurityPolicyWorkerSrc("worker-src blob: 'self';");
+ } else {
+ source->AddResourcePath("fingerprint_scanner_animation.png", animation_id);
+ }
+
+ source->AddBoolean("useLottieAnimationForFingerprint", is_lottie_animation);
}
// Default and non-shared resource definition for kOobeDisplay display type.
@@ -235,7 +255,7 @@ content::WebUIDataSource* CreateOobeUIDataSource(
content::WebUIDataSource* source =
content::WebUIDataSource::Create(chrome::kChromeUIOobeHost);
source->AddLocalizedStrings(localized_strings);
- source->SetJsonPath(kStringsJSPath);
+ source->UseStringsJs();
// First, configure default and non-shared resources for the current display
// type.
@@ -255,6 +275,7 @@ content::WebUIDataSource* CreateOobeUIDataSource(
AddFingerprintResources(source);
AddSyncConsentResources(source);
AddArcScreensResources(source);
+ AddAssistantScreensResources(source);
source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS);
source->OverrideContentSecurityPolicyObjectSrc(
@@ -482,10 +503,7 @@ void OobeUI::BindPrivilegedHostDeviceSetter(
void OobeUI::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));
}
OobeUI::OobeUI(content::WebUI* web_ui, const GURL& url)
@@ -552,7 +570,7 @@ void OobeUI::GetLocalizedStrings(base::DictionaryValue* localized_strings) {
const std::string& app_locale = g_browser_process->GetApplicationLocale();
webui::SetLoadTimeDataDefaults(app_locale, localized_strings);
-#if defined(GOOGLE_CHROME_BUILD)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
localized_strings->SetString("buildType", "chrome");
#else
localized_strings->SetString("buildType", "chromium");
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.cc b/chromium/chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.cc
index 01aed9f684e..e86ea5107dc 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.cc
@@ -35,7 +35,7 @@ std::string ScreenlockIconSource::GetSource() const {
void ScreenlockIconSource::StartDataRequest(
const std::string& path,
- const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
+ const content::WebContents::Getter& wc_getter,
const content::URLDataSource::GotDataCallback& callback) {
if (!icon_provider_) {
callback.Run(GetDefaultIcon().As1xPNGBytes().get());
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.h b/chromium/chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.h
index d6715f1afa8..44b13c43bd5 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.h
@@ -24,7 +24,7 @@ class ScreenlockIconSource : public content::URLDataSource {
std::string GetSource() const override;
void StartDataRequest(
const std::string& path,
- const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
+ const content::WebContents::Getter& wc_getter,
const content::URLDataSource::GotDataCallback& callback) override;
std::string GetMimeType(const std::string& path) const override;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
index eca0146a80f..aa0e6206df5 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
@@ -11,8 +11,9 @@
#include <vector>
#include "ash/public/cpp/login_constants.h"
+#include "ash/public/cpp/tablet_mode.h"
#include "ash/public/cpp/wallpaper_types.h"
-#include "ash/public/interfaces/tray_action.mojom.h"
+#include "ash/public/mojom/tray_action.mojom.h"
#include "base/bind.h"
#include "base/i18n/number_formatting.h"
#include "base/location.h"
@@ -64,7 +65,6 @@
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/ui/ash/ime_controller_client.h"
#include "chrome/browser/ui/ash/session_controller_client_impl.h"
-#include "chrome/browser/ui/ash/tablet_mode_client.h"
#include "chrome/browser/ui/ash/wallpaper_controller_client.h"
#include "chrome/browser/ui/webui/chromeos/internet_detail_dialog.h"
#include "chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h"
@@ -97,6 +97,8 @@
#include "components/user_manager/user_manager.h"
#include "components/user_manager/user_type.h"
#include "components/version_info/version_info.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_source.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "google_apis/gaia/gaia_auth_util.h"
@@ -235,8 +237,7 @@ SigninScreenHandler::SigninScreenHandler(
->CapsLockIsEnabled()),
proxy_auth_dialog_reload_times_(kMaxGaiaReloadForProxyAuthDialog),
gaia_screen_handler_(gaia_screen_handler),
- histogram_helper_(new ErrorScreensHistogramHelper("Signin")),
- weak_factory_(this) {
+ histogram_helper_(new ErrorScreensHistogramHelper("Signin")) {
DCHECK(network_state_informer_.get());
DCHECK(error_screen_);
DCHECK(core_oobe_view_);
@@ -266,9 +267,9 @@ SigninScreenHandler::SigninScreenHandler(
base::Bind(&SigninScreenHandler::OnAllowedInputMethodsChanged,
base::Unretained(this)));
- TabletModeClient* tablet_mode_client = TabletModeClient::Get();
- tablet_mode_client->AddObserver(this);
- OnTabletModeToggled(tablet_mode_client->tablet_mode_enabled());
+ ash::TabletMode* tablet_mode = ash::TabletMode::Get();
+ tablet_mode->AddObserver(this);
+ OnTabletModeToggled(tablet_mode->InTabletMode());
WallpaperControllerClient::Get()->AddObserver(this);
}
@@ -276,7 +277,9 @@ SigninScreenHandler::SigninScreenHandler(
SigninScreenHandler::~SigninScreenHandler() {
if (auto* wallpaper_controller_client = WallpaperControllerClient::Get())
wallpaper_controller_client->RemoveObserver(this);
- TabletModeClient::Get()->RemoveObserver(this);
+ // Ash maybe released before us.
+ if (ash::TabletMode::Get())
+ ash::TabletMode::Get()->RemoveObserver(this);
OobeUI* oobe_ui = GetOobeUI();
if (oobe_ui && oobe_ui_observer_added_)
oobe_ui->RemoveObserver(this);
@@ -439,6 +442,8 @@ void SigninScreenHandler::RegisterMessages() {
AddCallback("launchIncognito", &SigninScreenHandler::HandleLaunchIncognito);
AddCallback("launchPublicSession",
&SigninScreenHandler::HandleLaunchPublicSession);
+ AddCallback("launchSAMLPublicSession",
+ &SigninScreenHandler::HandleLaunchSAMLPublicSession);
AddRawCallback("offlineLogin", &SigninScreenHandler::HandleOfflineLogin);
AddCallback("rebootSystem", &SigninScreenHandler::HandleRebootSystem);
AddCallback("removeUser", &SigninScreenHandler::HandleRemoveUser);
@@ -1016,6 +1021,14 @@ void SigninScreenHandler::SuspendDone(const base::TimeDelta& sleep_duration) {
}
}
+void SigninScreenHandler::OnTabletModeStarted() {
+ OnTabletModeToggled(true);
+}
+
+void SigninScreenHandler::OnTabletModeEnded() {
+ OnTabletModeToggled(false);
+}
+
void SigninScreenHandler::OnTabletModeToggled(bool enabled) {
CallJS("login.AccountPickerScreen.setTabletModeState", enabled);
}
@@ -1102,6 +1115,14 @@ void SigninScreenHandler::HandleLaunchIncognito() {
delegate_->Login(context, SigninSpecifics());
}
+void SigninScreenHandler::HandleLaunchSAMLPublicSession(
+ const std::string& email) {
+ const AccountId account_id = user_manager::known_user::GetAccountId(
+ email, std::string() /* id */, AccountType::UNKNOWN);
+ SigninScreenHandler::HandleLaunchPublicSession(account_id, std::string(),
+ std::string());
+}
+
void SigninScreenHandler::HandleLaunchPublicSession(
const AccountId& account_id,
const std::string& locale,
@@ -1367,7 +1388,7 @@ void SigninScreenHandler::SendPublicSessionKeyboardLayouts(
void SigninScreenHandler::HandleGetTabletModeState() {
CallJS("login.AccountPickerScreen.setTabletModeState",
- TabletModeClient::Get()->tablet_mode_enabled());
+ ash::TabletMode::Get()->InTabletMode());
}
void SigninScreenHandler::HandleGetDemoModeState() {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h
index 48988d3b853..6195aa7c0d3 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h
@@ -10,6 +10,7 @@
#include <set>
#include <string>
+#include "ash/public/cpp/tablet_mode_observer.h"
#include "ash/public/cpp/wallpaper_controller_observer.h"
#include "base/callback.h"
#include "base/compiler_specific.h"
@@ -21,7 +22,6 @@
#include "chrome/browser/chromeos/login/signin_specifics.h"
#include "chrome/browser/chromeos/login/ui/login_display.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
-#include "chrome/browser/ui/ash/tablet_mode_client_observer.h"
#include "chrome/browser/ui/webui/chromeos/login/base_webui_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h"
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
@@ -183,7 +183,7 @@ class SigninScreenHandler
public NetworkStateInformer::NetworkStateInformerObserver,
public PowerManagerClient::Observer,
public input_method::ImeKeyboard::Observer,
- public TabletModeClientObserver,
+ public ash::TabletModeObserver,
public OobeUI::Observer,
public ash::WallpaperControllerObserver {
public:
@@ -302,8 +302,11 @@ class SigninScreenHandler
// PowerManagerClient::Observer implementation:
void SuspendDone(const base::TimeDelta& sleep_duration) override;
- // TabletModeClientObserver:
- void OnTabletModeToggled(bool enabled) override;
+ // ash::TabletModeObserver:
+ void OnTabletModeStarted() override;
+ void OnTabletModeEnded() override;
+
+ void OnTabletModeToggled(bool enabled);
// Restore input focus to current user pod.
void RefocusCurrentPod();
@@ -324,6 +327,7 @@ class SigninScreenHandler
const std::string& password);
void HandleAttemptUnlock(const std::string& username);
void HandleLaunchIncognito();
+ void HandleLaunchSAMLPublicSession(const std::string& email);
void HandleLaunchPublicSession(const AccountId& account_id,
const std::string& locale,
const std::string& input_method);
@@ -503,7 +507,7 @@ class SigninScreenHandler
std::unique_ptr<AccountId> focused_pod_account_id_;
- base::WeakPtrFactory<SigninScreenHandler> weak_factory_;
+ base::WeakPtrFactory<SigninScreenHandler> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/signin_userlist_unittest.cc b/chromium/chrome/browser/ui/webui/chromeos/login/signin_userlist_unittest.cc
index a235cccacbf..205688cf91b 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/signin_userlist_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/signin_userlist_unittest.cc
@@ -18,7 +18,7 @@
#include "components/account_id/account_id.h"
#include "components/user_manager/scoped_user_manager.h"
#include "components/user_manager/user.h"
-#include "content/public/test/test_browser_thread_bundle.h"
+#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -52,8 +52,8 @@ class SigninPrepareUserListTest : public testing::Test,
profile_manager_.reset(
new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
ASSERT_TRUE(profile_manager_->SetUp());
- controller_.reset(new MultiProfileUserController(
- this, TestingBrowserProcess::GetGlobal()->local_state()));
+ controller_ = std::make_unique<MultiProfileUserController>(
+ this, TestingBrowserProcess::GetGlobal()->local_state());
fake_user_manager_->set_multi_profile_user_controller(controller_.get());
for (size_t i = 0; i < base::size(kUsersPublic); ++i)
@@ -78,7 +78,7 @@ class SigninPrepareUserListTest : public testing::Test,
FakeChromeUserManager* user_manager() { return fake_user_manager_; }
private:
- content::TestBrowserThreadBundle thread_bundle_;
+ content::BrowserTaskEnvironment task_environment_;
ScopedCrosSettingsTestHelper cros_settings_test_helper_;
FakeChromeUserManager* fake_user_manager_;
user_manager::ScopedUserManager user_manager_enabler_;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.cc
index bea38eec2ff..e4b7d641ffc 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.cc
@@ -13,7 +13,7 @@ constexpr StaticOobeScreenId UserBoardView::kScreenId;
UserBoardScreenHandler::UserBoardScreenHandler(
JSCallsContainer* js_calls_container)
- : BaseScreenHandler(kScreenId, js_calls_container), weak_factory_(this) {}
+ : BaseScreenHandler(kScreenId, js_calls_container) {}
UserBoardScreenHandler::~UserBoardScreenHandler() {
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h
index ada66bdbba9..8aadb916d4d 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h
@@ -63,7 +63,7 @@ class UserBoardScreenHandler : public BaseScreenHandler, public UserBoardView {
base::WeakPtr<UserBoardView> GetWeakPtr() override;
UserSelectionScreen* screen_ = nullptr;
- base::WeakPtrFactory<UserBoardScreenHandler> weak_factory_;
+ base::WeakPtrFactory<UserBoardScreenHandler> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(UserBoardScreenHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/machine_learning/BUILD.gn b/chromium/chrome/browser/ui/webui/chromeos/machine_learning/BUILD.gn
index f6ccee9ab2e..3adbd9c1354 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/machine_learning/BUILD.gn
+++ b/chromium/chrome/browser/ui/webui/chromeos/machine_learning/BUILD.gn
@@ -12,7 +12,4 @@ mojom("mojo_bindings") {
deps = [
"//chromeos/services/machine_learning/public/mojom",
]
-
- # TODO(https://crbug.com/968369): Change to use new names.
- use_old_js_lite_bindings_names = true
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_dialog.cc
index a436b2ad466..dc4915027ca 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_dialog.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_dialog.cc
@@ -91,7 +91,7 @@ MultiDeviceSetupDialogUI::MultiDeviceSetupDialogUI(content::WebUI* web_ui)
content::WebUIDataSource::Create(chrome::kChromeUIMultiDeviceSetupHost);
chromeos::multidevice_setup::AddLocalizedStrings(source);
- source->SetJsonPath("strings.js");
+ source->UseStringsJs();
source->SetDefaultResource(
IDR_MULTIDEVICE_SETUP_MULTIDEVICE_SETUP_DIALOG_HTML);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_localized_strings_provider.cc b/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_localized_strings_provider.cc
index 7a95459f913..9314ef72f38 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_localized_strings_provider.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_localized_strings_provider.cc
@@ -25,6 +25,7 @@
#include "content/public/browser/web_ui_data_source.h"
#include "services/service_manager/public/cpp/connector.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/chromeos/devicetype_utils.h"
namespace chromeos {
@@ -47,8 +48,6 @@ constexpr LocalizedString kLocalizedStringsWithoutPlaceholders[] = {
IDS_MULTIDEVICE_SETUP_START_SETUP_PAGE_MULTIPLE_DEVICE_HEADER},
{"startSetupPageSingleDeviceHeader",
IDS_MULTIDEVICE_SETUP_START_SETUP_PAGE_SINGLE_DEVICE_HEADER},
- {"startSetupPageFeatureListHeader",
- IDS_MULTIDEVICE_SETUP_START_SETUP_PAGE_FEATURE_LIST_HEADER},
{"startSetupPageFeatureListInstallApps",
IDS_MULTIDEVICE_SETUP_START_SETUP_PAGE_INSTALL_APPS_DESCRIPTION},
{"startSetupPageFeatureListAddFeatures",
@@ -83,6 +82,7 @@ GetLocalizedStringsWithPlaceholders() {
"startSetupPageMessage",
l10n_util::GetStringFUTF16(
IDS_MULTIDEVICE_SETUP_START_SETUP_PAGE_MESSAGE,
+ ui::GetChromeOSDeviceName(),
base::ASCIIToUTF16(kFootnoteMarker),
base::UTF8ToUTF16(
chromeos::multidevice_setup::
@@ -96,6 +96,12 @@ GetLocalizedStringsWithPlaceholders() {
base::ASCIIToUTF16(kFootnoteMarker)));
localized_strings.emplace_back(
+ "startSetupPageFeatureListHeader",
+ l10n_util::GetStringFUTF16(
+ IDS_MULTIDEVICE_SETUP_START_SETUP_PAGE_FEATURE_LIST_HEADER,
+ ui::GetChromeOSDeviceName()));
+
+ localized_strings.emplace_back(
"startSetupPageFeatureListAwm",
l10n_util::GetStringFUTF16(
IDS_MULTIDEVICE_SETUP_START_SETUP_PAGE_AWM_DESCRIPTION,
@@ -128,11 +134,15 @@ void AddLocalizedValuesToBuilder(::login::LocalizedValuesBuilder* builder) {
// localization calls separately.
builder->AddF(
"startSetupPageMessage", IDS_MULTIDEVICE_SETUP_START_SETUP_PAGE_MESSAGE,
- base::ASCIIToUTF16(kFootnoteMarker),
+ ui::GetChromeOSDeviceName(), base::ASCIIToUTF16(kFootnoteMarker),
base::UTF8ToUTF16(chromeos::multidevice_setup::
GetBoardSpecificBetterTogetherSuiteLearnMoreUrl()
.spec()));
+ builder->AddF("startSetupPageFeatureListHeader",
+ IDS_MULTIDEVICE_SETUP_START_SETUP_PAGE_FEATURE_LIST_HEADER,
+ ui::GetChromeOSDeviceName());
+
builder->AddF("startSetupPageFootnote",
IDS_MULTIDEVICE_SETUP_START_SETUP_PAGE_FOOTNOTE,
base::ASCIIToUTF16(kFootnoteMarker));
diff --git a/chromium/chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.cc b/chromium/chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.cc
index 34e2447eafb..2bea1501801 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.cc
@@ -32,7 +32,6 @@ constexpr LocalizedString kElementLocalizedStrings[] = {
{"OncTypeTether", IDS_NETWORK_TYPE_TETHER},
{"OncTypeVPN", IDS_NETWORK_TYPE_VPN},
{"OncTypeWiFi", IDS_NETWORK_TYPE_WIFI},
- {"OncTypeWiMAX", IDS_NETWORK_TYPE_WIMAX},
{"networkListItemConnected", IDS_STATUSBAR_NETWORK_DEVICE_CONNECTED},
{"networkListItemConnecting", IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING},
{"networkListItemConnectingTo", IDS_NETWORK_LIST_CONNECTING_TO},
@@ -76,6 +75,8 @@ void AddOncLocalizedStrings(content::WebUIDataSource* html_source) {
IDS_ONC_CELLULAR_ACTIVATION_STATE_NOT_ACTIVATED},
{"OncCellular-ActivationState_PartiallyActivated",
IDS_ONC_CELLULAR_ACTIVATION_STATE_PARTIALLY_ACTIVATED},
+ {"OncCellular-ActivationState_NoService",
+ IDS_ONC_CELLULAR_ACTIVATION_STATE_NO_SERVICE},
{"OncCellular-Family", IDS_ONC_CELLULAR_FAMILY},
{"OncCellular-FirmwareRevision", IDS_ONC_CELLULAR_FIRMWARE_REVISION},
{"OncCellular-HardwareRevision", IDS_ONC_CELLULAR_HARDWARE_REVISION},
@@ -86,7 +87,6 @@ void AddOncLocalizedStrings(content::WebUIDataSource* html_source) {
{"OncCellular-Manufacturer", IDS_ONC_CELLULAR_MANUFACTURER},
{"OncCellular-ModelID", IDS_ONC_CELLULAR_MODEL_ID},
{"OncCellular-NetworkTechnology", IDS_ONC_CELLULAR_NETWORK_TECHNOLOGY},
- {"OncCellular-PRLVersion", IDS_ONC_CELLULAR_PRL_VERSION},
{"OncCellular-RoamingState", IDS_ONC_CELLULAR_ROAMING_STATE},
{"OncCellular-RoamingState_Home", IDS_ONC_CELLULAR_ROAMING_STATE_HOME},
{"OncCellular-RoamingState_Roaming",
@@ -138,11 +138,11 @@ void AddOncLocalizedStrings(content::WebUIDataSource* html_source) {
{"OncVPN-IPsec-PSK", IDS_ONC_VPN_IPSEC_PSK},
{"OncVPN-L2TP-Password", IDS_ONC_VPN_PASSWORD},
{"OncVPN-L2TP-Username", IDS_ONC_VPN_USERNAME},
+ {"OncVPN-OpenVPN-ExtraHosts", IDS_ONC_VPN_OPENVPN_EXTRA_HOSTS},
{"OncVPN-OpenVPN-OTP", IDS_ONC_VPN_OPENVPN_OTP},
{"OncVPN-OpenVPN-Password", IDS_ONC_VPN_PASSWORD},
{"OncVPN-OpenVPN-Username", IDS_ONC_VPN_USERNAME},
- {"OncVPN-ThirdPartyVPN-ProviderName",
- IDS_ONC_VPN_THIRD_PARTY_VPN_PROVIDER_NAME},
+ {"OncVPN-ProviderName", IDS_ONC_VPN_THIRD_PARTY_VPN_PROVIDER_NAME},
{"OncVPN-Type", IDS_ONC_VPN_TYPE},
{"OncVPN-Type_L2TP_IPsec", IDS_ONC_VPN_TYPE_L2TP_IPSEC},
{"OncVPN-Type_L2TP_IPsec_PSK", IDS_ONC_VPN_TYPE_L2TP_IPSEC_PSK},
@@ -159,7 +159,6 @@ void AddOncLocalizedStrings(content::WebUIDataSource* html_source) {
{"OncWiFi-Security_WPA-PSK", IDS_ONC_WIFI_SECURITY_PSK},
{"OncWiFi-Security_WEP-8021X", IDS_ONC_WIFI_SECURITY_EAP},
{"OncWiFi-SignalStrength", IDS_ONC_WIFI_SIGNAL_STRENGTH},
- {"OncWiMAX-EAP-Identity", IDS_ONC_WIMAX_EAP_IDENTITY},
{"Oncipv4-Gateway", IDS_ONC_IPV4_GATEWAY},
{"Oncipv4-IPAddress", IDS_ONC_IPV4_ADDRESS},
{"Oncipv4-RoutingPrefix", IDS_ONC_IPV4_ROUTING_PREFIX},
diff --git a/chromium/chrome/browser/ui/webui/chromeos/network_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/network_ui.cc
index 4c767fef5ea..6e1c9d1f886 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/network_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/network_ui.cc
@@ -8,6 +8,7 @@
#include <string>
#include <utility>
+#include "ash/public/cpp/network_config_service.h"
#include "base/bind.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
@@ -27,14 +28,12 @@
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "chromeos/network/onc/onc_utils.h"
-#include "chromeos/services/network_config/public/mojom/constants.mojom.h"
#include "components/device_event_log/device_event_log.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/browser/web_ui_message_handler.h"
-#include "services/service_manager/public/cpp/connector.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
#include "ui/base/l10n/l10n_util.h"
@@ -88,7 +87,7 @@ void SetDeviceProperties(base::DictionaryValue* dictionary) {
class NetworkConfigMessageHandler : public content::WebUIMessageHandler {
public:
- NetworkConfigMessageHandler() : weak_ptr_factory_(this) {}
+ NetworkConfigMessageHandler() {}
~NetworkConfigMessageHandler() override {}
// WebUIMessageHandler implementation.
@@ -273,7 +272,7 @@ class NetworkConfigMessageHandler : public content::WebUIMessageHandler {
InternetConfigDialog::ShowDialogForNetworkType(onc_type);
}
- base::WeakPtrFactory<NetworkConfigMessageHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<NetworkConfigMessageHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(NetworkConfigMessageHandler);
};
@@ -363,7 +362,7 @@ NetworkUI::NetworkUI(content::WebUI* web_ui)
network_element::AddLocalizedStrings(html);
- html->SetJsonPath("strings.js");
+ html->UseStringsJs();
html->AddResourcePath("network_ui.css", IDR_NETWORK_UI_CSS);
html->AddResourcePath("network_ui.js", IDR_NETWORK_UI_JS);
html->SetDefaultResource(IDR_NETWORK_UI_HTML);
@@ -378,9 +377,7 @@ NetworkUI::~NetworkUI() {}
void NetworkUI::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));
}
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/power_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/power_ui.cc
index dd93475bca4..b77f4d2f921 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/power_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/power_ui.cc
@@ -33,8 +33,6 @@ namespace chromeos {
namespace {
-const char kStringsJsFile[] = "strings.js";
-
const char kRequestBatteryChargeDataCallback[] = "requestBatteryChargeData";
const char kOnRequestBatteryChargeDataFunction[] =
"powerUI.showBatteryChargeData";
@@ -260,7 +258,7 @@ PowerUI::PowerUI(content::WebUI* web_ui) : content::WebUIController(web_ui) {
};
AddLocalizedStringsBulk(html, kStrings, base::size(kStrings));
- html->SetJsonPath(kStringsJsFile);
+ html->UseStringsJs();
html->AddResourcePath("power.css", IDR_ABOUT_POWER_CSS);
html->AddResourcePath("power.js", IDR_ABOUT_POWER_JS);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/set_time_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/set_time_ui.cc
index 7c2890f0231..1376878c1d8 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/set_time_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/set_time_ui.cc
@@ -128,6 +128,12 @@ class SetTimeMessageHandler : public content::WebUIMessageHandler,
return;
}
+ double seconds;
+ if (!args->GetDouble(0, &seconds)) {
+ NOTREACHED();
+ return;
+ }
+
AccountId account_id;
bool is_user_logged_in = user_manager::UserManager::Get()->IsUserLoggedIn();
if (is_user_logged_in) {
@@ -139,7 +145,8 @@ class SetTimeMessageHandler : public content::WebUIMessageHandler,
base::BindRepeating(&SetTimeMessageHandler::OnParentAccessValidation,
weak_factory_.GetWeakPtr()),
ash::ParentAccessRequestReason::kChangeTime,
- !is_user_logged_in /* extra_dimmer */);
+ !is_user_logged_in /* extra_dimmer */,
+ base::Time::FromDoubleT(seconds));
}
void OnParentAccessValidation(bool success) {
@@ -188,7 +195,7 @@ SetTimeUI::SetTimeUI(content::WebUI* web_ui) : WebDialogUI(web_ui) {
values.SetDouble("buildTime", base::GetBuildTime().ToJsTime());
source->AddLocalizedStrings(values);
- source->SetJsonPath("strings.js");
+ source->UseStringsJs();
source->AddResourcePath("set_time_browser_proxy.html",
IDR_SET_TIME_BROWSER_PROXY_HTML);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/slow_trace_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/slow_trace_ui.cc
index 07d906c1abd..c5c1b2cba55 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/slow_trace_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/slow_trace_ui.cc
@@ -34,7 +34,7 @@ std::string SlowTraceSource::GetSource() {
void SlowTraceSource::StartDataRequest(
const std::string& path,
- const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
+ const content::WebContents::Getter& wc_getter,
const content::URLDataSource::GotDataCallback& callback) {
int trace_id = 0;
size_t pos = path.find('#');
diff --git a/chromium/chrome/browser/ui/webui/chromeos/slow_trace_ui.h b/chromium/chrome/browser/ui/webui/chromeos/slow_trace_ui.h
index 77a04463b1d..8d0007981f7 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/slow_trace_ui.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/slow_trace_ui.h
@@ -32,7 +32,7 @@ class SlowTraceSource : public content::URLDataSource {
std::string GetSource() override;
void StartDataRequest(
const std::string& path,
- const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
+ const content::WebContents::Getter& wc_getter,
const content::URLDataSource::GotDataCallback& callback) override;
std::string GetMimeType(const std::string& path) override;
bool AllowCaching() override;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/slow_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/slow_ui.cc
index 4e199978350..1020d867f72 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/slow_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/slow_ui.cc
@@ -101,7 +101,7 @@ void SlowHandler::RegisterMessages() {
kJsApiLoadComplete,
base::BindRepeating(&SlowHandler::LoadComplete, base::Unretained(this)));
- user_pref_registrar_.reset(new PrefChangeRegistrar);
+ user_pref_registrar_ = std::make_unique<PrefChangeRegistrar>();
user_pref_registrar_->Init(profile_->GetPrefs());
user_pref_registrar_->Add(prefs::kPerformanceTracingEnabled,
base::Bind(&SlowHandler::UpdatePage,
diff --git a/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_credentials_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_credentials_dialog.cc
index d20bb682266..4b31716cbeb 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_credentials_dialog.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_credentials_dialog.cc
@@ -87,7 +87,7 @@ SmbCredentialsDialogUI::SmbCredentialsDialogUI(content::WebUI* web_ui)
AddSmbCredentialsDialogStrings(source);
- source->SetJsonPath("strings.js");
+ source->UseStringsJs();
source->SetDefaultResource(IDR_SMB_CREDENTIALS_DIALOG_CONTAINER_HTML);
source->AddResourcePath("smb_credentials_dialog.html",
IDR_SMB_CREDENTIALS_DIALOG_HTML);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_handler.cc
index 4b224daa69c..819e4fb6cf7 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_handler.cc
@@ -32,8 +32,7 @@ base::Value BuildShareList(const std::vector<smb_client::SmbUrl>& shares) {
} // namespace
-SmbHandler::SmbHandler(Profile* profile)
- : profile_(profile), weak_ptr_factory_(this) {}
+SmbHandler::SmbHandler(Profile* profile) : profile_(profile) {}
SmbHandler::~SmbHandler() = default;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_handler.h b/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_handler.h
index 38354b5e168..ef94923201b 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_handler.h
@@ -6,7 +6,6 @@
#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_SMB_SHARES_SMB_HANDLER_H_
#include "base/callback_forward.h"
-#include "base/files/file.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/chromeos/smb_client/smb_service.h"
@@ -52,7 +51,7 @@ class SmbHandler : public content::WebUIMessageHandler {
bool host_discovery_done_ = false;
base::OnceClosure stored_mount_call_;
Profile* const profile_;
- base::WeakPtrFactory<SmbHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<SmbHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(SmbHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_share_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_share_dialog.cc
index ac5be07201d..5bbece77c06 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_share_dialog.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_share_dialog.cc
@@ -70,7 +70,7 @@ SmbShareDialogUI::SmbShareDialogUI(content::WebUI* web_ui)
source->AddBoolean("isActiveDirectoryUser",
user && user->IsActiveDirectoryUser());
- source->SetJsonPath("strings.js");
+ source->UseStringsJs();
source->SetDefaultResource(IDR_SMB_SHARES_DIALOG_CONTAINER_HTML);
source->AddResourcePath("smb_share_dialog.html", IDR_SMB_SHARES_DIALOG_HTML);
source->AddResourcePath("smb_share_dialog.js", IDR_SMB_SHARES_DIALOG_JS);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_message_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_message_handler.cc
index d84d732aa42..23d28d7e47f 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_message_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_message_handler.cc
@@ -198,8 +198,7 @@ base::Value GetSysInfo() {
} // namespace
-SysInternalsMessageHandler::SysInternalsMessageHandler()
- : weak_ptr_factory_(this) {}
+SysInternalsMessageHandler::SysInternalsMessageHandler() {}
SysInternalsMessageHandler::~SysInternalsMessageHandler() {}
@@ -222,8 +221,9 @@ void SysInternalsMessageHandler::HandleGetSysInfo(const base::ListValue* args) {
}
base::Value callback_id = list[0].Clone();
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, base::MayBlock(), base::BindOnce(&GetSysInfo),
+ base::PostTaskAndReplyWithResult(
+ FROM_HERE, {base::ThreadPool(), base::MayBlock()},
+ base::BindOnce(&GetSysInfo),
base::BindOnce(&SysInternalsMessageHandler::ReplySysInfo,
weak_ptr_factory_.GetWeakPtr(), std::move(callback_id)));
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_message_handler.h b/chromium/chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_message_handler.h
index 4a21bbabe73..6e84b36f0b2 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_message_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_message_handler.h
@@ -59,7 +59,7 @@ class SysInternalsMessageHandler : public content::WebUIMessageHandler {
//
void ReplySysInfo(base::Value callback_id, base::Value result);
- base::WeakPtrFactory<SysInternalsMessageHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<SysInternalsMessageHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(SysInternalsMessageHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.cc b/chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.cc
index 6fcd5cd124a..ce6790a8ec3 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.cc
@@ -162,8 +162,9 @@ void SystemWebDialogDelegate::ShowSystemDialogForBrowserContext(
if (!parent && GetDialogModalType() == ui::MODAL_TYPE_NONE)
extra_params.z_order = ui::ZOrderLevel::kFloatingWindow;
AdjustWidgetInitParams(&extra_params);
- dialog_window_ = chrome::ShowWebDialogWithParams(parent, browser_context,
- this, &extra_params);
+ dialog_window_ = chrome::ShowWebDialogWithParams(
+ parent, browser_context, this,
+ base::make_optional<views::Widget::InitParams>(std::move(extra_params)));
}
void SystemWebDialogDelegate::ShowSystemDialog(gfx::NativeWindow parent) {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.cc b/chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.cc
index 889a692e022..2609acbbbde 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.cc
@@ -26,7 +26,8 @@ constexpr char kDefaultMime[] = "text/html";
void ReadFile(const base::FilePath& path,
const content::URLDataSource::GotDataCallback& callback) {
std::string content;
- CHECK(base::ReadFileToString(path, &content)) << path;
+ bool result = base::ReadFileToString(path, &content);
+ DCHECK(result) << path;
scoped_refptr<base::RefCountedString> response =
base::RefCountedString::TakeString(&content);
callback.Run(response.get());
@@ -39,16 +40,17 @@ std::string TerminalSource::GetSource() {
void TerminalSource::StartDataRequest(
const std::string& path,
- const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
+ const content::WebContents::Getter& wc_getter,
const content::URLDataSource::GotDataCallback& callback) {
- base::FilePath file_path(kTerminalRoot);
- if (path.empty()) {
- file_path = file_path.Append(kDefaultFile);
- } else {
- file_path = file_path.Append(path);
- }
- base::PostTaskWithTraits(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_BLOCKING},
+ // Reparse path to strip any query or fragment, skip first '/' in path.
+ std::string reparsed =
+ GURL(chrome::kChromeUITerminalURL + path).path().substr(1);
+ if (reparsed.empty())
+ reparsed = kDefaultFile;
+ base::FilePath file_path = base::FilePath(kTerminalRoot).Append(reparsed);
+ base::PostTask(
+ FROM_HERE,
+ {base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_BLOCKING},
base::BindOnce(&ReadFile, file_path, callback));
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.h b/chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.h
index dc922840e02..b5acfdeb435 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.h
@@ -8,8 +8,8 @@
#include <string>
#include "base/macros.h"
-#include "content/public/browser/resource_request_info.h"
#include "content/public/browser/url_data_source.h"
+#include "content/public/browser/web_contents.h"
class TerminalSource : public content::URLDataSource {
public:
@@ -21,7 +21,7 @@ class TerminalSource : public content::URLDataSource {
void StartDataRequest(
const std::string& path,
- const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
+ const content::WebContents::Getter& wc_getter,
const content::URLDataSource::GotDataCallback& callback) override;
std::string GetMimeType(const std::string& path) override;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/user_image_source.cc b/chromium/chrome/browser/ui/webui/chromeos/user_image_source.cc
index 63c867618b6..e8ca63d7cbf 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/user_image_source.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/user_image_source.cc
@@ -179,7 +179,7 @@ std::string UserImageSource::GetSource() {
void UserImageSource::StartDataRequest(
const std::string& path,
- const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
+ const content::WebContents::Getter& wc_getter,
const content::URLDataSource::GotDataCallback& callback) {
std::string email;
int frame = -1;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/user_image_source.h b/chromium/chrome/browser/ui/webui/chromeos/user_image_source.h
index 1e73aed0637..f20af23e762 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/user_image_source.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/user_image_source.h
@@ -33,7 +33,7 @@ class UserImageSource : public content::URLDataSource {
std::string GetSource() override;
void StartDataRequest(
const std::string& path,
- const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
+ const content::WebContents::Getter& wc_getter,
const content::URLDataSource::GotDataCallback& callback) override;
std::string GetMimeType(const std::string& path) override;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/video_source.cc b/chromium/chrome/browser/ui/webui/chromeos/video_source.cc
index 4db1b33388d..4b56024a718 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/video_source.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/video_source.cc
@@ -14,7 +14,7 @@
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
#include "base/task/post_task.h"
-#include "base/task/thread_pool/thread_pool.h"
+#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/task_runner_util.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/common/url_constants.h"
@@ -54,9 +54,9 @@ void VideoLoaded(
} // namespace
-VideoSource::VideoSource() : weak_factory_(this) {
- task_runner_ = base::CreateSequencedTaskRunnerWithTraits(
- {base::MayBlock(), base::TaskPriority::USER_VISIBLE,
+VideoSource::VideoSource() {
+ task_runner_ = base::CreateSequencedTaskRunner(
+ {base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE,
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN});
}
@@ -68,7 +68,7 @@ std::string VideoSource::GetSource() {
void VideoSource::StartDataRequest(
const std::string& path,
- const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
+ const content::WebContents::Getter& wc_getter,
const content::URLDataSource::GotDataCallback& got_data_callback) {
if (!IsWhitelisted(path)) {
got_data_callback.Run(nullptr);
@@ -77,8 +77,9 @@ void VideoSource::StartDataRequest(
const base::FilePath asset_dir(chrome::kChromeOSAssetPath);
const base::FilePath video_path = asset_dir.AppendASCII(path);
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
+ base::PostTaskAndReplyWithResult(
+ FROM_HERE,
+ {base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE},
base::BindOnce(&base::PathExists, video_path),
base::BindOnce(&VideoSource::StartDataRequestAfterPathExists,
weak_factory_.GetWeakPtr(), video_path,
diff --git a/chromium/chrome/browser/ui/webui/chromeos/video_source.h b/chromium/chrome/browser/ui/webui/chromeos/video_source.h
index 316509a93ec..c8f6cae1d3a 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/video_source.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/video_source.h
@@ -29,11 +29,10 @@ class VideoSource : public content::URLDataSource {
// content::URLDataSource:
std::string GetSource() override;
- void StartDataRequest(
- const std::string& path,
- const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
- const content::URLDataSource::GotDataCallback& got_data_callback)
- override;
+ void StartDataRequest(const std::string& path,
+ const content::WebContents::Getter& wc_getter,
+ const content::URLDataSource::GotDataCallback&
+ got_data_callback) override;
std::string GetMimeType(const std::string& path) override;
private:
@@ -46,7 +45,7 @@ class VideoSource : public content::URLDataSource {
// The background task runner on which file I/O is performed.
scoped_refptr<base::SequencedTaskRunner> task_runner_;
- base::WeakPtrFactory<VideoSource> weak_factory_;
+ base::WeakPtrFactory<VideoSource> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(VideoSource);
};