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 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/chromeos/cros/login_library.h" | 21 #include "chrome/browser/chromeos/cros/login_library.h" |
22 #include "chrome/browser/chromeos/cros/network_library.h" | 22 #include "chrome/browser/chromeos/cros/network_library.h" |
23 #include "chrome/browser/chromeos/cros_settings_provider_user.h" | 23 #include "chrome/browser/chromeos/cros_settings_provider_user.h" |
24 #include "chrome/browser/chromeos/login/background_view.h" | 24 #include "chrome/browser/chromeos/login/background_view.h" |
25 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 25 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
26 #include "chrome/browser/chromeos/login/helper.h" | 26 #include "chrome/browser/chromeos/login/helper.h" |
27 #include "chrome/browser/chromeos/login/login_utils.h" | 27 #include "chrome/browser/chromeos/login/login_utils.h" |
28 #include "chrome/browser/chromeos/login/message_bubble.h" | 28 #include "chrome/browser/chromeos/login/message_bubble.h" |
29 #include "chrome/browser/chromeos/login/wizard_controller.h" | 29 #include "chrome/browser/chromeos/login/wizard_controller.h" |
30 #include "chrome/browser/chromeos/wm_ipc.h" | 30 #include "chrome/browser/chromeos/wm_ipc.h" |
| 31 #include "chrome/browser/views/window.h" |
31 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/common/net/gaia/google_service_auth_error.h" | 33 #include "chrome/common/net/gaia/google_service_auth_error.h" |
33 #include "gfx/native_widget_types.h" | 34 #include "gfx/native_widget_types.h" |
34 #include "grit/generated_resources.h" | 35 #include "grit/generated_resources.h" |
35 #include "grit/theme_resources.h" | 36 #include "grit/theme_resources.h" |
36 #include "views/screen.h" | 37 #include "views/screen.h" |
37 #include "views/widget/widget_gtk.h" | 38 #include "views/widget/widget_gtk.h" |
38 #include "views/window/window.h" | 39 #include "views/window/window.h" |
39 | 40 |
40 namespace chromeos { | 41 namespace chromeos { |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 ShowError(IDS_LOGIN_ERROR_NO_NETWORK_LIBRARY, error); | 386 ShowError(IDS_LOGIN_ERROR_NO_NETWORK_LIBRARY, error); |
386 } else if (!network->Connected()) { | 387 } else if (!network->Connected()) { |
387 ShowError(IDS_LOGIN_ERROR_OFFLINE_FAILED_NETWORK_NOT_CONNECTED, error); | 388 ShowError(IDS_LOGIN_ERROR_OFFLINE_FAILED_NETWORK_NOT_CONNECTED, error); |
388 } else { | 389 } else { |
389 if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED && | 390 if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED && |
390 failure.error().state() == GoogleServiceAuthError::CAPTCHA_REQUIRED) { | 391 failure.error().state() == GoogleServiceAuthError::CAPTCHA_REQUIRED) { |
391 if (!failure.error().captcha().image_url.is_empty()) { | 392 if (!failure.error().captcha().image_url.is_empty()) { |
392 CaptchaView* view = | 393 CaptchaView* view = |
393 new CaptchaView(failure.error().captcha().image_url); | 394 new CaptchaView(failure.error().captcha().image_url); |
394 view->set_delegate(this); | 395 view->set_delegate(this); |
395 views::Window* window = views::Window::CreateChromeWindow( | 396 views::Window* window = browser::CreateViewsWindow( |
396 GetNativeWindow(), gfx::Rect(), view); | 397 GetNativeWindow(), gfx::Rect(), view); |
397 window->SetIsAlwaysOnTop(true); | 398 window->SetIsAlwaysOnTop(true); |
398 window->Show(); | 399 window->Show(); |
399 } else { | 400 } else { |
400 LOG(WARNING) << "No captcha image url was found?"; | 401 LOG(WARNING) << "No captcha image url was found?"; |
401 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); | 402 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); |
402 } | 403 } |
403 } else { | 404 } else { |
404 if (controllers_[selected_view_index_]->is_new_user()) | 405 if (controllers_[selected_view_index_]->is_new_user()) |
405 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_NEW, error); | 406 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_NEW, error); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 | 501 |
501 void ExistingUserController::OnPasswordChangeDetected( | 502 void ExistingUserController::OnPasswordChangeDetected( |
502 const GaiaAuthConsumer::ClientLoginResult& credentials) { | 503 const GaiaAuthConsumer::ClientLoginResult& credentials) { |
503 // When signing in as a "New user" always remove old cryptohome. | 504 // When signing in as a "New user" always remove old cryptohome. |
504 if (selected_view_index_ == controllers_.size() - 1) { | 505 if (selected_view_index_ == controllers_.size() - 1) { |
505 login_performer_->ResyncEncryptedData(); | 506 login_performer_->ResyncEncryptedData(); |
506 return; | 507 return; |
507 } | 508 } |
508 | 509 |
509 PasswordChangedView* view = new PasswordChangedView(this); | 510 PasswordChangedView* view = new PasswordChangedView(this); |
510 views::Window* window = views::Window::CreateChromeWindow(GetNativeWindow(), | 511 views::Window* window = browser::CreateViewsWindow(GetNativeWindow(), |
511 gfx::Rect(), | 512 gfx::Rect(), |
512 view); | 513 view); |
513 window->SetIsAlwaysOnTop(true); | 514 window->SetIsAlwaysOnTop(true); |
514 window->Show(); | 515 window->Show(); |
515 } | 516 } |
516 | 517 |
517 void ExistingUserController::OnHelpLinkActivated() { | 518 void ExistingUserController::OnHelpLinkActivated() { |
518 DCHECK(login_performer_->error().state() != GoogleServiceAuthError::NONE); | 519 DCHECK(login_performer_->error().state() != GoogleServiceAuthError::NONE); |
519 if (!help_app_.get()) | 520 if (!help_app_.get()) |
520 help_app_.reset(new HelpAppLauncher(GetNativeWindow())); | 521 help_app_.reset(new HelpAppLauncher(GetNativeWindow())); |
521 switch (login_performer_->error().state()) { | 522 switch (login_performer_->error().state()) { |
522 case(GoogleServiceAuthError::CONNECTION_FAILED): | 523 case(GoogleServiceAuthError::CONNECTION_FAILED): |
(...skipping 19 matching lines...) Expand all Loading... |
542 void ExistingUserController::RecoverEncryptedData( | 543 void ExistingUserController::RecoverEncryptedData( |
543 const std::string& old_password) { | 544 const std::string& old_password) { |
544 login_performer_->RecoverEncryptedData(old_password); | 545 login_performer_->RecoverEncryptedData(old_password); |
545 } | 546 } |
546 | 547 |
547 void ExistingUserController::ResyncEncryptedData() { | 548 void ExistingUserController::ResyncEncryptedData() { |
548 login_performer_->ResyncEncryptedData(); | 549 login_performer_->ResyncEncryptedData(); |
549 } | 550 } |
550 | 551 |
551 } // namespace chromeos | 552 } // namespace chromeos |
OLD | NEW |