Index: chrome/browser/chromeos/login/ui/webui_login_display.cc |
diff --git a/chrome/browser/chromeos/login/ui/webui_login_display.cc b/chrome/browser/chromeos/login/ui/webui_login_display.cc |
index 7bf949bf8d32d125a56de88b187a0aabc2cfe176..51895c955c838331a2b847fe830590b1cc1e9194 100644 |
--- a/chrome/browser/chromeos/login/ui/webui_login_display.cc |
+++ b/chrome/browser/chromeos/login/ui/webui_login_display.cc |
@@ -46,7 +46,9 @@ WebUILoginDisplay::WebUILoginDisplay(LoginDisplay::Delegate* delegate) |
: LoginDisplay(delegate, gfx::Rect()), |
show_guest_(false), |
show_new_user_(false), |
- webui_handler_(NULL) { |
+ webui_handler_(NULL), |
+ gaia_screen_(new GaiaScreen()), |
+ user_selection_screen_(new UserSelectionScreen()) { |
} |
void WebUILoginDisplay::ClearAndEnablePassword() { |
@@ -61,7 +63,7 @@ void WebUILoginDisplay::Init(const UserList& users, |
// Testing that the delegate has been set. |
DCHECK(delegate_); |
- users_ = users; |
+ user_selection_screen_->Init(users); |
show_guest_ = show_guest; |
show_users_ = show_users; |
show_new_user_ = show_new_user; |
@@ -72,59 +74,33 @@ void WebUILoginDisplay::Init(const UserList& users, |
activity_detector->AddObserver(this); |
} |
-void WebUILoginDisplay::OnPreferencesChanged() { |
- if (webui_handler_) |
- webui_handler_->OnPreferencesChanged(); |
-} |
+// ---- Common methods |
-void WebUILoginDisplay::OnBeforeUserRemoved(const std::string& username) { |
- for (UserList::iterator it = users_.begin(); it != users_.end(); ++it) { |
- if ((*it)->email() == username) { |
- users_.erase(it); |
- break; |
- } |
- } |
-} |
+// ---- User selection screen methods |
-void WebUILoginDisplay::OnUserImageChanged(const User& user) { |
- if (webui_handler_) |
- webui_handler_->OnUserImageChanged(user); |
+void WebUILoginDisplay::OnBeforeUserRemoved(const std::string& username) { |
+ user_selection_screen_->OnBeforeUserRemoved(username); |
} |
void WebUILoginDisplay::OnUserRemoved(const std::string& username) { |
- if (webui_handler_) |
- webui_handler_->OnUserRemoved(username); |
+ user_selection_screen_->OnUserRemoved(username); |
} |
-void WebUILoginDisplay::OnFadeOut() { |
+void WebUILoginDisplay::OnUserImageChanged(const User& user) { |
+ user_selection_screen_->OnUserImageChanged(user); |
} |
-void WebUILoginDisplay::OnLoginSuccess(const std::string& username) { |
- if (webui_handler_) |
- webui_handler_->OnLoginSuccess(username); |
+void WebUILoginDisplay::ShowUserPodButton(const std::string& username, |
+ const std::string& iconURL, |
+ const base::Closure& click_callback) { |
+ user_selection_screen_->ShowUserPodButton(username, iconURL, click_callback); |
} |
-void WebUILoginDisplay::SetUIEnabled(bool is_enabled) { |
- // TODO(nkostylev): Cleanup this condition, |
- // see http://crbug.com/157885 and http://crbug.com/158255. |
- // Allow this call only before user sign in or at lock screen. |
- // If this call is made after new user signs in but login screen is still |
- // around that would trigger a sign in extension refresh. |
- if (is_enabled && |
- (!UserManager::Get()->IsUserLoggedIn() || |
- ScreenLocker::default_screen_locker())) { |
- ClearAndEnablePassword(); |
- } |
- |
- if (chromeos::LoginDisplayHost* host = |
- chromeos::LoginDisplayHostImpl::default_host()) { |
- if (chromeos::WebUILoginView* login_view = host->GetWebUILoginView()) |
- login_view->SetUIEnabled(is_enabled); |
- } |
+void WebUILoginDisplay::HideUserPodButton(const std::string& username) { |
+ user_selection_screen_->HideUserPodButton(username); |
} |
-void WebUILoginDisplay::SelectPod(int index) { |
-} |
+// User selection screen, screen lock API |
void WebUILoginDisplay::ShowBannerMessage(const std::string& message) { |
if (!webui_handler_) |
@@ -132,20 +108,6 @@ void WebUILoginDisplay::ShowBannerMessage(const std::string& message) { |
webui_handler_->ShowBannerMessage(message); |
} |
-void WebUILoginDisplay::ShowUserPodButton( |
- const std::string& username, |
- const std::string& iconURL, |
- const base::Closure& click_callback) { |
- if (!webui_handler_) |
- return; |
- webui_handler_->ShowUserPodButton(username, iconURL, click_callback); |
-} |
- |
-void WebUILoginDisplay::HideUserPodButton(const std::string& username) { |
- if (!webui_handler_) |
- return; |
- webui_handler_->HideUserPodButton(username); |
-} |
void WebUILoginDisplay::SetAuthType(const std::string& username, |
AuthType auth_type, |
@@ -163,6 +125,37 @@ LoginDisplay::AuthType WebUILoginDisplay::GetAuthType( |
return webui_handler_->GetAuthType(username); |
} |
+const UserList& WebUILoginDisplay::GetUsers() const { |
+ return user_selection_screen_->GetUsers(); |
+} |
+ |
+// ---- Gaia screen methods |
+ |
+// ---- Not yet classified methods |
+ |
+void WebUILoginDisplay::OnPreferencesChanged() { |
+ if (webui_handler_) |
+ webui_handler_->OnPreferencesChanged(); |
+} |
+ |
+void WebUILoginDisplay::SetUIEnabled(bool is_enabled) { |
+ // TODO(nkostylev): Cleanup this condition, |
+ // see http://crbug.com/157885 and http://crbug.com/158255. |
+ // Allow this call only before user sign in or at lock screen. |
+ // If this call is made after new user signs in but login screen is still |
+ // around that would trigger a sign in extension refresh. |
+ if (is_enabled && (!UserManager::Get()->IsUserLoggedIn() || |
+ ScreenLocker::default_screen_locker())) { |
+ ClearAndEnablePassword(); |
+ } |
+ |
+ if (chromeos::LoginDisplayHost* host = |
+ chromeos::LoginDisplayHostImpl::default_host()) { |
+ if (chromeos::WebUILoginView* login_view = host->GetWebUILoginView()) |
+ login_view->SetUIEnabled(is_enabled); |
+ } |
+} |
+ |
void WebUILoginDisplay::ShowError(int error_msg_id, |
int login_attempts, |
HelpAppLauncher::HelpTopic help_topic_id) { |
@@ -359,6 +352,8 @@ void WebUILoginDisplay::ShowWrongHWIDScreen() { |
void WebUILoginDisplay::SetWebUIHandler( |
LoginDisplayWebUIHandler* webui_handler) { |
webui_handler_ = webui_handler; |
+ gaia_screen_->SetHandler(webui_handler_); |
+ user_selection_screen_->SetHandler(webui_handler_); |
} |
void WebUILoginDisplay::ShowSigninScreenForCreds( |
@@ -368,10 +363,6 @@ void WebUILoginDisplay::ShowSigninScreenForCreds( |
webui_handler_->ShowSigninScreenForCreds(username, password); |
} |
-const UserList& WebUILoginDisplay::GetUsers() const { |
- return users_; |
-} |
- |
bool WebUILoginDisplay::IsShowGuest() const { |
return show_guest_; |
} |