| Index: chrome/browser/chromeos/login/online_attempt.cc
|
| diff --git a/chrome/browser/chromeos/login/online_attempt.cc b/chrome/browser/chromeos/login/online_attempt.cc
|
| index 221c883dab3b6deac3666e06d569c241ff00166a..e9320d04234060125f29bbfe3b81e077e5621dfb 100644
|
| --- a/chrome/browser/chromeos/login/online_attempt.cc
|
| +++ b/chrome/browser/chromeos/login/online_attempt.cc
|
| @@ -14,8 +14,11 @@
|
| #include "chrome/browser/chromeos/login/auth_attempt_state.h"
|
| #include "chrome/browser/chromeos/login/auth_attempt_state_resolver.h"
|
| #include "chrome/browser/chromeos/login/user.h"
|
| +#include "chrome/browser/chromeos/login/user_manager.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/profiles/profile_manager.h"
|
| +#include "chrome/browser/signin/about_signin_internals.h"
|
| +#include "chrome/browser/signin/about_signin_internals_factory.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "google_apis/gaia/gaia_auth_consumer.h"
|
| #include "google_apis/gaia/gaia_auth_fetcher.h"
|
| @@ -26,6 +29,7 @@
|
| #include "third_party/libjingle/source/talk/base/urlencode.h"
|
|
|
| using content::BrowserThread;
|
| +using namespace signin_internals_util;
|
|
|
| namespace {
|
|
|
| @@ -34,6 +38,13 @@ namespace {
|
| const char kServiceScopeChromeOS[] =
|
| "https://www.googleapis.com/auth/chromesync";
|
|
|
| +#define FOR_DIAGNOSTICS_OBSERVERS(func) \
|
| + do { \
|
| + FOR_EACH_OBSERVER(SigninDiagnosticsObserver, \
|
| + signin_diagnostics_observers_, \
|
| + func); \
|
| + } while (0) \
|
| +
|
| }
|
|
|
| namespace chromeos {
|
| @@ -79,7 +90,7 @@ void OnlineAttempt::Initiate(Profile* auth_profile) {
|
| }
|
|
|
| void OnlineAttempt::OnClientLoginSuccess(
|
| - const GaiaAuthConsumer::ClientLoginResult& unused) {
|
| + const GaiaAuthConsumer::ClientLoginResult& result) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| VLOG(1) << "Online login successful!";
|
|
|
| @@ -98,6 +109,17 @@ void OnlineAttempt::OnClientLoginSuccess(
|
| TryClientLogin();
|
| return;
|
| }
|
| +
|
| + // Inform all signin diagnostics observers about the login.
|
| + FOR_DIAGNOSTICS_OBSERVERS(NotifySigninValueChanged(
|
| + USERNAME, UserManager::Get()->GetLoggedInUser()->email()));
|
| + FOR_DIAGNOSTICS_OBSERVERS(NotifySigninValueChanged(
|
| + SIGNIN_TYPE, "Client Login"));
|
| + FOR_DIAGNOSTICS_OBSERVERS(NotifySigninValueChanged(
|
| + LSID, result.lsid));
|
| + FOR_DIAGNOSTICS_OBSERVERS(NotifySigninValueChanged(
|
| + SID, result.sid));
|
| +
|
| TriggerResolve(LoginFailure::None());
|
| }
|
|
|
| @@ -112,9 +134,18 @@ void OnlineAttempt::OnClientLoginFailure(
|
| try_again_ = false;
|
| // TODO(cmasone): add UMA tracking for this to see if we can remove it.
|
| LOG(ERROR) << "Login attempt canceled!?!? Trying again.";
|
| +
|
| + // Inform all signin diagnostics observers about the retry
|
| + FOR_DIAGNOSTICS_OBSERVERS(NotifySigninValueChanged(
|
| + CLIENT_LOGIN_STATUS, "Login Canceled. Retrying."));
|
| +
|
| TryClientLogin();
|
| return;
|
| }
|
| + // Inform all signin diagnostics observers about the cancellation.
|
| + FOR_DIAGNOSTICS_OBSERVERS(NotifySigninValueChanged(
|
| + CLIENT_LOGIN_STATUS, "Login Canceled (after retry)"));
|
| +
|
| LOG(ERROR) << "Login attempt canceled again? Already retried...";
|
| }
|
|
|
| @@ -125,6 +156,11 @@ void OnlineAttempt::OnClientLoginFailure(
|
| // and succeeded. That we've failed with INVALID_GAIA_CREDENTIALS now
|
| // indicates that the account is HOSTED.
|
| LOG(WARNING) << "Rejecting valid HOSTED account.";
|
| +
|
| + // Inform all signin diagnostics observers about the login.
|
| + FOR_DIAGNOSTICS_OBSERVERS(NotifySigninValueChanged(
|
| + CLIENT_LOGIN_STATUS, "Rejecting valid HOSTED account"));
|
| +
|
| TriggerResolve(LoginFailure::FromNetworkAuthFailure(
|
| GoogleServiceAuthError(
|
| GoogleServiceAuthError::HOSTED_NOT_ALLOWED)));
|
| @@ -133,10 +169,23 @@ void OnlineAttempt::OnClientLoginFailure(
|
|
|
| if (error.state() == GoogleServiceAuthError::TWO_FACTOR) {
|
| LOG(WARNING) << "Two factor authenticated. Sync will not work.";
|
| - TriggerResolve(LoginFailure::None());
|
|
|
| + // Inform all signin diagnostics observers about the login.
|
| + // TODO(vishwath): Is this really a successful login?
|
| + FOR_DIAGNOSTICS_OBSERVERS(NotifySigninValueChanged(
|
| + SIGNIN_TYPE, "Client Login (with two factor authentication)"));
|
| + FOR_DIAGNOSTICS_OBSERVERS(NotifySigninValueChanged(
|
| + CLIENT_LOGIN_STATUS, "Successful"));
|
| +
|
| +
|
| + TriggerResolve(LoginFailure::None());
|
| return;
|
| }
|
| +
|
| +
|
| + FOR_DIAGNOSTICS_OBSERVERS(NotifySigninValueChanged(
|
| + SIGNIN_TYPE, "Client Login"));
|
| +
|
| VLOG(2) << "ClientLogin attempt failed with " << error.state();
|
| TriggerResolve(LoginFailure::FromNetworkAuthFailure(error));
|
| }
|
|
|