Chromium Code Reviews| Index: chrome/browser/chromeos/login/login_performer.cc |
| diff --git a/chrome/browser/chromeos/login/login_performer.cc b/chrome/browser/chromeos/login/login_performer.cc |
| index 1f10bfb7a02b7823ce2adcf9d9fcffa9402e38b8..068bb8b27413fca84845929dad80f9d72eb0a708 100644 |
| --- a/chrome/browser/chromeos/login/login_performer.cc |
| +++ b/chrome/browser/chromeos/login/login_performer.cc |
| @@ -11,12 +11,59 @@ |
| #include "chrome/browser/chromeos/boot_times_loader.h" |
| #include "chrome/browser/chromeos/login/login_utils.h" |
| #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
| +#include "chrome/browser/metrics/user_metrics.h" |
| #include "chrome/browser/profile.h" |
| #include "chrome/browser/profile_manager.h" |
| namespace chromeos { |
| namespace { |
| + |
| +// Records the login failure with the error code as user metrics. This |
| +// function is verbose, but we need to enumerate all actions as described |
| +// in user_metrics.h. Another option is to add some code in |
| +// extract_actions.py, which is no better than this. |
| +void RecordLoginFailure(const chromeos::LoginFailure& failure) { |
| + switch (failure.reason()) { |
| + case chromeos::LoginFailure::NONE: |
| + UserMetrics::RecordAction( |
|
Nikita (slow)
2010/12/02 10:45:12
I think what you need here instead is
UMA_HISTOGR
satorux1
2010/12/02 10:52:18
My understanding is that histogram is used for col
Nikita (slow)
2010/12/02 11:38:22
Having Login status error/success codes reported a
|
| + UserMetricsAction("Login_Failure_NONE")); |
| + break; |
| + case chromeos::LoginFailure::COULD_NOT_MOUNT_CRYPTOHOME: |
| + UserMetrics::RecordAction( |
| + UserMetricsAction("Login_Failure_COULD_NOT_MOUNT_CRYPTOHOME")); |
| + break; |
| + case chromeos::LoginFailure::COULD_NOT_MOUNT_TMPFS: |
| + UserMetrics::RecordAction( |
| + UserMetricsAction("Login_Failure_COULD_NOT_MOUNT_TMPFS")); |
| + break; |
| + case chromeos::LoginFailure::COULD_NOT_UNMOUNT_CRYPTOHOME: |
| + UserMetrics::RecordAction( |
| + UserMetricsAction("Login_Failure_COULD_NOT_UNMOUNT_CRYPTOHOME")); |
| + break; |
| + case chromeos::LoginFailure::DATA_REMOVAL_FAILED: |
| + UserMetrics::RecordAction( |
| + UserMetricsAction("Login_Failure_DATA_REMOVAL_FAILED")); |
| + break; |
| + case chromeos::LoginFailure::LOGIN_TIMED_OUT: |
| + UserMetrics::RecordAction( |
| + UserMetricsAction("Login_Failure_LOGIN_TIMED_OUT")); |
| + break; |
| + case chromeos::LoginFailure::UNLOCK_FAILED: |
| + UserMetrics::RecordAction( |
| + UserMetricsAction("Login_Failure_UNLOCK_FAILED")); |
| + break; |
| + case chromeos::LoginFailure::NETWORK_AUTH_FAILED: |
| + UserMetrics::RecordAction( |
| + UserMetricsAction("Login_Failure_NETWORK_AUTH_FAILED")); |
| + break; |
| + default: |
| + UserMetrics::RecordAction( |
| + UserMetricsAction("Login_Failure_UNKNOWN")); |
| + break; |
| + } |
| +} |
| + |
| } // namespace |
| LoginPerformer::LoginPerformer(Delegate* delegate) |
| @@ -28,18 +75,20 @@ LoginPerformer::LoginPerformer(Delegate* delegate) |
| // LoginPerformer, LoginStatusConsumer implementation: |
| void LoginPerformer::OnLoginFailure(const LoginFailure& failure) { |
| - last_login_failure_ = failure; |
| - if (delegate_) { |
| - captcha_.clear(); |
| - captcha_token_.clear(); |
| - if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED && |
| - failure.error().state() == GoogleServiceAuthError::CAPTCHA_REQUIRED) { |
| - captcha_token_ = failure.error().captcha().token; |
| - } |
| - delegate_->OnLoginFailure(failure); |
| - } else { |
| - // TODO(nkostylev): Provide blocking UI using ScreenLocker. |
| - } |
| + RecordLoginFailure(failure); |
| + |
| + last_login_failure_ = failure; |
| + if (delegate_) { |
| + captcha_.clear(); |
| + captcha_token_.clear(); |
| + if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED && |
| + failure.error().state() == GoogleServiceAuthError::CAPTCHA_REQUIRED) { |
| + captcha_token_ = failure.error().captcha().token; |
| + } |
| + delegate_->OnLoginFailure(failure); |
| + } else { |
| + // TODO(nkostylev): Provide blocking UI using ScreenLocker. |
| + } |
| } |
| void LoginPerformer::OnLoginSuccess( |
| @@ -47,6 +96,14 @@ void LoginPerformer::OnLoginSuccess( |
| const std::string& password, |
| const GaiaAuthConsumer::ClientLoginResult& credentials, |
| bool pending_requests) { |
| + if (pending_requests) { |
| + UserMetrics::RecordAction( |
| + UserMetricsAction("Login_Success_OfflineOnly")); |
| + } else { |
| + UserMetrics::RecordAction( |
| + UserMetricsAction("Login_Success_OfflineAndOnline")); |
| + } |
| + |
| if (delegate_) { |
| delegate_->OnLoginSuccess(username, |
| password, |
| @@ -62,6 +119,9 @@ void LoginPerformer::OnLoginSuccess( |
| } |
| void LoginPerformer::OnOffTheRecordLoginSuccess() { |
| + UserMetrics::RecordAction( |
| + UserMetricsAction("Login_OffTheRecordLoginSuccess")); |
| + |
| if (delegate_) |
| delegate_->OnOffTheRecordLoginSuccess(); |
| else |