Commit b8dbb264 authored by bartfab@chromium.org's avatar bartfab@chromium.org

Move *UserLoggedIn methods from UserManager to UserManagerImpl

This CL trims down the UserManager interfaces by moving the *UserLogged
methods that are really just implementation details to UserManagerImpl.

BUG=None
TEST=Manual and browser/unit tests

Review URL: https://chromiumcodereview.appspot.com/14069017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194938 0039d316-1c4b-4281-b951-d872f2087c98
parent 4794b7f4
...@@ -782,9 +782,12 @@ void ExistingUserController::OnProfilePrepared(Profile* profile) { ...@@ -782,9 +782,12 @@ void ExistingUserController::OnProfilePrepared(Profile* profile) {
host_ = NULL; host_ = NULL;
} else { } else {
#endif #endif
ActivateWizard(WizardController::IsDeviceRegistered() ? // Mark the device as registered., i.e. the second part of OOBE as
WizardController::kTermsOfServiceScreenName : // completed.
WizardController::kRegistrationScreenName); if (!WizardController::IsDeviceRegistered())
WizardController::MarkDeviceRegistered();
ActivateWizard(WizardController::kTermsOfServiceScreenName);
#ifndef NDEBUG #ifndef NDEBUG
} }
#endif #endif
...@@ -805,17 +808,12 @@ void ExistingUserController::OnProfilePrepared(Profile* profile) { ...@@ -805,17 +808,12 @@ void ExistingUserController::OnProfilePrepared(Profile* profile) {
void ExistingUserController::OnOffTheRecordLoginSuccess() { void ExistingUserController::OnOffTheRecordLoginSuccess() {
is_login_in_progress_ = false; is_login_in_progress_ = false;
offline_failed_ = false; offline_failed_ = false;
if (WizardController::IsDeviceRegistered()) {
LoginUtils::Get()->CompleteOffTheRecordLogin(guest_mode_url_); // Mark the device as registered., i.e. the second part of OOBE as completed.
} else { if (!WizardController::IsDeviceRegistered())
// Postpone CompleteOffTheRecordLogin until registration completion. WizardController::MarkDeviceRegistered();
// TODO(nkostylev): Kind of hack. We have to instruct UserManager here
// that we're actually logged in as Guest user as we'll ask UserManager LoginUtils::Get()->CompleteOffTheRecordLogin(guest_mode_url_);
// later in the code path whether we've signed in as Guest and depending
// on that would either show image screen or call CompleteOffTheRecordLogin.
UserManager::Get()->GuestUserLoggedIn();
ActivateWizard(WizardController::kRegistrationScreenName);
}
if (login_status_consumer_) if (login_status_consumer_)
login_status_consumer_->OnOffTheRecordLoginSuccess(); login_status_consumer_->OnOffTheRecordLoginSuccess();
...@@ -896,12 +894,7 @@ void ExistingUserController::OnOnlineChecked(const std::string& username, ...@@ -896,12 +894,7 @@ void ExistingUserController::OnOnlineChecked(const std::string& username,
// ExistingUserController, private: // ExistingUserController, private:
void ExistingUserController::ActivateWizard(const std::string& screen_name) { void ExistingUserController::ActivateWizard(const std::string& screen_name) {
DictionaryValue* params = NULL; host_->StartWizard(screen_name, NULL);
if (chromeos::UserManager::Get()->IsLoggedInAsGuest()) {
params = new DictionaryValue;
params->SetString("start_url", guest_mode_url_.spec());
}
host_->StartWizard(screen_name, params);
} }
void ExistingUserController::ConfigurePublicSessionAutoLogin() { void ExistingUserController::ConfigurePublicSessionAutoLogin() {
......
...@@ -66,7 +66,6 @@ ...@@ -66,7 +66,6 @@
using ::testing::_; using ::testing::_;
using ::testing::AnyNumber; using ::testing::AnyNumber;
using ::testing::AnyOf;
using ::testing::Invoke; using ::testing::Invoke;
using ::testing::InvokeWithoutArgs; using ::testing::InvokeWithoutArgs;
using ::testing::Return; using ::testing::Return;
...@@ -398,14 +397,8 @@ IN_PROC_BROWSER_TEST_F(ExistingUserControllerTest, ...@@ -398,14 +397,8 @@ IN_PROC_BROWSER_TEST_F(ExistingUserControllerTest,
EXPECT_CALL(*mock_login_display_host_, EXPECT_CALL(*mock_login_display_host_,
StartWizard(WizardController::kEnterpriseEnrollmentScreenName, _)) StartWizard(WizardController::kEnterpriseEnrollmentScreenName, _))
.Times(0); .Times(0);
// This will be the first sign-in of a new user, which may cause the (legacy)
// registration to be activated. A real WizardController instance immediately
// advances to the Terms of Service or user image screen but this test uses
// MockLoginDisplayHost Instead.
EXPECT_CALL(*mock_login_display_host_, EXPECT_CALL(*mock_login_display_host_,
StartWizard(AnyOf(WizardController::kRegistrationScreenName, StartWizard(WizardController::kTermsOfServiceScreenName, NULL))
WizardController::kTermsOfServiceScreenName),
NULL))
.Times(1); .Times(1);
EXPECT_CALL(*mock_login_utils_, CreateAuthenticator(_)) EXPECT_CALL(*mock_login_utils_, CreateAuthenticator(_))
.Times(1) .Times(1)
......
...@@ -712,8 +712,6 @@ void LoginUtilsImpl::RespectLocalePreference(Profile* profile) { ...@@ -712,8 +712,6 @@ void LoginUtilsImpl::RespectLocalePreference(Profile* profile) {
void LoginUtilsImpl::CompleteOffTheRecordLogin(const GURL& start_url) { void LoginUtilsImpl::CompleteOffTheRecordLogin(const GURL& start_url) {
VLOG(1) << "Completing incognito login"; VLOG(1) << "Completing incognito login";
UserManager::Get()->GuestUserLoggedIn();
// For guest session we ask session manager to restart Chrome with --bwsi // For guest session we ask session manager to restart Chrome with --bwsi
// flag. We keep only some of the arguments of this process. // flag. We keep only some of the arguments of this process.
const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
......
...@@ -29,13 +29,6 @@ class MockUserManager : public UserManager { ...@@ -29,13 +29,6 @@ class MockUserManager : public UserManager {
MOCK_METHOD3(UserLoggedIn, void( MOCK_METHOD3(UserLoggedIn, void(
const std::string&, const std::string&, bool)); const std::string&, const std::string&, bool));
MOCK_METHOD1(SwitchActiveUser, void(const std::string& email)); MOCK_METHOD1(SwitchActiveUser, void(const std::string& email));
MOCK_METHOD0(RetailModeUserLoggedIn, void(void));
MOCK_METHOD0(GuestUserLoggedIn, void(void));
MOCK_METHOD1(KioskAppLoggedIn, void(const std::string& app_id));
MOCK_METHOD1(LocallyManagedUserLoggedIn, void(const std::string&));
MOCK_METHOD1(PublicAccountUserLoggedIn, void(User*));
MOCK_METHOD2(RegularUserLoggedIn, void(const std::string&, bool));
MOCK_METHOD1(RegularUserLoggedInAsEphemeral, void(const std::string&));
MOCK_METHOD0(SessionStarted, void(void)); MOCK_METHOD0(SessionStarted, void(void));
MOCK_METHOD2(RemoveUser, void(const std::string&, RemoveUserDelegate*)); MOCK_METHOD2(RemoveUser, void(const std::string&, RemoveUserDelegate*));
MOCK_METHOD1(RemoveUserFromList, void(const std::string&)); MOCK_METHOD1(RemoveUserFromList, void(const std::string&));
......
...@@ -110,28 +110,6 @@ class UserManager { ...@@ -110,28 +110,6 @@ class UserManager {
// Switches to active user identified by |email|. User has to be logged in. // Switches to active user identified by |email|. User has to be logged in.
virtual void SwitchActiveUser(const std::string& email) = 0; virtual void SwitchActiveUser(const std::string& email) = 0;
// Indicates that user just logged on as the retail mode user.
virtual void RetailModeUserLoggedIn() = 0;
// Indicates that user just started incognito session.
virtual void GuestUserLoggedIn() = 0;
// Indicates that a kiosk app robot just logged in.
virtual void KioskAppLoggedIn(const std::string& app_id) = 0;
// Indicates that a locally managed user just logged in.
virtual void LocallyManagedUserLoggedIn(const std::string& username) = 0;
// Indicates that a user just logged into a public account.
virtual void PublicAccountUserLoggedIn(User* user) = 0;
// Indicates that a regular user just logged in.
virtual void RegularUserLoggedIn(const std::string& email,
bool browser_restart) = 0;
// Indicates that a regular user just logged in as ephemeral.
virtual void RegularUserLoggedInAsEphemeral(const std::string& email) = 0;
// Called when browser session is started i.e. after // Called when browser session is started i.e. after
// browser_creator.LaunchBrowser(...) was called after user sign in. // browser_creator.LaunchBrowser(...) was called after user sign in.
// When user is at the image screen IsUserLoggedIn() will return true // When user is at the image screen IsUserLoggedIn() will return true
......
...@@ -51,15 +51,6 @@ class UserManagerImpl ...@@ -51,15 +51,6 @@ class UserManagerImpl
const std::string& username_hash, const std::string& username_hash,
bool browser_restart) OVERRIDE; bool browser_restart) OVERRIDE;
virtual void SwitchActiveUser(const std::string& email) OVERRIDE; virtual void SwitchActiveUser(const std::string& email) OVERRIDE;
virtual void RetailModeUserLoggedIn() OVERRIDE;
virtual void GuestUserLoggedIn() OVERRIDE;
virtual void KioskAppLoggedIn(const std::string& username) OVERRIDE;
virtual void LocallyManagedUserLoggedIn(const std::string& username) OVERRIDE;
virtual void PublicAccountUserLoggedIn(User* user) OVERRIDE;
virtual void RegularUserLoggedIn(const std::string& email,
bool browser_restart) OVERRIDE;
virtual void RegularUserLoggedInAsEphemeral(
const std::string& email) OVERRIDE;
virtual void SessionStarted() OVERRIDE; virtual void SessionStarted() OVERRIDE;
virtual void RemoveUser(const std::string& email, virtual void RemoveUser(const std::string& email,
RemoveUserDelegate* delegate) OVERRIDE; RemoveUserDelegate* delegate) OVERRIDE;
...@@ -173,6 +164,27 @@ class UserManagerImpl ...@@ -173,6 +164,27 @@ class UserManagerImpl
// Same as FindUserInList but returns non-const pointer to User object. // Same as FindUserInList but returns non-const pointer to User object.
User* FindUserInListAndModify(const std::string& email); User* FindUserInListAndModify(const std::string& email);
// Indicates that a user just logged in as guest.
void GuestUserLoggedIn();
// Indicates that a regular user just logged in.
void RegularUserLoggedIn(const std::string& email, bool browser_restart);
// Indicates that a regular user just logged in as ephemeral.
void RegularUserLoggedInAsEphemeral(const std::string& email);
// Indicates that a locally managed user just logged in.
void LocallyManagedUserLoggedIn(const std::string& username);
// Indicates that a user just logged into a public session.
void PublicAccountUserLoggedIn(User* user);
// Indicates that a kiosk app robot just logged in.
void KioskAppLoggedIn(const std::string& app_id);
// Indicates that a user just logged into a retail mode session.
void RetailModeUserLoggedIn();
// Notifies that user has logged in. // Notifies that user has logged in.
// Sends NOTIFICATION_LOGIN_USER_CHANGED notification. // Sends NOTIFICATION_LOGIN_USER_CHANGED notification.
void NotifyOnLogin(); void NotifyOnLogin();
......
...@@ -114,7 +114,6 @@ const char WizardController::kLoginScreenName[] = "login"; ...@@ -114,7 +114,6 @@ const char WizardController::kLoginScreenName[] = "login";
const char WizardController::kUpdateScreenName[] = "update"; const char WizardController::kUpdateScreenName[] = "update";
const char WizardController::kUserImageScreenName[] = "image"; const char WizardController::kUserImageScreenName[] = "image";
const char WizardController::kEulaScreenName[] = "eula"; const char WizardController::kEulaScreenName[] = "eula";
const char WizardController::kRegistrationScreenName[] = "register";
const char WizardController::kEnterpriseEnrollmentScreenName[] = "enroll"; const char WizardController::kEnterpriseEnrollmentScreenName[] = "enroll";
const char WizardController::kResetScreenName[] = "reset"; const char WizardController::kResetScreenName[] = "reset";
const char WizardController::kErrorScreenName[] = "error-message"; const char WizardController::kErrorScreenName[] = "error-message";
...@@ -533,21 +532,6 @@ void WizardController::OnUserImageSkipped() { ...@@ -533,21 +532,6 @@ void WizardController::OnUserImageSkipped() {
OnUserImageSelected(); OnUserImageSelected();
} }
void WizardController::OnRegistrationSuccess() {
MarkDeviceRegistered();
if (chromeos::UserManager::Get()->IsLoggedInAsGuest()) {
std::string spec;
GURL start_url;
if (screen_parameters_.get() &&
screen_parameters_->GetString("start_url", &spec)) {
start_url = GURL(spec);
}
chromeos::LoginUtils::Get()->CompleteOffTheRecordLogin(start_url);
} else {
ShowTermsOfServiceScreen();
}
}
void WizardController::OnEnterpriseEnrollmentDone() { void WizardController::OnEnterpriseEnrollmentDone() {
ShowLoginScreen(); ShowLoginScreen();
} }
...@@ -674,9 +658,6 @@ void WizardController::AdvanceToScreen(const std::string& screen_name) { ...@@ -674,9 +658,6 @@ void WizardController::AdvanceToScreen(const std::string& screen_name) {
ShowUserImageScreen(); ShowUserImageScreen();
} else if (screen_name == kEulaScreenName) { } else if (screen_name == kEulaScreenName) {
ShowEulaScreen(); ShowEulaScreen();
} else if (screen_name == kRegistrationScreenName) {
// Just proceed to next stage.
OnRegistrationSuccess();
} else if (screen_name == kResetScreenName) { } else if (screen_name == kResetScreenName) {
ShowResetScreen(); ShowResetScreen();
} else if (screen_name == kEnterpriseEnrollmentScreenName) { } else if (screen_name == kEnterpriseEnrollmentScreenName) {
......
...@@ -157,8 +157,6 @@ class WizardController : public ScreenObserver { ...@@ -157,8 +157,6 @@ class WizardController : public ScreenObserver {
static const char kLoginScreenName[]; static const char kLoginScreenName[];
static const char kUpdateScreenName[]; static const char kUpdateScreenName[];
static const char kUserImageScreenName[]; static const char kUserImageScreenName[];
// Not a real screen, just a placeholder for OOBE final stage.
static const char kRegistrationScreenName[];
static const char kOutOfBoxScreenName[]; static const char kOutOfBoxScreenName[];
static const char kTestNoScreenName[]; static const char kTestNoScreenName[];
static const char kEulaScreenName[]; static const char kEulaScreenName[];
...@@ -197,8 +195,6 @@ class WizardController : public ScreenObserver { ...@@ -197,8 +195,6 @@ class WizardController : public ScreenObserver {
void OnUpdateErrorUpdating(); void OnUpdateErrorUpdating();
void OnUserImageSelected(); void OnUserImageSelected();
void OnUserImageSkipped(); void OnUserImageSkipped();
void OnRegistrationSuccess();
void OnRegistrationSkipped();
void OnEnterpriseEnrollmentDone(); void OnEnterpriseEnrollmentDone();
void OnEnterpriseAutoEnrollmentDone(); void OnEnterpriseAutoEnrollmentDone();
void OnResetCanceled(); void OnResetCanceled();
......
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