| 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); | |
| 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 |
| 364 delete_timer_.Start(base::TimeDelta::FromSeconds(1), this, | 362 delete_timer_.Start(base::TimeDelta::FromSeconds(1), this, |
| 365 &ExistingUserController::Delete); | 363 &ExistingUserController::Delete); |
| 366 } | 364 } |
| 367 | 365 |
| 368 void ExistingUserController::RemoveUser(UserController* source) { | 366 void ExistingUserController::RemoveUser(UserController* source) { |
| 369 ClearErrors(); | 367 ClearErrors(); |
| 370 | 368 |
| 371 // Owner is not allowed to be removed from the device. | 369 // Owner is not allowed to be removed from the device. |
| 372 // It must be enforced at upper levels. | 370 // It must be enforced at upper levels. |
| 373 DCHECK(user_settings_->RequestTrustedOwner(NULL)); | 371 DCHECK(user_settings_->RequestTrustedOwner(NULL)); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 error_text = l10n_util::GetStringF( | 460 error_text = l10n_util::GetStringF( |
| 463 error_id, l10n_util::GetString(IDS_PRODUCT_OS_NAME)); | 461 error_id, l10n_util::GetString(IDS_PRODUCT_OS_NAME)); |
| 464 } else { | 462 } else { |
| 465 error_text = l10n_util::GetString(error_id); | 463 error_text = l10n_util::GetString(error_id); |
| 466 } | 464 } |
| 467 // TODO(dpolukhin): show detailed error info. |details| string contains | 465 // TODO(dpolukhin): show detailed error info. |details| string contains |
| 468 // low level error info that is not localized and even is not user friendly. | 466 // 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 | 467 // For now just ignore it because error_text contains all required information |
| 470 // for end users, developers can see details string in Chrome logs. | 468 // for end users, developers can see details string in Chrome logs. |
| 471 | 469 |
| 472 gfx::Rect bounds = controllers_[selected_view_index_]->GetScreenBounds(); | 470 gfx::Rect bounds = |
| 471 controllers_[selected_view_index_]->GetMainInputScreenBounds(); |
| 473 BubbleBorder::ArrowLocation arrow; | 472 BubbleBorder::ArrowLocation arrow; |
| 474 if (controllers_[selected_view_index_]->is_new_user()) { | 473 if (controllers_[selected_view_index_]->is_new_user()) { |
| 475 arrow = BubbleBorder::LEFT_TOP; | 474 arrow = BubbleBorder::LEFT_TOP; |
| 476 } else { | 475 } else { |
| 477 // Point info bubble arrow to cursor position (approximately). | 476 // Point info bubble arrow to cursor position (approximately). |
| 478 bounds.set_width(kCursorOffset * 2); | 477 bounds.set_width(kCursorOffset * 2); |
| 479 arrow = BubbleBorder::BOTTOM_LEFT; | 478 arrow = BubbleBorder::BOTTOM_LEFT; |
| 480 } | 479 } |
| 481 std::wstring help_link; | 480 std::wstring help_link; |
| 482 if (error_id == IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED) { | 481 if (error_id == IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 503 // LoginPerformer instance will delete itself once online auth result is OK. | 502 // LoginPerformer instance will delete itself once online auth result is OK. |
| 504 // In case of failure it'll bring up ScreenLock and ask for | 503 // In case of failure it'll bring up ScreenLock and ask for |
| 505 // correct password/display error message. | 504 // correct password/display error message. |
| 506 // Even in case when following online,offline protocol and returning | 505 // Even in case when following online,offline protocol and returning |
| 507 // requests_pending = false, let LoginPerformer delete itself. | 506 // requests_pending = false, let LoginPerformer delete itself. |
| 508 login_performer_->set_delegate(NULL); | 507 login_performer_->set_delegate(NULL); |
| 509 LoginPerformer* performer = login_performer_.release(); | 508 LoginPerformer* performer = login_performer_.release(); |
| 510 performer = NULL; | 509 performer = NULL; |
| 511 bool known_user = UserManager::Get()->IsKnownUser(username); | 510 bool known_user = UserManager::Get()->IsKnownUser(username); |
| 512 AppendStartUrlToCmdline(); | 511 AppendStartUrlToCmdline(); |
| 512 controllers_[selected_view_index_]->StopThrobber(); |
| 513 if (selected_view_index_ + 1 == controllers_.size() && !known_user) { | 513 if (selected_view_index_ + 1 == controllers_.size() && !known_user) { |
| 514 #if defined(OFFICIAL_BUILD) | 514 #if defined(OFFICIAL_BUILD) |
| 515 CommandLine::ForCurrentProcess()->AppendSwitchPath( | 515 CommandLine::ForCurrentProcess()->AppendSwitchPath( |
| 516 switches::kLoadExtension, | 516 switches::kLoadExtension, |
| 517 FilePath(kGetStartedPath)); | 517 FilePath(kGetStartedPath)); |
| 518 CommandLine::ForCurrentProcess()->AppendArg(kGetStartedURL); | 518 CommandLine::ForCurrentProcess()->AppendArg(kGetStartedURL); |
| 519 #endif // OFFICIAL_BUILD | 519 #endif // OFFICIAL_BUILD |
| 520 if (credentials.two_factor) { | 520 if (credentials.two_factor) { |
| 521 // If we have a two factor error and and this is a new user, | 521 // If we have a two factor error and and this is a new user, |
| 522 // load the personal settings page. | 522 // load the personal settings page. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 void ExistingUserController::RecoverEncryptedData( | 619 void ExistingUserController::RecoverEncryptedData( |
| 620 const std::string& old_password) { | 620 const std::string& old_password) { |
| 621 login_performer_->RecoverEncryptedData(old_password); | 621 login_performer_->RecoverEncryptedData(old_password); |
| 622 } | 622 } |
| 623 | 623 |
| 624 void ExistingUserController::ResyncEncryptedData() { | 624 void ExistingUserController::ResyncEncryptedData() { |
| 625 login_performer_->ResyncEncryptedData(); | 625 login_performer_->ResyncEncryptedData(); |
| 626 } | 626 } |
| 627 | 627 |
| 628 } // namespace chromeos | 628 } // namespace chromeos |
| OLD | NEW |