Commit 6db73ca9 authored by Toni Baržić's avatar Toni Baržić Committed by Commit Bot

Revert "cros oobe: Make Gaia screen a part of wizard controller screens"

This reverts commit 9bc4b728.

Reason for revert: Suspected cause for ChromeSessionManagerTest.OobeNewUser flakiness. see
BUG=1110996

Original change's description:
> cros oobe: Make Gaia screen a part of wizard controller screens
> 
> This CL modifies code in a way that GaiaScreenHandler is owned and
> handled by GaiaScreen.
> 
> TBR=alemate@chromium.org
> 
> Bug: 1079199
> Change-Id: Idea2f8b9a2974007286e9e8562d1bcee0f2df423
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2279800
> Commit-Queue: Roman Sorokin [CET] <rsorokin@chromium.org>
> Reviewed-by: Denis Kuznetsov [CET] <antrim@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#792674}

TBR=antrim@chromium.org,alemate@chromium.org,rsorokin@chromium.org

Change-Id: I7e677d7b35b414b3ef18023a8fc4052c25fec3cf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1079199
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2327314Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792817}
parent 816d523b
...@@ -4,39 +4,12 @@ ...@@ -4,39 +4,12 @@
#include "chrome/browser/chromeos/login/screens/gaia_screen.h" #include "chrome/browser/chromeos/login/screens/gaia_screen.h"
#include "chrome/browser/chromeos/login/screen_manager.h"
#include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h"
#include "components/account_id/account_id.h"
namespace chromeos { namespace chromeos {
GaiaScreen::GaiaScreen()
: BaseScreen(GaiaView::kScreenId, OobeScreenPriority::DEFAULT) {}
// static
GaiaScreen* GaiaScreen::Get(ScreenManager* manager) {
return static_cast<GaiaScreen*>(manager->GetScreen(GaiaView::kScreenId));
}
void GaiaScreen::MaybePreloadAuthExtension() { void GaiaScreen::MaybePreloadAuthExtension() {
view_->MaybePreloadAuthExtension(); view_->MaybePreloadAuthExtension();
} }
void GaiaScreen::LoadOnline(const AccountId& account) {
view_->LoadGaiaAsync(account);
}
void GaiaScreen::LoadOffline(const AccountId& account) {
view_->LoadOfflineGaia(account);
}
void GaiaScreen::ShowImpl() {
view_->Show();
}
void GaiaScreen::HideImpl() {
view_->LoadGaiaAsync(EmptyAccountId());
view_->Hide();
}
} // namespace chromeos } // namespace chromeos
...@@ -8,35 +8,25 @@ ...@@ -8,35 +8,25 @@
#include <string> #include <string>
#include "base/bind.h" #include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/macros.h" #include "base/macros.h"
#include "chrome/browser/chromeos/login/screens/base_screen.h"
namespace chromeos { namespace chromeos {
class GaiaView; class GaiaView;
class ScreenManager;
// This class represents GAIA screen: login screen that is responsible for // This class represents GAIA screen: login screen that is responsible for
// GAIA-based sign-in. // GAIA-based sign-in.
class GaiaScreen : public BaseScreen { class GaiaScreen {
public: public:
GaiaScreen(); GaiaScreen() = default;
~GaiaScreen() override = default; virtual ~GaiaScreen() = default;
static GaiaScreen* Get(ScreenManager* manager);
void set_view(GaiaView* view) { view_ = view; } void set_view(GaiaView* view) { view_ = view; }
void MaybePreloadAuthExtension(); void MaybePreloadAuthExtension();
// Loads online Gaia into the webview.
void LoadOnline(const AccountId& account);
// Loads offline version of Gaia.
void LoadOffline(const AccountId& account);
private: private:
void ShowImpl() override;
void HideImpl() override;
GaiaView* view_ = nullptr; GaiaView* view_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(GaiaScreen); DISALLOW_COPY_AND_ASSIGN(GaiaScreen);
......
...@@ -50,13 +50,11 @@ UpdateRequiredScreen* UpdateRequiredScreen::Get(ScreenManager* manager) { ...@@ -50,13 +50,11 @@ UpdateRequiredScreen* UpdateRequiredScreen::Get(ScreenManager* manager) {
} }
UpdateRequiredScreen::UpdateRequiredScreen(UpdateRequiredView* view, UpdateRequiredScreen::UpdateRequiredScreen(UpdateRequiredView* view,
ErrorScreen* error_screen, ErrorScreen* error_screen)
base::RepeatingClosure exit_callback)
: BaseScreen(UpdateRequiredView::kScreenId, : BaseScreen(UpdateRequiredView::kScreenId,
OobeScreenPriority::SCREEN_UPDATE_REQUIRED), OobeScreenPriority::SCREEN_UPDATE_REQUIRED),
view_(view), view_(view),
error_screen_(error_screen), error_screen_(error_screen),
exit_callback_(std::move(exit_callback)),
histogram_helper_( histogram_helper_(
std::make_unique<ErrorScreensHistogramHelper>("UpdateRequired")), std::make_unique<ErrorScreensHistogramHelper>("UpdateRequired")),
version_updater_(std::make_unique<VersionUpdater>(this)), version_updater_(std::make_unique<VersionUpdater>(this)),
...@@ -378,11 +376,6 @@ void UpdateRequiredScreen::FinishExitUpdate(VersionUpdater::Result result) { ...@@ -378,11 +376,6 @@ void UpdateRequiredScreen::FinishExitUpdate(VersionUpdater::Result result) {
view_->SetUIState(UpdateRequiredView::UPDATE_ERROR); view_->SetUIState(UpdateRequiredView::UPDATE_ERROR);
} }
void UpdateRequiredScreen::Exit() {
DCHECK(!is_hidden());
exit_callback_.Run();
}
VersionUpdater* UpdateRequiredScreen::GetVersionUpdaterForTesting() { VersionUpdater* UpdateRequiredScreen::GetVersionUpdaterForTesting() {
return version_updater_.get(); return version_updater_.get();
} }
......
...@@ -35,9 +35,7 @@ class UpdateRequiredScreen : public BaseScreen, ...@@ -35,9 +35,7 @@ class UpdateRequiredScreen : public BaseScreen,
public: public:
static UpdateRequiredScreen* Get(ScreenManager* manager); static UpdateRequiredScreen* Get(ScreenManager* manager);
UpdateRequiredScreen(UpdateRequiredView* view, UpdateRequiredScreen(UpdateRequiredView* view, ErrorScreen* error_screen);
ErrorScreen* error_screen,
base::RepeatingClosure exit_callback);
~UpdateRequiredScreen() override; ~UpdateRequiredScreen() override;
// Called when the being destroyed. This should call Unbind() on the // Called when the being destroyed. This should call Unbind() on the
...@@ -57,9 +55,6 @@ class UpdateRequiredScreen : public BaseScreen, ...@@ -57,9 +55,6 @@ class UpdateRequiredScreen : public BaseScreen,
const VersionUpdater::UpdateInfo& update_info) override; const VersionUpdater::UpdateInfo& update_info) override;
void FinishExitUpdate(VersionUpdater::Result result) override; void FinishExitUpdate(VersionUpdater::Result result) override;
// Exit the screen.
void Exit();
VersionUpdater* GetVersionUpdaterForTesting(); VersionUpdater* GetVersionUpdaterForTesting();
// Set a base clock (used to set current time) for testing EOL. // Set a base clock (used to set current time) for testing EOL.
...@@ -108,7 +103,6 @@ class UpdateRequiredScreen : public BaseScreen, ...@@ -108,7 +103,6 @@ class UpdateRequiredScreen : public BaseScreen,
UpdateRequiredView* view_ = nullptr; UpdateRequiredView* view_ = nullptr;
ErrorScreen* error_screen_; ErrorScreen* error_screen_;
base::RepeatingClosure exit_callback_;
std::unique_ptr<ErrorScreensHistogramHelper> histogram_helper_; std::unique_ptr<ErrorScreensHistogramHelper> histogram_helper_;
// Whether the screen is shown. // Whether the screen is shown.
......
...@@ -71,7 +71,7 @@ class UpdateRequiredScreenUnitTest : public testing::Test { ...@@ -71,7 +71,7 @@ class UpdateRequiredScreenUnitTest : public testing::Test {
.WillRepeatedly(Return(false)); .WillRepeatedly(Return(false));
update_required_screen_ = std::make_unique<UpdateRequiredScreen>( update_required_screen_ = std::make_unique<UpdateRequiredScreen>(
fake_view_.get(), mock_error_screen_.get(), base::DoNothing()); fake_view_.get(), mock_error_screen_.get());
update_required_screen_->GetVersionUpdaterForTesting() update_required_screen_->GetVersionUpdaterForTesting()
->set_wait_for_reboot_time_for_testing(base::TimeDelta::FromSeconds(0)); ->set_wait_for_reboot_time_for_testing(base::TimeDelta::FromSeconds(0));
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "chrome/browser/chromeos/login/ui/login_display_host.h" #include "chrome/browser/chromeos/login/ui/login_display_host.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace chromeos { namespace chromeos {
...@@ -36,7 +35,7 @@ void OobeScreenExitWaiter::Wait() { ...@@ -36,7 +35,7 @@ void OobeScreenExitWaiter::Wait() {
run_loop_->Run(); run_loop_->Run();
run_loop_.reset(); run_loop_.reset();
ASSERT_EQ(State::DONE, state_); DCHECK_EQ(State::DONE, state_);
oobe_ui_observer_.RemoveAll(); oobe_ui_observer_.RemoveAll();
} }
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h"
#include "chrome/browser/chromeos/login/existing_user_controller.h" #include "chrome/browser/chromeos/login/existing_user_controller.h"
#include "chrome/browser/chromeos/login/kiosk_launch_controller.h" #include "chrome/browser/chromeos/login/kiosk_launch_controller.h"
#include "chrome/browser/chromeos/login/screens/gaia_screen.h"
#include "chrome/browser/chromeos/login/startup_utils.h" #include "chrome/browser/chromeos/login/startup_utils.h"
#include "chrome/browser/chromeos/login/ui/webui_accelerator_mapping.h" #include "chrome/browser/chromeos/login/ui/webui_accelerator_mapping.h"
#include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/chromeos/login/wizard_controller.h"
...@@ -118,6 +117,11 @@ void LoginDisplayHostCommon::StartSignInScreen() { ...@@ -118,6 +117,11 @@ void LoginDisplayHostCommon::StartSignInScreen() {
connector->ScheduleServiceInitialization( connector->ScheduleServiceInitialization(
kPolicyServiceInitializationDelayMilliseconds); kPolicyServiceInitializationDelayMilliseconds);
// Inform wizard controller that login screen has started.
// TODO(crbug.com/1064271): Move this to OnStartSignInScreen().
if (WizardController::default_controller())
WizardController::default_controller()->LoginScreenStarted();
// Run UI-specific logic. // Run UI-specific logic.
OnStartSignInScreen(); OnStartSignInScreen();
...@@ -305,22 +309,23 @@ void LoginDisplayHostCommon::OnStartSignInScreenCommon() { ...@@ -305,22 +309,23 @@ void LoginDisplayHostCommon::OnStartSignInScreenCommon() {
void LoginDisplayHostCommon::ShowGaiaDialogCommon( void LoginDisplayHostCommon::ShowGaiaDialogCommon(
const AccountId& prefilled_account) { const AccountId& prefilled_account) {
DCHECK(GetOobeUI());
if (prefilled_account.is_valid()) { if (prefilled_account.is_valid()) {
LoadWallpaper(prefilled_account); // Make sure gaia displays |account| if requested.
if (GetLoginDisplay()->delegate()->IsSigninInProgress()) { if (!GetLoginDisplay()->delegate()->IsSigninInProgress()) {
return; GetOobeUI()->GetView<GaiaScreenHandler>()->ShowGaiaAsync(
prefilled_account);
} }
LoadWallpaper(prefilled_account);
} else { } else {
if (GetOobeUI()->current_screen() != GaiaView::kScreenId) {
GetOobeUI()->GetView<GaiaScreenHandler>()->ShowGaiaAsync(
EmptyAccountId());
}
LoadSigninWallpaper(); LoadSigninWallpaper();
} }
DCHECK(GetWizardController());
GaiaScreen* gaia_screen =
GaiaScreen::Get(GetWizardController()->screen_manager());
gaia_screen->LoadOnline(prefilled_account);
StartWizard(GaiaView::kScreenId);
} }
void LoginDisplayHostCommon::Cleanup() { void LoginDisplayHostCommon::Cleanup() {
ProfileHelper::Get()->ClearSigninProfile(base::DoNothing()); ProfileHelper::Get()->ClearSigninProfile(base::DoNothing());
registrar_.RemoveAll(); registrar_.RemoveAll();
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "chrome/browser/chromeos/login/mojo_system_info_dispatcher.h" #include "chrome/browser/chromeos/login/mojo_system_info_dispatcher.h"
#include "chrome/browser/chromeos/login/reauth_stats.h" #include "chrome/browser/chromeos/login/reauth_stats.h"
#include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h" #include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h"
#include "chrome/browser/chromeos/login/screens/gaia_screen.h"
#include "chrome/browser/chromeos/login/ui/login_display.h" #include "chrome/browser/chromeos/login/ui/login_display.h"
#include "chrome/browser/chromeos/login/ui/login_display_mojo.h" #include "chrome/browser/chromeos/login/ui/login_display_mojo.h"
#include "chrome/browser/chromeos/login/user_board_view_mojo.h" #include "chrome/browser/chromeos/login/user_board_view_mojo.h"
...@@ -119,9 +118,7 @@ void LoginDisplayHostMojo::SetUserCount(int user_count) { ...@@ -119,9 +118,7 @@ void LoginDisplayHostMojo::SetUserCount(int user_count) {
// And if the dialog shows login screen. // And if the dialog shows login screen.
if (was_zero_users && user_count_ != 0 && dialog_ && dialog_->IsVisible() && if (was_zero_users && user_count_ != 0 && dialog_ && dialog_->IsVisible() &&
(!wizard_controller_->is_initialized() || (!wizard_controller_->is_initialized() ||
(wizard_controller_->current_screen() && wizard_controller_->login_screen_started())) {
wizard_controller_->current_screen()->screen_id() ==
GaiaView::kScreenId))) {
HideOobeDialog(); HideOobeDialog();
} }
} }
...@@ -256,21 +253,8 @@ void LoginDisplayHostMojo::OnStartSignInScreen() { ...@@ -256,21 +253,8 @@ void LoginDisplayHostMojo::OnStartSignInScreen() {
if (signin_screen_started_) { if (signin_screen_started_) {
// If we already have a signin screen instance, just reset the state of the // If we already have a signin screen instance, just reset the state of the
// oobe dialog. // oobe dialog.
// Try to switch to Gaia screen.
StartWizard(GaiaView::kScreenId);
if (wizard_controller_->current_screen() &&
wizard_controller_->current_screen()->screen_id() !=
GaiaView::kScreenId) {
// Switching might fail due to the screen priorities. Do no hide the
// dialog in that case.
return;
}
// Maybe hide dialog if there are existing users. It also reloads Gaia.
HideOobeDialog(); HideOobeDialog();
GetOobeUI()->GetView<GaiaScreenHandler>()->ShowGaiaAsync(EmptyAccountId());
return; return;
} }
...@@ -334,9 +318,7 @@ void LoginDisplayHostMojo::HideOobeDialog() { ...@@ -334,9 +318,7 @@ void LoginDisplayHostMojo::HideOobeDialog() {
const bool no_users = const bool no_users =
!login_display_->IsSigninInProgress() && user_count_ == 0; !login_display_->IsSigninInProgress() && user_count_ == 0;
if (no_users || GetOobeUI()->current_screen() == GaiaView::kScreenId) { if (no_users || GetOobeUI()->current_screen() == GaiaView::kScreenId) {
GaiaScreen* gaia_screen = GetOobeUI()->GetView<GaiaScreenHandler>()->ShowGaiaAsync(EmptyAccountId());
GaiaScreen::Get(GetWizardController()->screen_manager());
gaia_screen->LoadOnline(EmptyAccountId());
if (no_users) if (no_users)
return; return;
} }
......
...@@ -573,7 +573,7 @@ void LoginDisplayHostWebUI::StartWizard(OobeScreenId first_screen) { ...@@ -573,7 +573,7 @@ void LoginDisplayHostWebUI::StartWizard(OobeScreenId first_screen) {
// Keep parameters to restore if renderer crashes. // Keep parameters to restore if renderer crashes.
restore_path_ = RESTORE_WIZARD; restore_path_ = RESTORE_WIZARD;
first_screen_ = first_screen; first_screen_ = first_screen;
is_showing_login_ = (first_screen == GaiaView::kScreenId); is_showing_login_ = false;
VLOG(1) << "Login WebUI >> wizard"; VLOG(1) << "Login WebUI >> wizard";
......
...@@ -66,7 +66,6 @@ ...@@ -66,7 +66,6 @@
#include "chrome/browser/chromeos/login/screens/family_link_notice_screen.h" #include "chrome/browser/chromeos/login/screens/family_link_notice_screen.h"
#include "chrome/browser/chromeos/login/screens/fingerprint_setup_screen.h" #include "chrome/browser/chromeos/login/screens/fingerprint_setup_screen.h"
#include "chrome/browser/chromeos/login/screens/gaia_password_changed_screen.h" #include "chrome/browser/chromeos/login/screens/gaia_password_changed_screen.h"
#include "chrome/browser/chromeos/login/screens/gaia_screen.h"
#include "chrome/browser/chromeos/login/screens/gesture_navigation_screen.h" #include "chrome/browser/chromeos/login/screens/gesture_navigation_screen.h"
#include "chrome/browser/chromeos/login/screens/hid_detection_screen.h" #include "chrome/browser/chromeos/login/screens/hid_detection_screen.h"
#include "chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.h" #include "chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.h"
...@@ -566,9 +565,7 @@ std::vector<std::unique_ptr<BaseScreen>> WizardController::CreateScreens() { ...@@ -566,9 +565,7 @@ std::vector<std::unique_ptr<BaseScreen>> WizardController::CreateScreens() {
weak_factory_.GetWeakPtr()))); weak_factory_.GetWeakPtr())));
append(std::make_unique<UpdateRequiredScreen>( append(std::make_unique<UpdateRequiredScreen>(
oobe_ui->GetView<UpdateRequiredScreenHandler>(), oobe_ui->GetView<UpdateRequiredScreenHandler>(),
oobe_ui->GetErrorScreen(), oobe_ui->GetErrorScreen()));
base::BindRepeating(&WizardController::OnUpdateRequiredScreenExit,
weak_factory_.GetWeakPtr())));
append(std::make_unique<AssistantOptInFlowScreen>( append(std::make_unique<AssistantOptInFlowScreen>(
oobe_ui->GetView<AssistantOptInFlowScreenHandler>(), oobe_ui->GetView<AssistantOptInFlowScreenHandler>(),
base::BindRepeating(&WizardController::OnAssistantOptInFlowScreenExit, base::BindRepeating(&WizardController::OnAssistantOptInFlowScreenExit,
...@@ -597,9 +594,6 @@ std::vector<std::unique_ptr<BaseScreen>> WizardController::CreateScreens() { ...@@ -597,9 +594,6 @@ std::vector<std::unique_ptr<BaseScreen>> WizardController::CreateScreens() {
oobe_ui->GetView<PackagedLicenseScreenHandler>(), oobe_ui->GetView<PackagedLicenseScreenHandler>(),
base::BindRepeating(&WizardController::OnPackagedLicenseScreenExit, base::BindRepeating(&WizardController::OnPackagedLicenseScreenExit,
weak_factory_.GetWeakPtr()))); weak_factory_.GetWeakPtr())));
auto gaia_screen = std::make_unique<GaiaScreen>();
gaia_screen->set_view(oobe_ui->GetView<GaiaScreenHandler>());
append(std::move(gaia_screen));
append(std::make_unique<TpmErrorScreen>( append(std::make_unique<TpmErrorScreen>(
oobe_ui->GetView<TpmErrorScreenHandler>())); oobe_ui->GetView<TpmErrorScreenHandler>()));
...@@ -637,6 +631,10 @@ void WizardController::OnOwnershipStatusCheckDone( ...@@ -637,6 +631,10 @@ void WizardController::OnOwnershipStatusCheckDone(
ShowLoginScreen(); ShowLoginScreen();
} }
void WizardController::LoginScreenStarted() {
SetCurrentScreen(nullptr);
}
void WizardController::ShowLoginScreen() { void WizardController::ShowLoginScreen() {
// This may be triggered by multiply asynchronous events from the JS side. // This may be triggered by multiply asynchronous events from the JS side.
if (login_screen_started_) if (login_screen_started_)
...@@ -1291,17 +1289,11 @@ void WizardController::OnChangedMetricsReportingState(bool enabled) { ...@@ -1291,17 +1289,11 @@ void WizardController::OnChangedMetricsReportingState(bool enabled) {
} }
void WizardController::OnDeviceModificationCanceled() { void WizardController::OnDeviceModificationCanceled() {
current_screen_->Hide();
current_screen_ = nullptr;
if (previous_screen_) { if (previous_screen_) {
if (previous_screen_ == GetScreen(GaiaView::kScreenId)) { SetCurrentScreen(previous_screen_);
ShowLoginScreen(); } else {
} else { ShowPackagedLicenseScreen();
SetCurrentScreen(previous_screen_);
}
return;
} }
ShowPackagedLicenseScreen();
} }
void WizardController::OnSupervisionTransitionScreenExit() { void WizardController::OnSupervisionTransitionScreenExit() {
...@@ -1310,12 +1302,6 @@ void WizardController::OnSupervisionTransitionScreenExit() { ...@@ -1310,12 +1302,6 @@ void WizardController::OnSupervisionTransitionScreenExit() {
OnOobeFlowFinished(); OnOobeFlowFinished();
} }
void WizardController::OnUpdateRequiredScreenExit() {
current_screen_->Hide();
current_screen_ = nullptr;
ShowLoginScreen();
}
void WizardController::OnPackagedLicenseScreenExit( void WizardController::OnPackagedLicenseScreenExit(
PackagedLicenseScreen::Result result) { PackagedLicenseScreen::Result result) {
OnScreenExit(PackagedLicenseView::kScreenId, OnScreenExit(PackagedLicenseView::kScreenId,
...@@ -1636,8 +1622,7 @@ void WizardController::AdvanceToScreen(OobeScreenId screen_id) { ...@@ -1636,8 +1622,7 @@ void WizardController::AdvanceToScreen(OobeScreenId screen_id) {
} else if (screen_id == TpmErrorView::kScreenId || } else if (screen_id == TpmErrorView::kScreenId ||
screen_id == GaiaPasswordChangedView::kScreenId || screen_id == GaiaPasswordChangedView::kScreenId ||
screen_id == ActiveDirectoryPasswordChangeView::kScreenId || screen_id == ActiveDirectoryPasswordChangeView::kScreenId ||
screen_id == FamilyLinkNoticeView::kScreenId || screen_id == FamilyLinkNoticeView::kScreenId) {
screen_id == GaiaView::kScreenId) {
SetCurrentScreen(GetScreen(screen_id)); SetCurrentScreen(GetScreen(screen_id));
} else { } else {
if (is_out_of_box_) { if (is_out_of_box_) {
......
...@@ -173,6 +173,9 @@ class WizardController { ...@@ -173,6 +173,9 @@ class WizardController {
void SetSharedURLLoaderFactoryForTesting( void SetSharedURLLoaderFactoryForTesting(
scoped_refptr<network::SharedURLLoaderFactory> factory); scoped_refptr<network::SharedURLLoaderFactory> factory);
// Resets |current_screen_| when login screen has started.
void LoginScreenStarted();
// Configure and show GAIA password changed screen. // Configure and show GAIA password changed screen.
void ShowGaiaPasswordChangedScreen(const AccountId& account_id, void ShowGaiaPasswordChangedScreen(const AccountId& account_id,
bool has_error); bool has_error);
...@@ -270,7 +273,6 @@ class WizardController { ...@@ -270,7 +273,6 @@ class WizardController {
void OnResetScreenExit(); void OnResetScreenExit();
void OnDeviceModificationCanceled(); void OnDeviceModificationCanceled();
void OnSupervisionTransitionScreenExit(); void OnSupervisionTransitionScreenExit();
void OnUpdateRequiredScreenExit();
void OnOobeFlowFinished(); void OnOobeFlowFinished();
void OnPackagedLicenseScreenExit(PackagedLicenseScreen::Result result); void OnPackagedLicenseScreenExit(PackagedLicenseScreen::Result result);
void OnActiveDirectoryPasswordChangeScreenExit(); void OnActiveDirectoryPasswordChangeScreenExit();
......
...@@ -85,11 +85,11 @@ void MinimumVersionPolicyHandlerDelegateImpl:: ...@@ -85,11 +85,11 @@ void MinimumVersionPolicyHandlerDelegateImpl::
WizardController::default_controller(); WizardController::default_controller();
if (!wizard_controller) if (!wizard_controller)
return; return;
chromeos::UpdateRequiredScreen* screen = chromeos::BaseScreen* screen = wizard_controller->current_screen();
chromeos::UpdateRequiredScreen::Get(wizard_controller->screen_manager()); if (screen &&
if (screen->is_hidden()) screen->screen_id() == chromeos::UpdateRequiredView::kScreenId) {
return; chromeos::LoginDisplayHost::default_host()->StartSignInScreen();
screen->Exit(); }
} }
base::Version MinimumVersionPolicyHandlerDelegateImpl::GetCurrentVersion() base::Version MinimumVersionPolicyHandlerDelegateImpl::GetCurrentVersion()
......
...@@ -214,28 +214,6 @@ IN_PROC_BROWSER_TEST_F(DeviceDisablingTest, DisableWithEphemeralUsers) { ...@@ -214,28 +214,6 @@ IN_PROC_BROWSER_TEST_F(DeviceDisablingTest, DisableWithEphemeralUsers) {
test::CreateOobeScreenWaiter("device-disabled")->Wait(); test::CreateOobeScreenWaiter("device-disabled")->Wait();
} }
class DeviceDisablingWithUsersTest : public DeviceDisablingTest {
public:
DeviceDisablingWithUsersTest() { login_manager_.AppendRegularUsers(2); }
private:
LoginManagerMixin login_manager_{&mixin_host_};
};
// Checks that OOBE dialog is not hidden when the device disabled screen is
// shown and "StartSignInScreen" is called.
IN_PROC_BROWSER_TEST_F(DeviceDisablingWithUsersTest, DialogNotHidden) {
EXPECT_TRUE(ash::LoginScreenTestApi::ClickAddUserButton());
EXPECT_TRUE(ash::LoginScreenTestApi::IsOobeDialogVisible());
OobeScreenWaiter(GaiaView::kScreenId).Wait();
MarkDisabledAndWaitForPolicyFetch();
OobeScreenWaiter(DeviceDisabledScreenView::kScreenId).Wait();
LoginDisplayHost::default_host()->StartSignInScreen();
// Dialog should not be hidden.
EXPECT_TRUE(ash::LoginScreenTestApi::IsOobeDialogVisible());
}
// Sets the device disabled policy before the browser is started. // Sets the device disabled policy before the browser is started.
class PresetPolicyDeviceDisablingTest : public DeviceDisablingTest { class PresetPolicyDeviceDisablingTest : public DeviceDisablingTest {
public: public:
......
...@@ -711,6 +711,8 @@ Polymer({ ...@@ -711,6 +711,8 @@ Polymer({
* Event handler that is invoked just before the frame is shown. * Event handler that is invoked just before the frame is shown.
*/ */
onBeforeShow() { onBeforeShow() {
this.screenMode_ = AuthMode.DEFAULT;
this.loadingFrameContents_ = true;
chrome.send('loginUIStateChanged', ['gaia-signin', true]); chrome.send('loginUIStateChanged', ['gaia-signin', true]);
// Ensure that GAIA signin (or loading UI) is actually visible. // Ensure that GAIA signin (or loading UI) is actually visible.
......
...@@ -697,10 +697,8 @@ void GaiaScreenHandler::Initialize() { ...@@ -697,10 +697,8 @@ void GaiaScreenHandler::Initialize() {
initialized_ = true; initialized_ = true;
// This should be called only once on page load. // This should be called only once on page load.
AllowJavascript(); AllowJavascript();
if (show_on_init_) { if (show_when_ready_)
show_on_init_ = false;
ShowGaiaScreenIfReady(); ShowGaiaScreenIfReady();
}
} }
void GaiaScreenHandler::RegisterMessages() { void GaiaScreenHandler::RegisterMessages() {
...@@ -883,7 +881,7 @@ void GaiaScreenHandler::HandleCompleteAdAuthentication( ...@@ -883,7 +881,7 @@ void GaiaScreenHandler::HandleCompleteAdAuthentication(
if (LoginDisplayHost::default_host()) if (LoginDisplayHost::default_host())
LoginDisplayHost::default_host()->SetDisplayEmail(username); LoginDisplayHost::default_host()->SetDisplayEmail(username);
populated_account_id_ = AccountId::FromUserEmail(username); set_populated_account(AccountId::FromUserEmail(username));
DCHECK(authpolicy_login_helper_); DCHECK(authpolicy_login_helper_);
Key key(password); Key key(password);
key.SetLabel(kCryptohomeGaiaKeyLabel); key.SetLabel(kCryptohomeGaiaKeyLabel);
...@@ -927,15 +925,6 @@ void GaiaScreenHandler::HandleCompleteAuthentication( ...@@ -927,15 +925,6 @@ void GaiaScreenHandler::HandleCompleteAuthentication(
} }
ContinueAuthenticationWhenCookiesAvailable(); ContinueAuthenticationWhenCookiesAvailable();
if (test_expects_complete_login_) {
VLOG(2) << "Complete test login for " << sanitized_email
<< ", requested=" << test_user_;
test_expects_complete_login_ = false;
test_user_.clear();
test_pass_.clear();
}
} }
void GaiaScreenHandler::ContinueAuthenticationWhenCookiesAvailable() { void GaiaScreenHandler::ContinueAuthenticationWhenCookiesAvailable() {
...@@ -1093,7 +1082,7 @@ void GaiaScreenHandler::HandleShowAddUser(const base::ListValue* args) { ...@@ -1093,7 +1082,7 @@ void GaiaScreenHandler::HandleShowAddUser(const base::ListValue* args) {
// |args| can be null if it's OOBE. // |args| can be null if it's OOBE.
if (args) if (args)
args->GetString(0, &email); args->GetString(0, &email);
populated_account_id_ = AccountId::FromUserEmail(email); set_populated_account(AccountId::FromUserEmail(email));
OnShowAddUser(); OnShowAddUser();
} }
...@@ -1158,8 +1147,7 @@ void GaiaScreenHandler::HandleSecurityTokenPinEntered( ...@@ -1158,8 +1147,7 @@ void GaiaScreenHandler::HandleSecurityTokenPinEntered(
void GaiaScreenHandler::OnShowAddUser() { void GaiaScreenHandler::OnShowAddUser() {
signin_screen_handler_->is_account_picker_showing_first_time_ = false; signin_screen_handler_->is_account_picker_showing_first_time_ = false;
lock_screen_utils::EnforceDevicePolicyInputMethods(std::string()); lock_screen_utils::EnforceDevicePolicyInputMethods(std::string());
LoadGaiaAsync(EmptyAccountId()); ShowGaiaAsync(EmptyAccountId());
LoginDisplayHost::default_host()->StartWizard(GaiaView::kScreenId);
} }
void GaiaScreenHandler::DoCompleteLogin( void GaiaScreenHandler::DoCompleteLogin(
...@@ -1192,6 +1180,15 @@ void GaiaScreenHandler::DoCompleteLogin( ...@@ -1192,6 +1180,15 @@ void GaiaScreenHandler::DoCompleteLogin(
} }
LoginDisplayHost::default_host()->CompleteLogin(user_context); LoginDisplayHost::default_host()->CompleteLogin(user_context);
if (test_expects_complete_login_) {
VLOG(2) << "Complete test login for " << typed_email
<< ", requested=" << test_user_;
test_expects_complete_login_ = false;
test_user_.clear();
test_pass_.clear();
}
} }
void GaiaScreenHandler::StartClearingDnsCache() { void GaiaScreenHandler::StartClearingDnsCache() {
...@@ -1273,8 +1270,8 @@ void GaiaScreenHandler::SubmitLoginFormForTest() { ...@@ -1273,8 +1270,8 @@ void GaiaScreenHandler::SubmitLoginFormForTest() {
base::NullCallback()); base::NullCallback());
} }
// Test properties are cleared in HandleCompleteAuthentication because the // Test properties are cleared in HandleCompleteLogin because the form
// form submission might fail and login will not be attempted after reloading // submission might fail and login will not be attempted after reloading
// if they are cleared here. // if they are cleared here.
} }
...@@ -1286,18 +1283,10 @@ void GaiaScreenHandler::SetSAMLPrincipalsAPIUsed(bool is_third_party_idp, ...@@ -1286,18 +1283,10 @@ void GaiaScreenHandler::SetSAMLPrincipalsAPIUsed(bool is_third_party_idp,
RecordAPILogin(is_third_party_idp, is_api_used); RecordAPILogin(is_third_party_idp, is_api_used);
} }
void GaiaScreenHandler::Show() { void GaiaScreenHandler::ShowGaiaAsync(const AccountId& account_id) {
ShowScreen(GaiaView::kScreenId);
hidden_ = false;
}
void GaiaScreenHandler::Hide() {
hidden_ = true;
}
void GaiaScreenHandler::LoadGaiaAsync(const AccountId& account_id) {
if (account_id.is_valid()) if (account_id.is_valid())
populated_account_id_ = account_id; populated_account_id_ = account_id;
show_when_ready_ = true;
if (gaia_silent_load_ && !populated_account_id_.is_valid()) { if (gaia_silent_load_ && !populated_account_id_.is_valid()) {
dns_cleared_ = true; dns_cleared_ = true;
cookies_cleared_ = true; cookies_cleared_ = true;
...@@ -1309,11 +1298,6 @@ void GaiaScreenHandler::LoadGaiaAsync(const AccountId& account_id) { ...@@ -1309,11 +1298,6 @@ void GaiaScreenHandler::LoadGaiaAsync(const AccountId& account_id) {
} }
} }
void GaiaScreenHandler::LoadOfflineGaia(const AccountId& account_id) {
populated_account_id_ = account_id;
LoadAuthExtension(true /* force */, true /* offline */);
}
void GaiaScreenHandler::ShowSigninScreenForTest(const std::string& username, void GaiaScreenHandler::ShowSigninScreenForTest(const std::string& username,
const std::string& password, const std::string& password,
const std::string& services) { const std::string& services) {
...@@ -1397,12 +1381,13 @@ void GaiaScreenHandler::CreateSamlChallengeKeyHandler() { ...@@ -1397,12 +1381,13 @@ void GaiaScreenHandler::CreateSamlChallengeKeyHandler() {
saml_challenge_key_handler_ = std::make_unique<SamlChallengeKeyHandler>(); saml_challenge_key_handler_ = std::make_unique<SamlChallengeKeyHandler>();
} }
void GaiaScreenHandler::CancelShowGaiaAsync() {
show_when_ready_ = false;
}
void GaiaScreenHandler::ShowGaiaScreenIfReady() { void GaiaScreenHandler::ShowGaiaScreenIfReady() {
if (!initialized_) { if (!dns_cleared_ || !cookies_cleared_ || !initialized_ ||
show_on_init_ = true; !show_when_ready_ || !LoginDisplayHost::default_host()) {
return;
}
if (!dns_cleared_ || !cookies_cleared_ || !LoginDisplayHost::default_host()) {
return; return;
} }
...@@ -1533,7 +1518,7 @@ void GaiaScreenHandler::SetOfflineLoginIsActive(bool is_active) { ...@@ -1533,7 +1518,7 @@ void GaiaScreenHandler::SetOfflineLoginIsActive(bool is_active) {
} }
void GaiaScreenHandler::UpdateState(NetworkError::ErrorReason reason) { void GaiaScreenHandler::UpdateState(NetworkError::ErrorReason reason) {
if (signin_screen_handler_ && !hidden_) if (signin_screen_handler_)
signin_screen_handler_->UpdateState(reason); signin_screen_handler_->UpdateState(reason);
} }
......
...@@ -58,17 +58,11 @@ class GaiaView { ...@@ -58,17 +58,11 @@ class GaiaView {
virtual void DisableRestrictiveProxyCheckForTest() = 0; virtual void DisableRestrictiveProxyCheckForTest() = 0;
// Loads Gaia into the webview. Depending on internal state, the Gaia will // Show the sign-in screen. Depending on internal state, the screen will
// either be loaded immediately or after an asynchronous clean-up process that // either be shown immediately or after an asynchronous clean-up process that
// cleans DNS cache and cookies. If available, |account_id| is used for // cleans DNS cache and cookies. If available, |account_id| is used for
// prefilling information. // prefilling information.
virtual void LoadGaiaAsync(const AccountId& account_id) = 0; virtual void ShowGaiaAsync(const AccountId& account_id) = 0;
virtual void LoadOfflineGaia(const AccountId& account_id) = 0;
// Shows Gaia screen.
virtual void Show() = 0;
virtual void Hide() = 0;
// Show sign-in screen for the given credentials. |services| is a list of // Show sign-in screen for the given credentials. |services| is a list of
// services returned by userInfo call as JSON array. Should be an empty array // services returned by userInfo call as JSON array. Should be an empty array
...@@ -121,10 +115,7 @@ class GaiaScreenHandler : public BaseScreenHandler, ...@@ -121,10 +115,7 @@ class GaiaScreenHandler : public BaseScreenHandler,
// GaiaView: // GaiaView:
void MaybePreloadAuthExtension() override; void MaybePreloadAuthExtension() override;
void DisableRestrictiveProxyCheckForTest() override; void DisableRestrictiveProxyCheckForTest() override;
void LoadGaiaAsync(const AccountId& account_id) override; void ShowGaiaAsync(const AccountId& account_id) override;
void LoadOfflineGaia(const AccountId& account_id) override;
void Show() override;
void Hide() override;
void ShowSigninScreenForTest(const std::string& username, void ShowSigninScreenForTest(const std::string& username,
const std::string& password, const std::string& password,
const std::string& services) override; const std::string& services) override;
...@@ -260,6 +251,11 @@ class GaiaScreenHandler : public BaseScreenHandler, ...@@ -260,6 +251,11 @@ class GaiaScreenHandler : public BaseScreenHandler,
bool using_saml, bool using_saml,
const SamlPasswordAttributes& password_attributes); const SamlPasswordAttributes& password_attributes);
// Fill GAIA account.
void set_populated_account(const AccountId& populated_account_id) {
populated_account_id_ = populated_account_id;
}
// Kick off cookie / local storage cleanup. // Kick off cookie / local storage cleanup.
void StartClearingCookies(const base::Closure& on_clear_callback); void StartClearingCookies(const base::Closure& on_clear_callback);
void OnCookiesCleared(const base::Closure& on_clear_callback); void OnCookiesCleared(const base::Closure& on_clear_callback);
...@@ -281,6 +277,10 @@ class GaiaScreenHandler : public BaseScreenHandler, ...@@ -281,6 +277,10 @@ class GaiaScreenHandler : public BaseScreenHandler,
// Chrome Credentials Passing API was used during SAML login. // Chrome Credentials Passing API was used during SAML login.
void SetSAMLPrincipalsAPIUsed(bool is_third_party_idp, bool is_api_used); 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.
void CancelShowGaiaAsync();
// Shows signin screen after dns cache and cookie cleanup operations finish. // Shows signin screen after dns cache and cookie cleanup operations finish.
void ShowGaiaScreenIfReady(); void ShowGaiaScreenIfReady();
...@@ -359,8 +359,6 @@ class GaiaScreenHandler : public BaseScreenHandler, ...@@ -359,8 +359,6 @@ class GaiaScreenHandler : public BaseScreenHandler,
// Whether the handler has been initialized. // Whether the handler has been initialized.
bool initialized_ = false; bool initialized_ = false;
bool show_on_init_ = false;
// True if dns cache cleanup is done. // True if dns cache cleanup is done.
bool dns_cleared_ = false; bool dns_cleared_ = false;
...@@ -447,8 +445,6 @@ class GaiaScreenHandler : public BaseScreenHandler, ...@@ -447,8 +445,6 @@ class GaiaScreenHandler : public BaseScreenHandler,
// canceled by the user. // canceled by the user.
bool was_security_token_pin_canceled_ = false; bool was_security_token_pin_canceled_ = false;
bool hidden_ = true;
// Handler for |samlChallengeMachineKey| request. // Handler for |samlChallengeMachineKey| request.
std::unique_ptr<SamlChallengeKeyHandler> saml_challenge_key_handler_; std::unique_ptr<SamlChallengeKeyHandler> saml_challenge_key_handler_;
std::unique_ptr<SamlChallengeKeyHandler> saml_challenge_key_handler_for_test_; std::unique_ptr<SamlChallengeKeyHandler> saml_challenge_key_handler_for_test_;
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h" #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h"
#include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h" #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h"
#include "chrome/browser/chromeos/login/reauth_stats.h" #include "chrome/browser/chromeos/login/reauth_stats.h"
#include "chrome/browser/chromeos/login/screens/gaia_screen.h"
#include "chrome/browser/chromeos/login/screens/network_error.h" #include "chrome/browser/chromeos/login/screens/network_error.h"
#include "chrome/browser/chromeos/login/startup_utils.h" #include "chrome/browser/chromeos/login/startup_utils.h"
#include "chrome/browser/chromeos/login/ui/login_display_host.h" #include "chrome/browser/chromeos/login/ui/login_display_host.h"
...@@ -521,9 +520,11 @@ void SigninScreenHandler::UpdateUIState(UIState ui_state) { ...@@ -521,9 +520,11 @@ void SigninScreenHandler::UpdateUIState(UIState ui_state) {
switch (ui_state) { switch (ui_state) {
case UI_STATE_GAIA_SIGNIN: case UI_STATE_GAIA_SIGNIN:
ui_state_ = UI_STATE_GAIA_SIGNIN; ui_state_ = UI_STATE_GAIA_SIGNIN;
ShowScreen(GaiaView::kScreenId);
break; break;
case UI_STATE_ACCOUNT_PICKER: case UI_STATE_ACCOUNT_PICKER:
ui_state_ = UI_STATE_ACCOUNT_PICKER; ui_state_ = UI_STATE_ACCOUNT_PICKER;
gaia_screen_handler_->CancelShowGaiaAsync();
ShowScreen(OobeScreen::SCREEN_ACCOUNT_PICKER); ShowScreen(OobeScreen::SCREEN_ACCOUNT_PICKER);
break; break;
default: default:
...@@ -867,9 +868,7 @@ void SigninScreenHandler::OnPreferencesChanged() { ...@@ -867,9 +868,7 @@ void SigninScreenHandler::OnPreferencesChanged() {
// We need to reload GAIA if UI_STATE_UNKNOWN or the allow new user setting // We need to reload GAIA if UI_STATE_UNKNOWN or the allow new user setting
// has changed so that reloaded GAIA shows/hides the option to create a new // has changed so that reloaded GAIA shows/hides the option to create a new
// account. // account.
GaiaScreen* gaia_screen = GaiaScreen::Get( UpdateUIState(UI_STATE_ACCOUNT_PICKER);
WizardController::default_controller()->screen_manager());
gaia_screen->LoadOnline(EmptyAccountId());
} }
} }
...@@ -1057,13 +1056,8 @@ void SigninScreenHandler::HandleOfflineLogin(const base::ListValue* args) { ...@@ -1057,13 +1056,8 @@ void SigninScreenHandler::HandleOfflineLogin(const base::ListValue* args) {
std::string email; std::string email;
args->GetString(0, &email); args->GetString(0, &email);
GaiaScreen* gaia_screen = gaia_screen_handler_->set_populated_account(AccountId::FromUserEmail(email));
GaiaScreen::Get(WizardController::default_controller()->screen_manager()); gaia_screen_handler_->LoadAuthExtension(true /* force */, true /* offline */);
gaia_screen->LoadOffline(AccountId::FromUserEmail(email));
HideOfflineMessage(NetworkStateInformer::OFFLINE,
NetworkError::ERROR_REASON_NONE);
LoginDisplayHost::default_host()->StartWizard(GaiaView::kScreenId);
UpdateUIState(UI_STATE_GAIA_SIGNIN); UpdateUIState(UI_STATE_GAIA_SIGNIN);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment