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_performer.h" | 5 #include "chrome/browser/chromeos/login/login_performer.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | |
7 #include "base/logging.h" | 8 #include "base/logging.h" |
8 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
9 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/browser_thread.h" | 11 #include "chrome/browser/browser_thread.h" |
11 #include "chrome/browser/chromeos/boot_times_loader.h" | 12 #include "chrome/browser/chromeos/boot_times_loader.h" |
12 #include "chrome/browser/chromeos/login/login_utils.h" | 13 #include "chrome/browser/chromeos/login/login_utils.h" |
13 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | 14 #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
15 #include "chrome/browser/metrics/user_metrics.h" | |
14 #include "chrome/browser/profile.h" | 16 #include "chrome/browser/profile.h" |
15 #include "chrome/browser/profile_manager.h" | 17 #include "chrome/browser/profile_manager.h" |
16 | 18 |
17 namespace chromeos { | 19 namespace chromeos { |
18 | 20 |
19 namespace { | 21 namespace { |
20 } // namespace | 22 } // namespace |
21 | 23 |
22 LoginPerformer::LoginPerformer(Delegate* delegate) | 24 LoginPerformer::LoginPerformer(Delegate* delegate) |
23 : last_login_failure_(LoginFailure::None()), | 25 : last_login_failure_(LoginFailure::None()), |
24 delegate_(delegate), | 26 delegate_(delegate), |
25 method_factory_(this) {} | 27 method_factory_(this) {} |
26 | 28 |
27 //////////////////////////////////////////////////////////////////////////////// | 29 //////////////////////////////////////////////////////////////////////////////// |
28 // LoginPerformer, LoginStatusConsumer implementation: | 30 // LoginPerformer, LoginStatusConsumer implementation: |
29 | 31 |
30 void LoginPerformer::OnLoginFailure(const LoginFailure& failure) { | 32 void LoginPerformer::OnLoginFailure(const LoginFailure& failure) { |
31 last_login_failure_ = failure; | 33 UserMetrics::RecordAction(UserMetricsAction("Login_Failure")); |
32 if (delegate_) { | 34 UMA_HISTOGRAM_ENUMERATION("Login.FailureReason", failure.reason(), |
33 captcha_.clear(); | 35 LoginFailure::NUM_FAILURE_REASONS); |
34 captcha_token_.clear(); | 36 |
35 if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED && | 37 last_login_failure_ = failure; |
36 failure.error().state() == GoogleServiceAuthError::CAPTCHA_REQUIRED) { | 38 if (delegate_) { |
37 captcha_token_ = failure.error().captcha().token; | 39 captcha_.clear(); |
38 } | 40 captcha_token_.clear(); |
39 delegate_->OnLoginFailure(failure); | 41 if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED && |
40 } else { | 42 failure.error().state() == GoogleServiceAuthError::CAPTCHA_REQUIRED) { |
41 // TODO(nkostylev): Provide blocking UI using ScreenLocker. | 43 captcha_token_ = failure.error().captcha().token; |
42 } | 44 } |
45 delegate_->OnLoginFailure(failure); | |
46 } else { | |
47 // TODO(nkostylev): Provide blocking UI using ScreenLocker. | |
48 } | |
43 } | 49 } |
44 | 50 |
45 void LoginPerformer::OnLoginSuccess( | 51 void LoginPerformer::OnLoginSuccess( |
46 const std::string& username, | 52 const std::string& username, |
47 const std::string& password, | 53 const std::string& password, |
48 const GaiaAuthConsumer::ClientLoginResult& credentials, | 54 const GaiaAuthConsumer::ClientLoginResult& credentials, |
49 bool pending_requests) { | 55 bool pending_requests) { |
56 UserMetrics::RecordAction(UserMetricsAction("Login_Success")); | |
57 // 0 - Login success offline and online. It's a new user. or it's an | |
58 // existing user and offline auth took longer than online auth. | |
59 // 1 - Login success offline only. It's an existing user login. | |
60 UMA_HISTOGRAM_ENUMERATION("Login.SuccessReason", pending_requests, 2); | |
Nikita (slow)
2010/12/13 11:55:31
I though about this histogram again and there's th
Chris Masone
2010/12/13 15:55:12
If we can't do an online check, we'll see the latt
Nikita (slow)
2010/12/13 16:12:43
Yes, as what we basically want is on each successf
satorux1
2010/12/17 05:58:09
So you'll be adding code in ParallelAuthenticator
Nikita (slow)
2010/12/17 10:30:45
Chris, will you move this histogram to ParallelAut
| |
61 | |
50 if (delegate_) { | 62 if (delegate_) { |
51 delegate_->OnLoginSuccess(username, | 63 delegate_->OnLoginSuccess(username, |
52 password, | 64 password, |
53 credentials, | 65 credentials, |
54 pending_requests); | 66 pending_requests); |
55 if (!pending_requests) | 67 if (!pending_requests) |
56 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 68 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
57 } else { | 69 } else { |
58 DCHECK(!pending_requests); | 70 DCHECK(!pending_requests); |
59 // Online login has succeeded. Delete our instance. | 71 // Online login has succeeded. Delete our instance. |
60 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 72 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
61 } | 73 } |
62 } | 74 } |
63 | 75 |
64 void LoginPerformer::OnOffTheRecordLoginSuccess() { | 76 void LoginPerformer::OnOffTheRecordLoginSuccess() { |
77 UserMetrics::RecordAction( | |
78 UserMetricsAction("Login_GuestLoginSuccess")); | |
79 | |
65 if (delegate_) | 80 if (delegate_) |
66 delegate_->OnOffTheRecordLoginSuccess(); | 81 delegate_->OnOffTheRecordLoginSuccess(); |
67 else | 82 else |
68 NOTREACHED(); | 83 NOTREACHED(); |
69 } | 84 } |
70 | 85 |
71 void LoginPerformer::OnPasswordChangeDetected( | 86 void LoginPerformer::OnPasswordChangeDetected( |
72 const GaiaAuthConsumer::ClientLoginResult& credentials) { | 87 const GaiaAuthConsumer::ClientLoginResult& credentials) { |
73 cached_credentials_ = credentials; | 88 cached_credentials_ = credentials; |
74 if (delegate_) { | 89 if (delegate_) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 &Authenticator::AuthenticateToLogin, | 178 &Authenticator::AuthenticateToLogin, |
164 profile, | 179 profile, |
165 username_, | 180 username_, |
166 password_, | 181 password_, |
167 captcha_token_, | 182 captcha_token_, |
168 captcha_)); | 183 captcha_)); |
169 password_.clear(); | 184 password_.clear(); |
170 } | 185 } |
171 | 186 |
172 } // namespace chromeos | 187 } // namespace chromeos |
OLD | NEW |