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/login_screen.h" | 5 #include "chrome/browser/chromeos/login/login_screen.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 delegate()->GetObserver(this)->OnExit(ScreenObserver::LOGIN_CREATE_ACCOUNT); | 70 delegate()->GetObserver(this)->OnExit(ScreenObserver::LOGIN_CREATE_ACCOUNT); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void LoginScreen::ClearErrors() { | 73 void LoginScreen::ClearErrors() { |
| 74 // bubble_ will be set to NULL in InfoBubbleClosing callback. | 74 // bubble_ will be set to NULL in InfoBubbleClosing callback. |
| 75 if (bubble_) | 75 if (bubble_) |
| 76 bubble_->Close(); | 76 bubble_->Close(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void LoginScreen::OnLoginFailure(const LoginFailure& failure) { | 79 void LoginScreen::OnLoginFailure(const LoginFailure& failure) { |
| 80 UserMetrics::RecordAction(UserMetricsAction("LoginScreen_LoginFailure")); | |
|
Nikita (slow)
2010/11/29 10:59:06
I think it's better to track error codes here as w
satorux1
2010/12/02 10:41:46
Good idea, done.
| |
| 81 | |
| 80 const std::string error = failure.GetErrorString(); | 82 const std::string error = failure.GetErrorString(); |
| 81 VLOG(1) << "LoginManagerView: OnLoginFailure() " << error; | 83 VLOG(1) << "LoginManagerView: OnLoginFailure() " << error; |
| 82 NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary(); | 84 NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary(); |
| 83 | 85 |
| 84 // Check networking after trying to login in case user is | 86 // Check networking after trying to login in case user is |
| 85 // cached locally or the local admin account. | 87 // cached locally or the local admin account. |
| 86 if (!network || !CrosLibrary::Get()->EnsureLoaded()) { | 88 if (!network || !CrosLibrary::Get()->EnsureLoaded()) { |
| 87 ShowError(IDS_LOGIN_ERROR_NO_NETWORK_LIBRARY, error); | 89 ShowError(IDS_LOGIN_ERROR_NO_NETWORK_LIBRARY, error); |
| 88 } else if (!network->Connected()) { | 90 } else if (!network->Connected()) { |
| 89 ShowError(IDS_LOGIN_ERROR_OFFLINE_FAILED_NETWORK_NOT_CONNECTED, error); | 91 ShowError(IDS_LOGIN_ERROR_OFFLINE_FAILED_NETWORK_NOT_CONNECTED, error); |
| 90 } else { | 92 } else { |
| 91 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_NEW, error); | 93 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_NEW, error); |
| 92 } | 94 } |
| 93 | 95 |
| 94 view()->ClearAndEnablePassword(); | 96 view()->ClearAndEnablePassword(); |
| 95 } | 97 } |
| 96 | 98 |
| 97 void LoginScreen::OnLoginSuccess( | 99 void LoginScreen::OnLoginSuccess( |
| 98 const std::string& username, | 100 const std::string& username, |
| 99 const std::string& password, | 101 const std::string& password, |
| 100 const GaiaAuthConsumer::ClientLoginResult& credentials, | 102 const GaiaAuthConsumer::ClientLoginResult& credentials, |
| 101 bool pending_requests) { | 103 bool pending_requests) { |
| 104 UserMetrics::RecordAction(UserMetricsAction("LoginScreen_LoginSuccess")); | |
| 102 | 105 |
| 103 delegate()->GetObserver(this)->OnExit(ScreenObserver::LOGIN_SIGN_IN_SELECTED); | 106 delegate()->GetObserver(this)->OnExit(ScreenObserver::LOGIN_SIGN_IN_SELECTED); |
| 104 AppendStartUrlToCmdline(); | 107 AppendStartUrlToCmdline(); |
| 105 LoginUtils::Get()->CompleteLogin(username, password, credentials); | 108 LoginUtils::Get()->CompleteLogin(username, password, credentials); |
| 106 } | 109 } |
| 107 | 110 |
| 108 void LoginScreen::OnOffTheRecordLoginSuccess() { | 111 void LoginScreen::OnOffTheRecordLoginSuccess() { |
| 112 UserMetrics::RecordAction( | |
| 113 UserMetricsAction("LoginScreen_OffTheRecordLoginSuccess")); | |
| 114 | |
| 109 LoginUtils::Get()->CompleteOffTheRecordLogin(start_url_); | 115 LoginUtils::Get()->CompleteOffTheRecordLogin(start_url_); |
| 110 } | 116 } |
| 111 | 117 |
| 112 void LoginScreen::OnHelpLinkActivated() { | 118 void LoginScreen::OnHelpLinkActivated() { |
| 113 AddStartUrl(GetAccountRecoveryHelpUrl()); | 119 AddStartUrl(GetAccountRecoveryHelpUrl()); |
| 114 OnLoginOffTheRecord(); | 120 OnLoginOffTheRecord(); |
| 115 } | 121 } |
| 116 | 122 |
| 117 void LoginScreen::AppendStartUrlToCmdline() { | 123 void LoginScreen::AppendStartUrlToCmdline() { |
| 118 if (start_url_.is_valid()) | 124 if (start_url_.is_valid()) |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 130 view()->GetWidget(), | 136 view()->GetWidget(), |
| 131 view()->GetPasswordBounds(), | 137 view()->GetPasswordBounds(), |
| 132 BubbleBorder::LEFT_TOP, | 138 BubbleBorder::LEFT_TOP, |
| 133 ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING), | 139 ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING), |
| 134 error_text, | 140 error_text, |
| 135 l10n_util::GetString(IDS_CANT_ACCESS_ACCOUNT_BUTTON), | 141 l10n_util::GetString(IDS_CANT_ACCESS_ACCOUNT_BUTTON), |
| 136 this); | 142 this); |
| 137 } | 143 } |
| 138 | 144 |
| 139 } // namespace chromeos | 145 } // namespace chromeos |
| OLD | NEW |