Chromium Code Reviews| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 background_view_ = background_view; | 207 background_view_ = background_view; |
| 208 } | 208 } |
| 209 | 209 |
| 210 void ExistingUserController::LoginNewUser(const std::string& username, | 210 void ExistingUserController::LoginNewUser(const std::string& username, |
| 211 const std::string& password) { | 211 const std::string& password) { |
| 212 SelectNewUser(); | 212 SelectNewUser(); |
| 213 UserController* new_user = controllers_.back(); | 213 UserController* new_user = controllers_.back(); |
| 214 DCHECK(new_user->is_new_user()); | 214 DCHECK(new_user->is_new_user()); |
| 215 if (!new_user->is_new_user()) | 215 if (!new_user->is_new_user()) |
| 216 return; | 216 return; |
| 217 NewUserView* new_user_view = new_user->new_user_view(); | |
| 218 new_user_view->SetUsername(username); | |
|
whywhat
2010/12/13 07:57:35
Note: this was used to auto fill username after ac
altimofeev
2010/12/13 15:42:45
Agree.
| |
| 219 | 217 |
| 220 if (password.empty()) | 218 if (password.empty()) |
| 221 return; | 219 return; |
| 222 | 220 |
| 223 new_user_view->SetPassword(password); | 221 new_user->OnLogin(username, password); |
| 224 new_user_view->Login(); | |
| 225 } | 222 } |
| 226 | 223 |
| 227 void ExistingUserController::SelectNewUser() { | 224 void ExistingUserController::SelectNewUser() { |
| 228 SelectUser(controllers_.size() - 1); | 225 SelectUser(controllers_.size() - 1); |
| 229 } | 226 } |
| 230 | 227 |
| 231 void ExistingUserController::SetStatusAreaEnabled(bool enable) { | 228 void ExistingUserController::SetStatusAreaEnabled(bool enable) { |
| 232 if (background_view_) { | 229 if (background_view_) { |
| 233 background_view_->SetStatusAreaEnabled(enable); | 230 background_view_->SetStatusAreaEnabled(enable); |
| 234 } | 231 } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 354 background_window_ = NULL; | 351 background_window_ = NULL; |
| 355 | 352 |
| 356 controller->Init(screen_name, background_bounds_); | 353 controller->Init(screen_name, background_bounds_); |
| 357 controller->set_start_url(start_url_); | 354 controller->set_start_url(start_url_); |
| 358 controller->Show(); | 355 controller->Show(); |
| 359 | 356 |
| 360 // And schedule us for deletion. We delay for a second as the window manager | 357 // And schedule us for deletion. We delay for a second as the window manager |
| 361 // is doing an animation with our windows. | 358 // is doing an animation with our windows. |
| 362 DCHECK(!delete_scheduled_instance_); | 359 DCHECK(!delete_scheduled_instance_); |
| 363 delete_scheduled_instance_ = this; | 360 delete_scheduled_instance_ = this; |
| 361 | |
| 362 // Stop throbbers now to prevent throbbers be visible under the newly created | |
| 363 // windows. | |
| 364 for (size_t i = 0; i < controllers_.size(); ++i) { | |
| 365 controllers_[i]->StopThrobber(); | |
| 366 } | |
| 367 | |
| 364 delete_timer_.Start(base::TimeDelta::FromSeconds(1), this, | 368 delete_timer_.Start(base::TimeDelta::FromSeconds(1), this, |
| 365 &ExistingUserController::Delete); | 369 &ExistingUserController::Delete); |
| 366 } | 370 } |
| 367 | 371 |
| 368 void ExistingUserController::RemoveUser(UserController* source) { | 372 void ExistingUserController::RemoveUser(UserController* source) { |
| 369 ClearErrors(); | 373 ClearErrors(); |
| 370 | 374 |
| 371 // Owner is not allowed to be removed from the device. | 375 // Owner is not allowed to be removed from the device. |
| 372 // It must be enforced at upper levels. | 376 // It must be enforced at upper levels. |
| 373 DCHECK(user_settings_->RequestTrustedOwner(NULL)); | 377 DCHECK(user_settings_->RequestTrustedOwner(NULL)); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 462 error_text = l10n_util::GetStringF( | 466 error_text = l10n_util::GetStringF( |
| 463 error_id, l10n_util::GetString(IDS_PRODUCT_OS_NAME)); | 467 error_id, l10n_util::GetString(IDS_PRODUCT_OS_NAME)); |
| 464 } else { | 468 } else { |
| 465 error_text = l10n_util::GetString(error_id); | 469 error_text = l10n_util::GetString(error_id); |
| 466 } | 470 } |
| 467 // TODO(dpolukhin): show detailed error info. |details| string contains | 471 // TODO(dpolukhin): show detailed error info. |details| string contains |
| 468 // low level error info that is not localized and even is not user friendly. | 472 // low level error info that is not localized and even is not user friendly. |
| 469 // For now just ignore it because error_text contains all required information | 473 // For now just ignore it because error_text contains all required information |
| 470 // for end users, developers can see details string in Chrome logs. | 474 // for end users, developers can see details string in Chrome logs. |
| 471 | 475 |
| 472 gfx::Rect bounds = controllers_[selected_view_index_]->GetScreenBounds(); | 476 gfx::Rect bounds = |
| 477 controllers_[selected_view_index_]->GetMainInputScreenBounds(); | |
|
whywhat
2010/12/13 07:57:35
Maybe simply call the method GetMessageBubblePosit
altimofeev
2010/12/13 15:42:45
Actually it is used to calculate the bubble positi
| |
| 473 BubbleBorder::ArrowLocation arrow; | 478 BubbleBorder::ArrowLocation arrow; |
| 474 if (controllers_[selected_view_index_]->is_new_user()) { | 479 if (controllers_[selected_view_index_]->is_new_user()) { |
| 475 arrow = BubbleBorder::LEFT_TOP; | 480 arrow = BubbleBorder::LEFT_TOP; |
| 476 } else { | 481 } else { |
| 477 // Point info bubble arrow to cursor position (approximately). | 482 // Point info bubble arrow to cursor position (approximately). |
| 478 bounds.set_width(kCursorOffset * 2); | 483 bounds.set_width(kCursorOffset * 2); |
| 479 arrow = BubbleBorder::BOTTOM_LEFT; | 484 arrow = BubbleBorder::BOTTOM_LEFT; |
| 480 } | 485 } |
| 481 std::wstring help_link; | 486 std::wstring help_link; |
| 482 if (error_id == IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED) { | 487 if (error_id == IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED) { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 613 void ExistingUserController::RecoverEncryptedData( | 618 void ExistingUserController::RecoverEncryptedData( |
| 614 const std::string& old_password) { | 619 const std::string& old_password) { |
| 615 login_performer_->RecoverEncryptedData(old_password); | 620 login_performer_->RecoverEncryptedData(old_password); |
| 616 } | 621 } |
| 617 | 622 |
| 618 void ExistingUserController::ResyncEncryptedData() { | 623 void ExistingUserController::ResyncEncryptedData() { |
| 619 login_performer_->ResyncEncryptedData(); | 624 login_performer_->ResyncEncryptedData(); |
| 620 } | 625 } |
| 621 | 626 |
| 622 } // namespace chromeos | 627 } // namespace chromeos |
| OLD | NEW |