diff options
Diffstat (limited to 'chromium/chrome/browser/ui/webui/chromeos/login')
26 files changed, 436 insertions, 142 deletions
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/OWNERS b/chromium/chrome/browser/ui/webui/chromeos/login/OWNERS index a18954dc038..5dbb46f035d 100644 --- a/chromium/chrome/browser/ui/webui/chromeos/login/OWNERS +++ b/chromium/chrome/browser/ui/webui/chromeos/login/OWNERS @@ -1,10 +1,10 @@ -# (in PST) +# primary (in CET) +antrim@chromium.org +rsorokin@chromium.org + +# secondary (in PST) achuith@chromium.org alemate@chromium.org tbarzic@chromium.org -# (in CET) -antrim@chromium.org -per-file *active_directory*=rsorokin@chromium.org - # COMPONENT: UI>Shell>OOBE 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 f53cede13a4..6979bd6f555 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 @@ -56,28 +56,25 @@ AssistantOptInFlowScreenHandler::AssistantOptInFlowScreenHandler( AssistantOptInFlowScreenHandler::~AssistantOptInFlowScreenHandler() { if (client_binding_) StopSpeakerIdEnrollment(); - if (arc::VoiceInteractionControllerClient::Get()) { - arc::VoiceInteractionControllerClient::Get()->RemoveObserver(this); - } - if (screen_) { + if (ash::AssistantState::Get()) + ash::AssistantState::Get()->RemoveObserver(this); + if (screen_) screen_->OnViewDestroyed(this); - } } void AssistantOptInFlowScreenHandler::DeclareLocalizedValues( ::login::LocalizedValuesBuilder* builder) { builder->Add("locale", g_browser_process->GetApplicationLocale()); - builder->Add("assistantLogo", IDS_VOICE_INTERACTION_LOGO); - builder->Add("assistantOptinLoading", - IDS_VOICE_INTERACTION_VALUE_PROP_LOADING); + builder->Add("assistantLogo", IDS_ASSISTANT_LOGO); + builder->Add("assistantOptinLoading", IDS_ASSISTANT_VALUE_PROP_LOADING); builder->Add("assistantOptinLoadErrorTitle", - IDS_VOICE_INTERACTION_VALUE_PROP_LOAD_ERROR_TITLE); + IDS_ASSISTANT_VALUE_PROP_LOAD_ERROR_TITLE); builder->Add("assistantOptinLoadErrorMessage", - IDS_VOICE_INTERACTION_VALUE_PROP_LOAD_ERROR_MESSAGE); + IDS_ASSISTANT_VALUE_PROP_LOAD_ERROR_MESSAGE); builder->Add("assistantOptinSkipButton", - IDS_VOICE_INTERACTION_VALUE_PROP_SKIP_BUTTON); + IDS_ASSISTANT_VALUE_PROP_SKIP_BUTTON); builder->Add("assistantOptinRetryButton", - IDS_VOICE_INTERACTION_VALUE_PROP_RETRY_BUTTON); + IDS_ASSISTANT_VALUE_PROP_RETRY_BUTTON); builder->Add("assistantVoiceMatchTitle", IDS_ASSISTANT_VOICE_MATCH_TITLE); builder->Add("assistantVoiceMatchMessage", IDS_ASSISTANT_VOICE_MATCH_MESSAGE); builder->Add("assistantVoiceMatchNoDspMessage", @@ -149,6 +146,14 @@ void AssistantOptInFlowScreenHandler::RegisterMessages() { &AssistantOptInFlowScreenHandler::HandleFlowInitialized); } +void AssistantOptInFlowScreenHandler::GetAdditionalParameters( + base::DictionaryValue* dict) { + dict->SetBoolean("hotwordDspAvailable", chromeos::IsHotwordDspAvailable()); + dict->SetBoolean("voiceMatchDisabled", + chromeos::assistant::features::IsVoiceMatchDisabled()); + BaseScreenHandler::GetAdditionalParameters(dict); +} + void AssistantOptInFlowScreenHandler::Bind(AssistantOptInFlowScreen* screen) { BaseScreenHandler::SetBaseScreen(screen); screen_ = screen; @@ -218,9 +223,9 @@ void AssistantOptInFlowScreenHandler::SetupAssistantConnection() { // Make sure enable Assistant service since we need it during the flow. prefs->SetBoolean(chromeos::assistant::prefs::kAssistantEnabled, true); - if (arc::VoiceInteractionControllerClient::Get()->voice_interaction_state() == - ash::mojom::VoiceInteractionState::NOT_READY) { - arc::VoiceInteractionControllerClient::Get()->AddObserver(this); + if (ash::AssistantState::Get()->assistant_state() == + ash::mojom::AssistantState::NOT_READY) { + ash::AssistantState::Get()->AddObserver(this); } else { BindAssistantSettingsManager(); } @@ -272,11 +277,11 @@ void AssistantOptInFlowScreenHandler::OnDialogClosed() { } } -void AssistantOptInFlowScreenHandler::OnStateChanged( - ash::mojom::VoiceInteractionState state) { - if (state != ash::mojom::VoiceInteractionState::NOT_READY) { +void AssistantOptInFlowScreenHandler::OnAssistantStatusChanged( + ash::mojom::AssistantState state) { + if (state != ash::mojom::AssistantState::NOT_READY) { BindAssistantSettingsManager(); - arc::VoiceInteractionControllerClient::Get()->RemoveObserver(this); + ash::AssistantState::Get()->RemoveObserver(this); } } @@ -326,6 +331,14 @@ void AssistantOptInFlowScreenHandler::OnGetSettingsResponse( UMA_HISTOGRAM_TIMES("Assistant.OptInFlow.GetSettingsRequestTime", time_since_request_sent); + if (ProfileManager::GetActiveUserProfile()->GetPrefs()->GetBoolean( + assistant::prefs::kAssistantDisabledByPolicy)) { + DVLOG(1) << "Assistant is disabled by domain policy. Skip Assistant " + "opt-in flow."; + HandleFlowFinished(); + return; + } + assistant::SettingsUi settings_ui; if (!settings_ui.ParseFromString(settings)) { LOG(ERROR) << "Failed to parse get settings response."; 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 9810c088aea..a04c19835e1 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 @@ -9,8 +9,8 @@ #include <string> #include "ash/public/cpp/assistant/assistant_setup.h" +#include "ash/public/cpp/assistant/assistant_state.h" #include "base/macros.h" -#include "chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client.h" #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" #include "chromeos/services/assistant/public/mojom/settings.mojom.h" #include "mojo/public/cpp/bindings/binding.h" @@ -43,7 +43,7 @@ class AssistantOptInFlowScreenView { class AssistantOptInFlowScreenHandler : public BaseScreenHandler, public AssistantOptInFlowScreenView, - public arc::VoiceInteractionControllerClient::Observer, + public ash::AssistantStateObserver, assistant::mojom::SpeakerIdEnrollmentClient { public: using TView = AssistantOptInFlowScreenView; @@ -63,6 +63,7 @@ class AssistantOptInFlowScreenHandler void DeclareLocalizedValues( ::login::LocalizedValuesBuilder* builder) override; void RegisterMessages() override; + void GetAdditionalParameters(base::DictionaryValue* dict) override; // AssistantOptInFlowScreenView: void Bind(AssistantOptInFlowScreen* screen) override; @@ -93,8 +94,8 @@ class AssistantOptInFlowScreenHandler // BaseScreenHandler: void Initialize() override; - // arc::VoiceInteractionControllerClient::Observer overrides - void OnStateChanged(ash::mojom::VoiceInteractionState state) override; + // ash::AssistantStateObserver: + void OnAssistantStatusChanged(ash::mojom::AssistantState state) override; // Connect to assistant settings manager. void BindAssistantSettingsManager(); 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 5474107730b..63c4d1cc21c 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,6 +8,7 @@ #include "ash/public/cpp/ash_features.h" #include "ash/public/cpp/event_rewriter_controller.h" +#include "ash/public/cpp/shelf_config.h" #include "ash/public/cpp/tablet_mode.h" #include "ash/public/mojom/constants.mojom.h" #include "ash/shell.h" @@ -16,6 +17,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/browser_process_platform_part.h" #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" #include "chrome/browser/chromeos/accessibility/magnification_manager.h" #include "chrome/browser/chromeos/login/configuration_keys.h" @@ -44,6 +46,7 @@ #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" #include "chromeos/constants/chromeos_constants.h" +#include "chromeos/constants/chromeos_features.h" #include "chromeos/constants/chromeos_switches.h" #include "components/login/base_screen_handler_utils.h" #include "components/login/localized_values_builder.h" @@ -101,8 +104,8 @@ CoreOobeHandler::CoreOobeHandler(JSCallsContainer* js_calls_container) // |connector| may be null in tests. auto* connector = content::GetSystemConnector(); if (connector) { - connector->BindInterface(ash::mojom::kServiceName, - &cros_display_config_ptr_); + connector->Connect(ash::mojom::kServiceName, + cros_display_config_.BindNewPipeAndPassReceiver()); } OobeConfiguration::Get()->AddAndFireObserver(this); } @@ -305,6 +308,10 @@ void CoreOobeHandler::SetClientAreaSize(int width, int height) { CallJS("cr.ui.Oobe.setClientAreaSize", width, height); } +void CoreOobeHandler::SetShelfHeight(int height) { + CallJS("cr.ui.Oobe.setShelfHeight", height); +} + void CoreOobeHandler::HandleInitialized() { GetOobeUI()->InitializeHandlers(); AllowJavascript(); @@ -546,6 +553,26 @@ void CoreOobeHandler::UpdateClientAreaSize() { const gfx::Size size = display::Screen::GetScreen()->GetPrimaryDisplay().size(); SetClientAreaSize(size.width(), size.height()); + SetShelfHeight(ash::ShelfConfig::Get()->shelf_size()); +} + +void CoreOobeHandler::SetDialogPaddingMode( + CoreOobeView::DialogPaddingMode mode) { + std::string padding; + switch (mode) { + case CoreOobeView::DialogPaddingMode::MODE_AUTO: + padding = "auto"; + break; + case CoreOobeView::DialogPaddingMode::MODE_NARROW: + padding = "narrow"; + break; + case CoreOobeView::DialogPaddingMode::MODE_WIDE: + padding = "wide"; + break; + default: + NOTREACHED(); + } + CallJS("cr.ui.Oobe.setDialogPaddingMode", padding); } void CoreOobeHandler::OnOobeConfigurationChanged() { @@ -586,7 +613,7 @@ void CoreOobeHandler::HandleGetPrimaryDisplayNameForTesting( const base::Value* callback_id; CHECK(args->Get(0, &callback_id)); - cros_display_config_ptr_->GetDisplayUnitInfoList( + cros_display_config_->GetDisplayUnitInfoList( false /* single_unified */, base::BindOnce(&CoreOobeHandler::GetPrimaryDisplayNameCallback, weak_ptr_factory_.GetWeakPtr(), callback_id->Clone())); 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 8e30d2b5363..0687932d4c3 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 @@ -23,6 +23,7 @@ #include "chrome/browser/chromeos/login/version_info_updater.h" #include "chrome/browser/chromeos/tpm_firmware_update.h" #include "chrome/browser/ui/webui/chromeos/login/base_webui_handler.h" +#include "mojo/public/cpp/bindings/remote.h" #include "ui/events/event_source.h" namespace base { @@ -38,6 +39,17 @@ namespace chromeos { class CoreOobeView { public: + // Enum that specifies how inner padding of OOBE dialog should be calculated. + enum class DialogPaddingMode { + // Oobe dialog is displayed full screen, padding will be calculated + // via css depending on media size. + MODE_AUTO, + // Oobe dialog have enough free space around and should use wide padding. + MODE_WIDE, + // Oobe dialog is positioned in limited space and should use narrow padding. + MODE_NARROW, + }; + virtual ~CoreOobeView() {} virtual void ShowSignInError(int login_attempts, @@ -58,6 +70,8 @@ class CoreOobeView { virtual void ReloadEulaContent(const base::DictionaryValue& dictionary) = 0; virtual void SetVirtualKeyboardShown(bool shown) = 0; virtual void SetClientAreaSize(int width, int height) = 0; + virtual void SetShelfHeight(int height) = 0; + virtual void SetDialogPaddingMode(DialogPaddingMode mode) = 0; virtual void ShowDeviceResetScreen() = 0; virtual void ShowEnableDebuggingScreen() = 0; virtual void InitDemoModeDetection() = 0; @@ -137,6 +151,8 @@ class CoreOobeHandler : public BaseWebUIHandler, void ReloadEulaContent(const base::DictionaryValue& dictionary) override; void SetVirtualKeyboardShown(bool displayed) override; void SetClientAreaSize(int width, int height) override; + void SetShelfHeight(int height) override; + void SetDialogPaddingMode(CoreOobeView::DialogPaddingMode mode) override; void ShowDeviceResetScreen() override; void ShowEnableDebuggingScreen() override; void ShowActiveDirectoryPasswordChangeScreen( @@ -222,7 +238,7 @@ class CoreOobeHandler : public BaseWebUIHandler, DemoModeDetector demo_mode_detector_; - ash::mojom::CrosDisplayConfigControllerPtr cros_display_config_ptr_; + mojo::Remote<ash::mojom::CrosDisplayConfigController> cros_display_config_; base::WeakPtrFactory<CoreOobeHandler> weak_ptr_factory_{this}; 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 35e15951f2a..49edf06dc4d 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 @@ -21,7 +21,7 @@ #include "chromeos/constants/chromeos_switches.h" #include "chromeos/dbus/cryptohome/cryptohome_client.h" #include "chromeos/dbus/dbus_thread_manager.h" -#include "chromeos/dbus/debug_daemon_client.h" +#include "chromeos/dbus/debug_daemon/debug_daemon_client.h" #include "chromeos/dbus/power/power_manager_client.h" #include "components/login/localized_values_builder.h" #include "components/prefs/pref_registry_simple.h" 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 d0fa17ef808..6d632c707cf 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 @@ -42,6 +42,7 @@ #include "google_apis/gaia/gaia_auth_util.h" #include "google_apis/gaia/gaia_urls.h" #include "google_apis/gaia/google_service_auth_error.h" +#include "services/network/public/mojom/cookie_manager.mojom.h" #include "ui/base/l10n/l10n_util.h" #include "ui/chromeos/devicetype_utils.h" @@ -154,7 +155,7 @@ base::ListValue GetEncryptionTypesList() { enc_option.SetKey("value", base::Value(enc_types.id)); enc_option.SetKey("selected", base::Value(default_types == enc_types.encryption_types)); - encryption_list.GetList().emplace_back(std::move(enc_option)); + encryption_list.Append(std::move(enc_option)); } return encryption_list; } @@ -649,7 +650,7 @@ void EnrollmentScreenHandler::OnAdConfigurationUnlocked( custom.SetKey( "name", base::Value(l10n_util::GetStringUTF8(IDS_AD_CONFIG_SELECTION_CUSTOM))); - options->GetList().push_back(std::move(custom)); + options->Append(std::move(custom)); active_directory_join_type_ = ActiveDirectoryDomainJoinType::USING_CONFIGURATION; CallJS("login.OAuthEnrollmentScreen.setAdJoinConfiguration", *options); @@ -788,11 +789,10 @@ void EnrollmentScreenHandler::HandleCompleteLogin(const std::string& user) { Profile::FromWebUI(web_ui())); content::StoragePartition* partition = signin_partition_manager->GetCurrentStoragePartition(); - net::CookieOptions cookie_options; - cookie_options.set_include_httponly(); partition->GetCookieManagerForBrowserProcess()->GetCookieList( - GaiaUrls::GetInstance()->gaia_url(), cookie_options, + GaiaUrls::GetInstance()->gaia_url(), + net::CookieOptions::MakeAllInclusive(), base::BindOnce(&EnrollmentScreenHandler::OnGetCookiesForCompleteLogin, weak_ptr_factory_.GetWeakPtr(), user)); } diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.cc index e15b2103638..bb367ef3de4 100644 --- a/chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.cc +++ b/chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.cc @@ -80,6 +80,10 @@ void ErrorScreenHandler::SetShowConnectingIndicator(bool value) { CallJS("login.ErrorMessageScreen.showConnectingIndicator", value); } +void ErrorScreenHandler::SetIsPersistentError(bool is_persistent) { + CallJS("login.ErrorMessageScreen.setIsPersistentError", is_persistent); +} + void ErrorScreenHandler::SetUIState(NetworkError::UIState ui_state) { CallJS("login.ErrorMessageScreen.setUIState", static_cast<int>(ui_state)); } diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.h index 67a26958e75..acc425a0bf8 100644 --- a/chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.h +++ b/chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.h @@ -51,6 +51,9 @@ class ErrorScreenView { // Updates visibility of the label indicating we're reconnecting. virtual void SetShowConnectingIndicator(bool value) = 0; + // Makes error persistent (e.g. non-closable). + virtual void SetIsPersistentError(bool is_persistent) = 0; + // Sets current UI state of the screen. virtual void SetUIState(NetworkError::UIState ui_state) = 0; }; @@ -75,6 +78,7 @@ class ErrorScreenHandler : public BaseScreenHandler, public ErrorScreenView { void SetGuestSigninAllowed(bool value) override; void SetOfflineSigninAllowed(bool value) override; void SetShowConnectingIndicator(bool value) override; + void SetIsPersistentError(bool is_persistent) override; void SetUIState(NetworkError::UIState ui_state) override; // WebUIMessageHandler: diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/fake_update_required_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/fake_update_required_screen_handler.cc new file mode 100644 index 00000000000..ffbed8d3645 --- /dev/null +++ b/chromium/chrome/browser/ui/webui/chromeos/login/fake_update_required_screen_handler.cc @@ -0,0 +1,14 @@ +// 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/login/fake_update_required_screen_handler.h" + +namespace chromeos { + +void FakeUpdateRequiredScreenHandler::SetUIState( + UpdateRequiredView::UIState ui_state) { + ui_state_ = ui_state; +} + +} // namespace chromeos diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/fake_update_required_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/fake_update_required_screen_handler.h new file mode 100644 index 00000000000..7a36649adf7 --- /dev/null +++ b/chromium/chrome/browser/ui/webui/chromeos/login/fake_update_required_screen_handler.h @@ -0,0 +1,48 @@ +// 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_LOGIN_FAKE_UPDATE_REQUIRED_SCREEN_HANDLER_H_ +#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_FAKE_UPDATE_REQUIRED_SCREEN_HANDLER_H_ + +#include <string> + +#include "base/compiler_specific.h" +#include "base/macros.h" +#include "chrome/browser/chromeos/login/screens/update_required_screen.h" +#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" +#include "chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.h" + +namespace chromeos { + +class UpdateRequiredScreen; + +class FakeUpdateRequiredScreenHandler : public UpdateRequiredView { + public: + FakeUpdateRequiredScreenHandler() = default; + ~FakeUpdateRequiredScreenHandler() override {} + + UpdateRequiredView::UIState ui_state() { return ui_state_; } + + private: + void Show() override {} + void Hide() override {} + void Bind(UpdateRequiredScreen* screen) override {} + void Unbind() override {} + + void SetIsConnected(bool connected) override {} + void SetUpdateProgressUnavailable(bool unavailable) override {} + void SetUpdateProgressValue(int progress) override {} + void SetUpdateProgressMessage(const base::string16& message) override {} + void SetEstimatedTimeLeftVisible(bool visible) override {} + void SetEstimatedTimeLeft(int seconds_left) override {} + void SetUIState(UpdateRequiredView::UIState ui_state) override; + + UpdateRequiredView::UIState ui_state_; + + DISALLOW_COPY_AND_ASSIGN(FakeUpdateRequiredScreenHandler); +}; + +} // namespace chromeos + +#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_FAKE_UPDATE_REQUIRED_SCREEN_HANDLER_H_ diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.cc index bf674ae60fb..4d4380b17b7 100644 --- a/chromium/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.cc +++ b/chromium/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.cc @@ -55,11 +55,9 @@ FingerprintSetupScreenHandler::FingerprintSetupScreenHandler( : BaseScreenHandler(kScreenId, js_calls_container) { set_user_acted_method_path("login.FingerprintSetupScreen.userActed"); - content::GetSystemConnector()->BindInterface(device::mojom::kServiceName, - &fp_service_); - device::mojom::FingerprintObserverPtr observer; - binding_.Bind(mojo::MakeRequest(&observer)); - fp_service_->AddFingerprintObserver(std::move(observer)); + content::GetSystemConnector()->Connect( + device::mojom::kServiceName, fp_service_.BindNewPipeAndPassReceiver()); + fp_service_->AddFingerprintObserver(receiver_.BindNewPipeAndPassRemote()); } FingerprintSetupScreenHandler::~FingerprintSetupScreenHandler() = default; diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.h index 8eef6b9764e..8e752278477 100644 --- a/chromium/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.h +++ b/chromium/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.h @@ -7,7 +7,8 @@ #include "base/macros.h" #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" -#include "mojo/public/cpp/bindings/binding.h" +#include "mojo/public/cpp/bindings/receiver.h" +#include "mojo/public/cpp/bindings/remote.h" #include "services/device/public/mojom/fingerprint.mojom.h" namespace chromeos { @@ -75,8 +76,8 @@ class FingerprintSetupScreenHandler FingerprintSetupScreen* screen_ = nullptr; - device::mojom::FingerprintPtr fp_service_; - mojo::Binding<device::mojom::FingerprintObserver> binding_{this}; + mojo::Remote<device::mojom::Fingerprint> fp_service_; + mojo::Receiver<device::mojom::FingerprintObserver> receiver_{this}; int enrolled_finger_count_ = 0; bool enroll_session_started_ = false; 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 ee389c1f193..da7467ea754 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 @@ -17,6 +17,7 @@ #include "base/json/json_reader.h" #include "base/logging.h" #include "base/memory/ref_counted.h" +#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "base/optional.h" #include "base/stl_util.h" @@ -26,6 +27,7 @@ #include "base/task/post_task.h" #include "base/values.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/browser_process_platform_part.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" @@ -33,6 +35,7 @@ #include "chrome/browser/chromeos/language_preferences.h" #include "chrome/browser/chromeos/login/lock_screen_utils.h" #include "chrome/browser/chromeos/login/reauth_stats.h" +#include "chrome/browser/chromeos/login/saml/public_saml_url_fetcher.h" #include "chrome/browser/chromeos/login/screens/network_error.h" #include "chrome/browser/chromeos/login/signin_partition_manager.h" #include "chrome/browser/chromeos/login/ui/login_display_host.h" @@ -108,6 +111,28 @@ const char kEndpointGen[] = "1.0"; const char kOAUTHCodeCookie[] = "oauth_code"; const char kGAPSCookie[] = "GAPS"; +// Must be kept consistent with ChromeOSSamlApiUsed in enums.xml +// These values are persisted to logs. Entries should not be renumbered and +// numeric values should never be reused +enum class ChromeOSSamlApiUsed { + kNotSamlLogin = 0, + kSamlApiUsed = 1, + kSamlApiNotUsed = 2, + kMaxValue = kSamlApiNotUsed, +}; + +void RecordAPILogin(bool is_third_party_idp, bool is_api_used) { + ChromeOSSamlApiUsed login_type; + if (!is_third_party_idp) { + login_type = ChromeOSSamlApiUsed::kNotSamlLogin; + } else if (is_api_used) { + login_type = ChromeOSSamlApiUsed::kSamlApiUsed; + } else { + login_type = ChromeOSSamlApiUsed::kSamlApiNotUsed; + } + base::UmaHistogramEnumeration("ChromeOS.SAML.APILogin", login_type); +} + policy::DeviceMode GetDeviceMode() { policy::BrowserPolicyConnectorChromeOS* connector = g_browser_process->platform_part()->browser_policy_connector_chromeos(); @@ -365,10 +390,29 @@ void GaiaScreenHandler::LoadGaia(const GaiaContext& context) { login::SigninPartitionManager* signin_partition_manager = login::SigninPartitionManager::Factory::GetForBrowserContext( Profile::FromWebUI(web_ui())); - signin_partition_manager->StartSigninSession( - web_ui()->GetWebContents(), + + auto partition_call = base::BindOnce( + &login::SigninPartitionManager::StartSigninSession, + base::Unretained(signin_partition_manager), web_ui()->GetWebContents(), base::BindOnce(&GaiaScreenHandler::LoadGaiaWithPartition, weak_factory_.GetWeakPtr(), context)); + + 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) { + public_saml_url_fetcher_ = + std::make_unique<chromeos::PublicSamlUrlFetcher>(account_id); + public_saml_url_fetcher_->Fetch(std::move(partition_call)); + return; + } + } + public_saml_url_fetcher_.reset(); + std::move(partition_call).Run(); } void GaiaScreenHandler::LoadGaiaWithPartition( @@ -399,11 +443,7 @@ void GaiaScreenHandler::LoadGaiaWithPartition( 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); + const net::CookieOptions options = net::CookieOptions::MakeAllInclusive(); partition->GetCookieManagerForBrowserProcess()->SetCanonicalCookie( *cc.get(), "https", options, std::move(callback)); } @@ -444,30 +484,6 @@ 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>(); @@ -538,6 +554,26 @@ void GaiaScreenHandler::LoadGaiaWithPartitionAndVersionAndConsent( ExtractSamlPasswordAttributesEnabled()); params.SetBoolean("enableGaiaActionButtons", GaiaActionButtonsEnabled()); + if (public_saml_url_fetcher_) { + params.SetBoolean("startsOnSamlPage", true); + DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kPublicAccountsSamlAclUrl)); + std::string saml_acl_url = + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kPublicAccountsSamlAclUrl); + params.SetString("samlAclUrl", saml_acl_url); + if (public_saml_url_fetcher_->FetchSucceeded()) { + params.SetString("frameUrl", public_saml_url_fetcher_->GetRedirectUrl()); + } else { + // TODO: make the string localized. + std::string msg = "Failed to fetch the SAML redirect URL from the server"; + core_oobe_view_->ShowSignInError( + 0, msg, std::string(), HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT); + return; + } + } + public_saml_url_fetcher_.reset(); + frame_state_ = FRAME_STATE_LOADING; CallJS("login.GaiaSigninScreen.loadAuthExtension", params); } @@ -676,8 +712,6 @@ void GaiaScreenHandler::RegisterMessages() { AddRawCallback("showAddUser", &GaiaScreenHandler::HandleShowAddUser); AddCallback("getIsSamlUserPasswordless", &GaiaScreenHandler::HandleGetIsSamlUserPasswordless); - AddCallback("updateOobeDialogSize", - &GaiaScreenHandler::HandleUpdateOobeDialogSize); AddCallback("hideOobeDialog", &GaiaScreenHandler::HandleHideOobeDialog); AddCallback("updateSigninUIState", &GaiaScreenHandler::HandleUpdateSigninUIState); @@ -732,6 +766,14 @@ void GaiaScreenHandler::HandleWebviewLoadAborted(int error_code) { << net::ErrorToShortString(error_code); return; } + if (error_code == net::ERR_TIMED_OUT && + is_security_token_pin_dialog_running()) { + // Timeout errors are expected when the security token PIN is not entered by + // the user on time. In that case, return the user back to the first sign-in + // step instead of showing the network error screen. + ReloadGaia(/*force_reload=*/true); + return; + } frame_error_ = static_cast<net::Error>(error_code); LOG(ERROR) << "Gaia webview error: " << net::ErrorToShortString(error_code); @@ -848,9 +890,8 @@ void GaiaScreenHandler::HandleCompleteAuthentication( if (!partition) return; - net::CookieOptions cookie_options; - cookie_options.set_include_httponly(); - + const net::CookieOptions cookie_options = + net::CookieOptions::MakeAllInclusive(); partition->GetCookieManagerForBrowserProcess()->GetCookieList( GaiaUrls::GetInstance()->gaia_url(), cookie_options, base::BindOnce(&GaiaScreenHandler::OnGetCookiesForCompleteAuthentication, @@ -911,15 +952,17 @@ void GaiaScreenHandler::HandleCompleteLogin(const std::string& gaia_id, SamlPasswordAttributes()); } -void GaiaScreenHandler::HandleUsingSAMLAPI() { - SetSAMLPrincipalsAPIUsed(true); +void GaiaScreenHandler::HandleUsingSAMLAPI(bool is_third_party_idp) { + SetSAMLPrincipalsAPIUsed(is_third_party_idp, /*is_api_used=*/true); } void GaiaScreenHandler::HandleScrapedPasswordCount(int password_count) { - SetSAMLPrincipalsAPIUsed(false); + // We are handling scraped passwords here so this is SAML flow without + // Chrome Credentials Passing API + SetSAMLPrincipalsAPIUsed(/*is_third_party_idp=*/true, /*is_api_used=*/false); // Use a histogram that has 11 buckets, one for each of the values in [0, 9] // and an overflow bucket at the end. - UMA_HISTOGRAM_ENUMERATION("ChromeOS.SAML.Scraping.PasswordCount", + UMA_HISTOGRAM_ENUMERATION("ChromeOS.SAML.Scraping.PasswordCountAll", std::min(password_count, 10), 11); if (password_count == 0) HandleScrapedPasswordVerificationFailed(); @@ -954,11 +997,6 @@ void GaiaScreenHandler::HandleGaiaUIReady() { } } -void GaiaScreenHandler::HandleUpdateOobeDialogSize(int width, int height) { - if (LoginDisplayHost::default_host()) - LoginDisplayHost::default_host()->UpdateOobeDialogSize(width, height); -} - void GaiaScreenHandler::HandleHideOobeDialog() { if (LoginDisplayHost::default_host()) LoginDisplayHost::default_host()->HideOobeDialog(); @@ -1028,7 +1066,7 @@ void GaiaScreenHandler::HandleSecurityTokenPinEntered( DCHECK(!security_token_pin_entered_callback_ || security_token_pin_dialog_closed_callback_); - if (!security_token_pin_dialog_closed_callback_) { + if (!is_security_token_pin_dialog_running()) { // The PIN request has already been canceled on the handler side. return; } @@ -1178,9 +1216,12 @@ void GaiaScreenHandler::SubmitLoginFormForTest() { // if they are cleared here. } -void GaiaScreenHandler::SetSAMLPrincipalsAPIUsed(bool api_used) { - using_saml_api_ = api_used; - UMA_HISTOGRAM_BOOLEAN("ChromeOS.SAML.APIUsed", api_used); +void GaiaScreenHandler::SetSAMLPrincipalsAPIUsed(bool is_third_party_idp, + bool is_api_used) { + using_saml_api_ = is_api_used; + // This correctly records the standard GAIA login and SAML flow + // with Chrome Credentials Passing API used/not used + RecordAPILogin(is_third_party_idp, is_api_used); } void GaiaScreenHandler::ShowGaiaAsync(const AccountId& account_id) { 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 9cba09d99ff..a1e7df1b651 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 @@ -39,6 +39,7 @@ class Key; class SamlPasswordAttributes; class SigninScreenHandler; class UserContext; +class PublicSamlUrlFetcher; class GaiaView { public: @@ -212,7 +213,9 @@ class GaiaScreenHandler : public BaseScreenHandler, void HandleCancelActiveDirectoryAuth(); - void HandleUsingSAMLAPI(); + // Handles SAML/GAIA login flow metrics + // is_third_party_idp == false means GAIA-based authentication + void HandleUsingSAMLAPI(bool is_third_party_idp); void HandleScrapedPasswordCount(int password_count); void HandleScrapedPasswordVerificationFailed(); @@ -221,7 +224,6 @@ class GaiaScreenHandler : public BaseScreenHandler, void HandleIdentifierEntered(const std::string& account_identifier); void HandleAuthExtensionLoaded(); - void HandleUpdateOobeDialogSize(int width, int height); void HandleHideOobeDialog(); void HandleShowAddUser(const base::ListValue* args); void HandleGetIsSamlUserPasswordless(const std::string& callback_id, @@ -271,8 +273,8 @@ class GaiaScreenHandler : public BaseScreenHandler, void SubmitLoginFormForTest(); // Updates the member variable and UMA histogram indicating whether the - // principals API was used during SAML login. - void SetSAMLPrincipalsAPIUsed(bool api_used); + // Chrome Credentials Passing API was used during SAML login. + void SetSAMLPrincipalsAPIUsed(bool is_third_party_idp, bool is_api_used); // Cancels the request to show the sign-in screen while the asynchronous // clean-up process that precedes the screen showing is in progress. @@ -326,6 +328,10 @@ class GaiaScreenHandler : public BaseScreenHandler, UserContext* user_context, std::string* error_message); + bool is_security_token_pin_dialog_running() const { + return !security_token_pin_dialog_closed_callback_.is_null(); + } + // Current state of Gaia frame. FrameState frame_state_ = FRAME_STATE_UNKNOWN; @@ -365,12 +371,9 @@ class GaiaScreenHandler : public BaseScreenHandler, // The active network at the moment when Gaia page was preloaded. std::string gaia_silent_load_network_; - // If the user authenticated via SAML, this indicates whether the principals - // API was used. - // TODO(emaxx): This is also currently set when the user authenticated via - // Gaia, since Gaia uses the same API for passing the password to Chrome. - // Either fix this behavior, or change the naming and the comments to reflect - // it. + // This flag is set when user authenticated using the Chrome Credentials + // Passing API (the login could happen via SAML or, with the current + // server-side implementation, via Gaia). bool using_saml_api_ = false; // Test credentials. @@ -414,6 +417,8 @@ class GaiaScreenHandler : public BaseScreenHandler, std::unique_ptr<LoginClientCertUsageObserver> extension_provided_client_cert_usage_observer_; + std::unique_ptr<chromeos::PublicSamlUrlFetcher> public_saml_url_fetcher_; + // State of the security token PIN dialogs: // Whether this instance is currently registered as a host for showing the 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 e990f0f0868..d26b46a9c28 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,6 +7,7 @@ #include "base/bind.h" #include "base/logging.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/browser_process_platform_part.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" 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 0b45e2d2f8f..818c818751e 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 @@ -18,7 +18,6 @@ #include "services/service_manager/public/cpp/connector.h" #include "ui/display/display.h" #include "ui/display/screen.h" -#include "ui/events/devices/device_data_manager.h" #include "ui/events/devices/touchscreen_device.h" using content::BrowserThread; @@ -42,12 +41,12 @@ bool IsWhiteListedVendorId(uint16_t vendor_id) { } // namespace -OobeDisplayChooser::OobeDisplayChooser() : scoped_observer_(this) { +OobeDisplayChooser::OobeDisplayChooser() { // |connector| may be null in tests. auto* connector = content::GetSystemConnector(); if (connector) { - connector->BindInterface(ash::mojom::kServiceName, - &cros_display_config_ptr_); + connector->Connect(ash::mojom::kServiceName, + cros_display_config_.BindNewPipeAndPassReceiver()); } } @@ -95,7 +94,7 @@ void OobeDisplayChooser::MoveToTouchDisplay() { device.target_display_id != display::kInvalidDisplayId) { auto config_properties = ash::mojom::DisplayConfigProperties::New(); config_properties->set_primary = true; - cros_display_config_ptr_->SetDisplayProperties( + cros_display_config_->SetDisplayProperties( base::NumberToString(device.target_display_id), std::move(config_properties), ash::mojom::DisplayConfigSource::kUser, base::DoNothing()); 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 555050c7f87..fc9cf2a9e22 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 @@ -9,6 +9,9 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/scoped_observer.h" +#include "mojo/public/cpp/bindings/pending_remote.h" +#include "mojo/public/cpp/bindings/remote.h" +#include "ui/events/devices/device_data_manager.h" #include "ui/events/devices/input_device_event_observer.h" namespace ui { @@ -26,9 +29,10 @@ class OobeDisplayChooser : public ui::InputDeviceEventObserver { // Must be called on the BrowserThread::UI thread. void TryToPlaceUiOnTouchDisplay(); - void set_cros_display_config_ptr_for_test( - ash::mojom::CrosDisplayConfigControllerPtr cros_display_config_ptr) { - cros_display_config_ptr_ = std::move(cros_display_config_ptr); + void set_cros_display_config_for_test( + mojo::PendingRemote<ash::mojom::CrosDisplayConfigController> + cros_display_config) { + cros_display_config_.Bind(std::move(cros_display_config)); } private: @@ -44,8 +48,8 @@ class OobeDisplayChooser : public ui::InputDeviceEventObserver { void OnDeviceListsComplete() override; ScopedObserver<ui::DeviceDataManager, ui::InputDeviceEventObserver> - scoped_observer_; - ash::mojom::CrosDisplayConfigControllerPtr cros_display_config_ptr_; + scoped_observer_{this}; + mojo::Remote<ash::mojom::CrosDisplayConfigController> cros_display_config_; base::WeakPtrFactory<OobeDisplayChooser> weak_ptr_factory_{this}; diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc index 2fd04181e8a..407ca745758 100644 --- a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc +++ b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc @@ -8,11 +8,14 @@ #include <vector> #include "ash/display/display_configuration_controller.h" +#include "ash/public/mojom/cros_display_config.mojom.h" #include "ash/shell.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" #include "chrome/test/base/chrome_ash_test_base.h" -#include "mojo/public/cpp/bindings/binding.h" +#include "mojo/public/cpp/bindings/pending_associated_remote.h" +#include "mojo/public/cpp/bindings/pending_remote.h" +#include "mojo/public/cpp/bindings/receiver.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/display/display.h" #include "ui/display/display_observer.h" @@ -29,17 +32,17 @@ namespace { class TestCrosDisplayConfig : public ash::mojom::CrosDisplayConfigController { public: - TestCrosDisplayConfig() : binding_(this) {} + TestCrosDisplayConfig() = default; - ash::mojom::CrosDisplayConfigControllerPtr CreateInterfacePtrAndBind() { - ash::mojom::CrosDisplayConfigControllerPtr ptr; - binding_.Bind(mojo::MakeRequest(&ptr)); - return ptr; + mojo::PendingRemote<ash::mojom::CrosDisplayConfigController> + CreateRemoteAndBind() { + return receiver_.BindNewPipeAndPassRemote(); } // ash::mojom::CrosDisplayConfigController: - void AddObserver(ash::mojom::CrosDisplayConfigObserverAssociatedPtrInfo - observer) override {} + void AddObserver( + mojo::PendingAssociatedRemote<ash::mojom::CrosDisplayConfigObserver> + observer) override {} void GetDisplayLayoutInfo(GetDisplayLayoutInfoCallback callback) override {} void SetDisplayLayoutInfo(ash::mojom::DisplayLayoutInfoPtr info, SetDisplayLayoutInfoCallback callback) override {} @@ -69,7 +72,7 @@ class TestCrosDisplayConfig : public ash::mojom::CrosDisplayConfigController { TouchCalibrationCallback callback) override {} private: - mojo::Binding<ash::mojom::CrosDisplayConfigController> binding_; + mojo::Receiver<ash::mojom::CrosDisplayConfigController> receiver_{this}; DISALLOW_COPY_AND_ASSIGN(TestCrosDisplayConfig); }; @@ -88,8 +91,8 @@ class OobeDisplayChooserTest : public ChromeAshTestBase { cros_display_config_ = std::make_unique<TestCrosDisplayConfig>(); display_chooser_ = std::make_unique<OobeDisplayChooser>(); - display_chooser_->set_cros_display_config_ptr_for_test( - cros_display_config_->CreateInterfacePtrAndBind()); + display_chooser_->set_cros_display_config_for_test( + cros_display_config_->CreateRemoteAndBind()); ui::DeviceDataManagerTestApi().OnDeviceListsComplete(); } 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 67f444cbacd..6d8e7ade583 100644 --- a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc +++ b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc @@ -90,6 +90,7 @@ #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/cros_network_config.mojom.h" // nogncheck #include "components/policy/core/common/cloud/cloud_policy_constants.h" #include "components/prefs/pref_service.h" #include "content/public/browser/browser_context.h" @@ -490,20 +491,23 @@ service_manager::Connector* OobeUI::GetLoggedInUserMojoConnector() { } void OobeUI::BindMultiDeviceSetup( - multidevice_setup::mojom::MultiDeviceSetupRequest request) { - GetLoggedInUserMojoConnector()->BindInterface( - multidevice_setup::mojom::kServiceName, std::move(request)); + mojo::PendingReceiver<multidevice_setup::mojom::MultiDeviceSetup> + receiver) { + GetLoggedInUserMojoConnector()->Connect( + multidevice_setup::mojom::kServiceName, std::move(receiver)); } void OobeUI::BindPrivilegedHostDeviceSetter( - multidevice_setup::mojom::PrivilegedHostDeviceSetterRequest request) { - GetLoggedInUserMojoConnector()->BindInterface( - multidevice_setup::mojom::kServiceName, std::move(request)); + mojo::PendingReceiver<multidevice_setup::mojom::PrivilegedHostDeviceSetter> + receiver) { + GetLoggedInUserMojoConnector()->Connect( + multidevice_setup::mojom::kServiceName, std::move(receiver)); } void OobeUI::BindCrosNetworkConfig( - chromeos::network_config::mojom::CrosNetworkConfigRequest request) { - ash::GetNetworkConfigService(std::move(request)); + mojo::PendingReceiver<chromeos::network_config::mojom::CrosNetworkConfig> + receiver) { + ash::GetNetworkConfigService(std::move(receiver)); } OobeUI::OobeUI(content::WebUI* web_ui, const GURL& url) @@ -622,7 +626,7 @@ void OobeUI::CurrentScreenChanged(OobeScreenId new_screen) { current_screen_ = new_screen; for (Observer& observer : observer_list_) - observer.OnCurrentScreenChanged(current_screen_, new_screen); + observer.OnCurrentScreenChanged(previous_screen_, new_screen); } bool OobeUI::IsScreenInitialized(OobeScreenId screen) { diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.h b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.h index 84dc0d2d4ca..cb1f0565315 100644 --- a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.h +++ b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.h @@ -18,7 +18,8 @@ #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h" #include "chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom.h" -#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom.h" // nogncheck +#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom-forward.h" // nogncheck +#include "mojo/public/cpp/bindings/pending_receiver.h" #include "ui/webui/mojo_web_ui_controller.h" namespace base { @@ -156,14 +157,17 @@ class OobeUI : public ui::MojoWebUIController { // display type. void ConfigureOobeDisplay(); - // Adds Mojo bindings for this WebUIController. + // Adds Mojo receivers for this WebUIController. service_manager::Connector* GetLoggedInUserMojoConnector(); void BindMultiDeviceSetup( - multidevice_setup::mojom::MultiDeviceSetupRequest request); + mojo::PendingReceiver<multidevice_setup::mojom::MultiDeviceSetup> + receiver); void BindPrivilegedHostDeviceSetter( - multidevice_setup::mojom::PrivilegedHostDeviceSetterRequest request); + mojo::PendingReceiver< + multidevice_setup::mojom::PrivilegedHostDeviceSetter> receiver); void BindCrosNetworkConfig( - chromeos::network_config::mojom::CrosNetworkConfigRequest request); + mojo::PendingReceiver<chromeos::network_config::mojom::CrosNetworkConfig> + receiver); // Type of UI. std::string display_type_; diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/recommend_apps_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/recommend_apps_screen_handler.cc index d8a5fa15e43..c88297b01a0 100644 --- a/chromium/chrome/browser/ui/webui/chromeos/login/recommend_apps_screen_handler.cc +++ b/chromium/chrome/browser/ui/webui/chromeos/login/recommend_apps_screen_handler.cc @@ -5,7 +5,7 @@ #include "chrome/browser/ui/webui/chromeos/login/recommend_apps_screen_handler.h" #include "base/metrics/histogram_macros.h" -#include "chrome/browser/chromeos/arc/arc_session_manager.h" +#include "chrome/browser/chromeos/arc/session/arc_session_manager.h" #include "chrome/browser/chromeos/login/screens/recommend_apps_screen.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" 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 aa0e6206df5..2e34b2bb0c8 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 @@ -101,6 +101,8 @@ #include "content/public/browser/notification_source.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" +#include "extensions/browser/api/extensions_api_client.h" +#include "extensions/browser/api/feedback_private/feedback_private_delegate.h" #include "google_apis/gaia/gaia_auth_util.h" #include "third_party/cros_system_api/dbus/service_constants.h" #include "ui/base/ime/chromeos/ime_keyboard.h" @@ -296,6 +298,13 @@ SigninScreenHandler::~SigninScreenHandler() { network_state_informer_->RemoveObserver(this); proximity_auth::ScreenlockBridge::Get()->SetLockHandler(nullptr); proximity_auth::ScreenlockBridge::Get()->SetFocusedUser(EmptyAccountId()); + // TODO(https://crbug.com/1033572) Quick fix to close feedback form when login + // was performed. + login_feedback_.reset(); + extensions::FeedbackPrivateDelegate* feedback_private_delegate = + extensions::ExtensionsAPIClient::Get()->GetFeedbackPrivateDelegate(); + feedback_private_delegate->UnloadFeedbackExtension( + Profile::FromWebUI(web_ui())); } void SigninScreenHandler::DeclareLocalizedValues( diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/supervision_transition_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/supervision_transition_screen_handler.cc index 3542f432e78..311bd578880 100644 --- a/chromium/chrome/browser/ui/webui/chromeos/login/supervision_transition_screen_handler.cc +++ b/chromium/chrome/browser/ui/webui/chromeos/login/supervision_transition_screen_handler.cc @@ -9,8 +9,8 @@ #include "base/logging.h" #include "base/metrics/histogram_macros.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chromeos/arc/arc_session_manager.h" #include "chrome/browser/chromeos/arc/arc_util.h" +#include "chrome/browser/chromeos/arc/session/arc_session_manager.h" #include "chrome/browser/chromeos/login/oobe_screen.h" #include "chrome/browser/chromeos/login/screens/supervision_transition_screen.h" #include "chrome/browser/profiles/profile_manager.h" diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.cc index 1a557a318c5..d02af35140b 100644 --- a/chromium/chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.cc +++ b/chromium/chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.cc @@ -12,6 +12,9 @@ #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" #include "components/login/localized_values_builder.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/chromeos/devicetype_utils.h" +#include "ui/strings/grit/ui_strings.h" namespace chromeos { @@ -20,6 +23,7 @@ constexpr StaticOobeScreenId UpdateRequiredView::kScreenId; UpdateRequiredScreenHandler::UpdateRequiredScreenHandler( JSCallsContainer* js_calls_container) : BaseScreenHandler(kScreenId, js_calls_container) { + set_user_acted_method_path("login.UpdateRequiredScreen.userActed"); } UpdateRequiredScreenHandler::~UpdateRequiredScreenHandler() { @@ -31,6 +35,35 @@ void UpdateRequiredScreenHandler::DeclareLocalizedValues( ::login::LocalizedValuesBuilder* builder) { builder->Add("updateRequiredMessage", IDS_UPDATE_REQUIRED_LOGIN_SCREEN_MESSAGE); + builder->Add("errorMessage", + IDS_BROWSER_SHARING_ERROR_DIALOG_TEXT_INTERNAL_ERROR); + builder->Add("eolMessage", + ui::SubstituteChromeOSDeviceType(IDS_EOL_NOTIFICATION_EOL)); + builder->Add("selectNetworkButtonCaption", IDS_APP_START_CONFIGURE_NETWORK); + builder->Add("updateButtonCaption", + IDS_SETTINGS_ABOUT_PAGE_CHECK_FOR_UPDATES); + builder->Add("rebootNeededMessage", IDS_UPDATE_COMPLETED); + + builder->Add("checkingForUpdatesTitle", IDS_CHECKING_FOR_UPDATES); + builder->Add("updatingTitle", IDS_UPDATING_SCREEN_TITLE); + + builder->Add("downloading", IDS_DOWNLOADING); + builder->Add("downloadingTimeLeftLong", IDS_DOWNLOADING_TIME_LEFT_LONG); + builder->Add("downloadingTimeLeftStatusOneHour", + IDS_DOWNLOADING_TIME_LEFT_STATUS_ONE_HOUR); + builder->Add("downloadingTimeLeftStatusMinutes", + IDS_DOWNLOADING_TIME_LEFT_STATUS_MINUTES); + builder->Add("downloadingTimeLeftSmall", IDS_DOWNLOADING_TIME_LEFT_SMALL); + + builder->Add( + "updateOverCellularPromptTitle", + ui::SubstituteChromeOSDeviceType(IDS_UPDATE_OVER_CELLULAR_PROMPT_TITLE)); + builder->Add("updateOverCellularPromptMessage", + IDS_UPDATE_OVER_CELLULAR_PROMPT_MESSAGE); + builder->Add("AcceptUpdateOverCellularButton", + IDS_OFFERS_CONSENT_INFOBAR_ENABLE_BUTTON); + builder->Add("RejectUpdateOverCellularButton", + IDS_OFFERS_CONSENT_INFOBAR_DISABLE_BUTTON); } void UpdateRequiredScreenHandler::Initialize() { @@ -60,4 +93,36 @@ void UpdateRequiredScreenHandler::Unbind() { BaseScreenHandler::SetBaseScreen(nullptr); } +void UpdateRequiredScreenHandler::SetIsConnected(bool connected) { + CallJS("login.UpdateRequiredScreen.setIsConnected", connected); +} + +void UpdateRequiredScreenHandler::SetUpdateProgressUnavailable( + bool unavailable) { + CallJS("login.UpdateRequiredScreen.setUpdateProgressUnavailable", + unavailable); +} + +void UpdateRequiredScreenHandler::SetUpdateProgressValue(int progress) { + CallJS("login.UpdateRequiredScreen.setUpdateProgressValue", progress); +} + +void UpdateRequiredScreenHandler::SetUpdateProgressMessage( + const base::string16& message) { + CallJS("login.UpdateRequiredScreen.setUpdateProgressMessage", message); +} + +void UpdateRequiredScreenHandler::SetEstimatedTimeLeftVisible(bool visible) { + CallJS("login.UpdateRequiredScreen.setEstimatedTimeLeftVisible", visible); +} + +void UpdateRequiredScreenHandler::SetEstimatedTimeLeft(int seconds_left) { + CallJS("login.UpdateRequiredScreen.setEstimatedTimeLeft", seconds_left); +} + +void UpdateRequiredScreenHandler::SetUIState( + UpdateRequiredView::UIState ui_state) { + CallJS("login.UpdateRequiredScreen.setUIState", static_cast<int>(ui_state)); +} + } // namespace chromeos diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.h index 7a194338521..cd52e9f012d 100644 --- a/chromium/chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.h +++ b/chromium/chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.h @@ -21,6 +21,16 @@ class UpdateRequiredScreen; class UpdateRequiredView { public: + enum UIState { + UPDATE_REQUIRED_MESSAGE = 0, // 'System update required' message. + UPDATE_PROCESS, // Update is going on. + UPDATE_NEED_PERMISSION, // Need user's permission to proceed. + UPDATE_COMPLETED_NEED_REBOOT, // Update successful, manual reboot is + // needed. + UPDATE_ERROR, // An error has occurred. + EOL // End of Life message. + }; + constexpr static StaticOobeScreenId kScreenId{"update-required"}; virtual ~UpdateRequiredView() {} @@ -36,6 +46,21 @@ class UpdateRequiredView { // Unbinds the screen from the view. virtual void Unbind() = 0; + + // Is device connected to some network? + virtual void SetIsConnected(bool connected) = 0; + // Is progress unavailable (e.g. we are checking for updates)? + virtual void SetUpdateProgressUnavailable(bool unavailable) = 0; + // Set progress percentage. + virtual void SetUpdateProgressValue(int progress) = 0; + // Set progress message (like "Verifying"). + virtual void SetUpdateProgressMessage(const base::string16& message) = 0; + // Set the visibility of the estimated time left. + virtual void SetEstimatedTimeLeftVisible(bool visible) = 0; + // Set the estimated time left, in seconds. + virtual void SetEstimatedTimeLeft(int seconds_left) = 0; + // Set the UI state of the screen. + virtual void SetUIState(UpdateRequiredView::UIState ui_state) = 0; }; class UpdateRequiredScreenHandler : public UpdateRequiredView, @@ -52,6 +77,14 @@ class UpdateRequiredScreenHandler : public UpdateRequiredView, void Bind(UpdateRequiredScreen* screen) override; void Unbind() override; + void SetIsConnected(bool connected) override; + void SetUpdateProgressUnavailable(bool unavailable) override; + void SetUpdateProgressValue(int progress) override; + void SetUpdateProgressMessage(const base::string16& message) override; + void SetEstimatedTimeLeftVisible(bool visible) override; + void SetEstimatedTimeLeft(int seconds_left) override; + void SetUIState(UpdateRequiredView::UIState ui_state) override; + // BaseScreenHandler: void DeclareLocalizedValues( ::login::LocalizedValuesBuilder* builder) override; |