| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 5 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 controllers[i]->is_guest() || | 108 controllers[i]->is_guest() || |
| 109 visible_display_names[display_name] > 1; | 109 visible_display_names[display_name] > 1; |
| 110 controllers[i]->EnableNameTooltip(show_tooltip); | 110 controllers[i]->EnableNameTooltip(show_tooltip); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 } // namespace | 114 } // namespace |
| 115 | 115 |
| 116 ExistingUserController* | 116 ExistingUserController* |
| 117 ExistingUserController::delete_scheduled_instance_ = NULL; | 117 ExistingUserController::delete_scheduled_instance_ = NULL; |
| 118 ExistingUserController* |
| 119 ExistingUserController::current_controller_ = NULL; |
| 118 | 120 |
| 119 // TODO(xiyuan): Wait for the cached settings update before using them. | 121 // TODO(xiyuan): Wait for the cached settings update before using them. |
| 120 ExistingUserController::ExistingUserController( | 122 ExistingUserController::ExistingUserController( |
| 121 const std::vector<UserManager::User>& users, | 123 const std::vector<UserManager::User>& users, |
| 122 const gfx::Rect& background_bounds) | 124 const gfx::Rect& background_bounds) |
| 123 : background_bounds_(background_bounds), | 125 : background_bounds_(background_bounds), |
| 124 background_window_(NULL), | 126 background_window_(NULL), |
| 125 background_view_(NULL), | 127 background_view_(NULL), |
| 126 selected_view_index_(kNotSelected), | 128 selected_view_index_(kNotSelected), |
| 127 num_login_attempts_(0), | 129 num_login_attempts_(0), |
| 128 bubble_(NULL), | 130 bubble_(NULL), |
| 129 user_settings_(new UserCrosSettingsProvider), | 131 user_settings_(new UserCrosSettingsProvider), |
| 130 method_factory_(this) { | 132 method_factory_(this) { |
| 131 if (delete_scheduled_instance_) | 133 if (delete_scheduled_instance_) |
| 132 delete_scheduled_instance_->Delete(); | 134 delete_scheduled_instance_->Delete(); |
| 135 DCHECK(current_controller_ == NULL); |
| 136 current_controller_ = this; |
| 133 | 137 |
| 134 // Caclulate the max number of users from available screen size. | 138 // Caclulate the max number of users from available screen size. |
| 135 if (UserCrosSettingsProvider::cached_show_users_on_signin()) { | 139 if (UserCrosSettingsProvider::cached_show_users_on_signin()) { |
| 136 size_t max_users = kMaxUsers; | 140 size_t max_users = kMaxUsers; |
| 137 int screen_width = background_bounds.width(); | 141 int screen_width = background_bounds.width(); |
| 138 if (screen_width > 0) { | 142 if (screen_width > 0) { |
| 139 max_users = std::max(static_cast<size_t>(2), std::min(kMaxUsers, | 143 max_users = std::max(static_cast<size_t>(2), std::min(kMaxUsers, |
| 140 static_cast<size_t>((screen_width - login::kUserImageSize) | 144 static_cast<size_t>((screen_width - login::kUserImageSize) |
| 141 / (UserController::kUnselectedSize + | 145 / (UserController::kUnselectedSize + |
| 142 UserController::kPadding)))); | 146 UserController::kPadding)))); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 240 |
| 237 ExistingUserController::~ExistingUserController() { | 241 ExistingUserController::~ExistingUserController() { |
| 238 ClearErrors(); | 242 ClearErrors(); |
| 239 | 243 |
| 240 if (background_window_) | 244 if (background_window_) |
| 241 background_window_->Close(); | 245 background_window_->Close(); |
| 242 | 246 |
| 243 WmMessageListener::instance()->RemoveObserver(this); | 247 WmMessageListener::instance()->RemoveObserver(this); |
| 244 | 248 |
| 245 STLDeleteElements(&controllers_); | 249 STLDeleteElements(&controllers_); |
| 250 DCHECK(current_controller_ != NULL); |
| 251 current_controller_ = NULL; |
| 246 } | 252 } |
| 247 | 253 |
| 248 void ExistingUserController::Delete() { | 254 void ExistingUserController::Delete() { |
| 249 delete_scheduled_instance_ = NULL; | 255 delete_scheduled_instance_ = NULL; |
| 250 delete this; | 256 delete this; |
| 251 } | 257 } |
| 252 | 258 |
| 253 void ExistingUserController::ProcessWmMessage(const WmIpc::Message& message, | 259 void ExistingUserController::ProcessWmMessage(const WmIpc::Message& message, |
| 254 GdkWindow* window) { | 260 GdkWindow* window) { |
| 255 if (message.type() != WM_IPC_MESSAGE_CHROME_CREATE_GUEST_WINDOW) | 261 if (message.type() != WM_IPC_MESSAGE_CHROME_CREATE_GUEST_WINDOW) |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 void ExistingUserController::RecoverEncryptedData( | 619 void ExistingUserController::RecoverEncryptedData( |
| 614 const std::string& old_password) { | 620 const std::string& old_password) { |
| 615 login_performer_->RecoverEncryptedData(old_password); | 621 login_performer_->RecoverEncryptedData(old_password); |
| 616 } | 622 } |
| 617 | 623 |
| 618 void ExistingUserController::ResyncEncryptedData() { | 624 void ExistingUserController::ResyncEncryptedData() { |
| 619 login_performer_->ResyncEncryptedData(); | 625 login_performer_->ResyncEncryptedData(); |
| 620 } | 626 } |
| 621 | 627 |
| 622 } // namespace chromeos | 628 } // namespace chromeos |
| OLD | NEW |