| Index: chrome/browser/chromeos/login/oauth1_login_verifier.cc
|
| diff --git a/chrome/browser/chromeos/login/oauth_login_verifier.cc b/chrome/browser/chromeos/login/oauth1_login_verifier.cc
|
| similarity index 76%
|
| rename from chrome/browser/chromeos/login/oauth_login_verifier.cc
|
| rename to chrome/browser/chromeos/login/oauth1_login_verifier.cc
|
| index cea2028f6ea7cd0fb5fe626789120fda98efd4dd..dbb58e4becc5a9ef16f9e895d667a216b18c71f3 100644
|
| --- a/chrome/browser/chromeos/login/oauth_login_verifier.cc
|
| +++ b/chrome/browser/chromeos/login/oauth1_login_verifier.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/browser/chromeos/login/oauth_login_verifier.h"
|
| +#include "chrome/browser/chromeos/login/oauth1_login_verifier.h"
|
|
|
| #include "base/logging.h"
|
| #include "base/metrics/histogram.h"
|
| @@ -32,11 +32,12 @@ const char kServiceScopeChromeOS[] =
|
|
|
| } // namespace
|
|
|
| -OAuthLoginVerifier::OAuthLoginVerifier(OAuthLoginVerifier::Delegate* delegate,
|
| - Profile* user_profile,
|
| - const std::string& oauth1_token,
|
| - const std::string& oauth1_secret,
|
| - const std::string& username)
|
| +OAuth1LoginVerifier::OAuth1LoginVerifier(
|
| + OAuth1LoginVerifier::Delegate* delegate,
|
| + Profile* user_profile,
|
| + const std::string& oauth1_token,
|
| + const std::string& oauth1_secret,
|
| + const std::string& username)
|
| : delegate_(delegate),
|
| oauth_fetcher_(this,
|
| g_browser_process->system_request_context(),
|
| @@ -52,10 +53,10 @@ OAuthLoginVerifier::OAuthLoginVerifier(OAuthLoginVerifier::Delegate* delegate,
|
| step_(VERIFICATION_STEP_UNVERIFIED) {
|
| }
|
|
|
| -OAuthLoginVerifier::~OAuthLoginVerifier() {
|
| +OAuth1LoginVerifier::~OAuth1LoginVerifier() {
|
| }
|
|
|
| -void OAuthLoginVerifier::StartOAuthVerification() {
|
| +void OAuth1LoginVerifier::StartOAuthVerification() {
|
| if (oauth1_token_.empty() || oauth1_secret_.empty()) {
|
| // Empty OAuth1 access token or secret probably means that we are
|
| // dealing with a legacy ChromeOS account. This should be treated as
|
| @@ -64,13 +65,13 @@ void OAuthLoginVerifier::StartOAuthVerification() {
|
| GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS));
|
| } else {
|
| oauth_fetcher_.StartOAuthLogin(GaiaConstants::kChromeOSSource,
|
| - GaiaConstants::kPicasaService,
|
| + GaiaConstants::kSyncService,
|
| oauth1_token_,
|
| oauth1_secret_);
|
| }
|
| }
|
|
|
| -void OAuthLoginVerifier::ContinueVerification() {
|
| +void OAuth1LoginVerifier::ContinueVerification() {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| // Check if we have finished with this one already.
|
| if (is_done())
|
| @@ -91,7 +92,7 @@ void OAuthLoginVerifier::ContinueVerification() {
|
| if (!network || !network->connected() || network->restricted_pool()) {
|
| BrowserThread::PostDelayedTask(
|
| BrowserThread::UI, FROM_HERE,
|
| - base::Bind(&OAuthLoginVerifier::ContinueVerification, AsWeakPtr()),
|
| + base::Bind(&OAuth1LoginVerifier::ContinueVerification, AsWeakPtr()),
|
| base::TimeDelta::FromMilliseconds(kOAuthVerificationRestartDelay));
|
| return;
|
| }
|
| @@ -107,20 +108,20 @@ void OAuthLoginVerifier::ContinueVerification() {
|
| }
|
| }
|
|
|
| -void OAuthLoginVerifier::StartCookiesRetrieval() {
|
| +void OAuth1LoginVerifier::StartCookiesRetrieval() {
|
| DCHECK(!sid_.empty());
|
| DCHECK(!lsid_.empty());
|
| gaia_fetcher_.StartIssueAuthToken(sid_, lsid_, GaiaConstants::kGaiaService);
|
| }
|
|
|
| -bool OAuthLoginVerifier::RetryOnError(const GoogleServiceAuthError& error) {
|
| +bool OAuth1LoginVerifier::RetryOnError(const GoogleServiceAuthError& error) {
|
| if (error.state() == GoogleServiceAuthError::CONNECTION_FAILED ||
|
| error.state() == GoogleServiceAuthError::SERVICE_UNAVAILABLE ||
|
| error.state() == GoogleServiceAuthError::REQUEST_CANCELED) {
|
| if (verification_count_ < kMaxOAuthTokenVerificationAttemptCount) {
|
| BrowserThread::PostDelayedTask(
|
| BrowserThread::UI, FROM_HERE,
|
| - base::Bind(&OAuthLoginVerifier::ContinueVerification, AsWeakPtr()),
|
| + base::Bind(&OAuth1LoginVerifier::ContinueVerification, AsWeakPtr()),
|
| base::TimeDelta::FromMilliseconds(kOAuthVerificationRestartDelay));
|
| return true;
|
| }
|
| @@ -129,7 +130,7 @@ bool OAuthLoginVerifier::RetryOnError(const GoogleServiceAuthError& error) {
|
| return false;
|
| }
|
|
|
| -void OAuthLoginVerifier::OnOAuthLoginSuccess(const std::string& sid,
|
| +void OAuth1LoginVerifier::OnOAuthLoginSuccess(const std::string& sid,
|
| const std::string& lsid,
|
| const std::string& auth) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| @@ -137,21 +138,21 @@ void OAuthLoginVerifier::OnOAuthLoginSuccess(const std::string& sid,
|
| verification_count_ = 0;
|
| sid_ = sid;
|
| lsid_ = lsid;
|
| - delegate_->OnOAuthVerificationSucceeded(username_, sid, lsid, auth);
|
| + delegate_->OnOAuth1VerificationSucceeded(username_, sid, lsid, auth);
|
| StartCookiesRetrieval();
|
| }
|
|
|
| -void OAuthLoginVerifier::OnOAuthLoginFailure(
|
| +void OAuth1LoginVerifier::OnOAuthLoginFailure(
|
| const GoogleServiceAuthError& error) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| LOG(WARNING) << "Failed to verify OAuth1 access tokens,"
|
| - << " error.state=" << error.state();
|
| + << " error: " << error.state();
|
|
|
| if (!RetryOnError(error)) {
|
| UMA_HISTOGRAM_ENUMERATION("LoginVerifier.LoginFailureWithNoRetry",
|
| error.state(),
|
| GoogleServiceAuthError::NUM_STATES);
|
| - delegate_->OnOAuthVerificationFailed(username_);
|
| + delegate_->OnOAuth1VerificationFailed(username_);
|
| } else {
|
| UMA_HISTOGRAM_ENUMERATION("LoginVerifier.LoginFailureWithRetry",
|
| error.state(),
|
| @@ -159,7 +160,7 @@ void OAuthLoginVerifier::OnOAuthLoginFailure(
|
| }
|
| }
|
|
|
| -void OAuthLoginVerifier::OnCookieFetchFailed(
|
| +void OAuth1LoginVerifier::OnCookieFetchFailed(
|
| const GoogleServiceAuthError& error) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
|
|
| @@ -167,7 +168,7 @@ void OAuthLoginVerifier::OnCookieFetchFailed(
|
| UMA_HISTOGRAM_ENUMERATION("LoginVerifier.CookieFetchFailureWithNoRetry",
|
| error.state(),
|
| GoogleServiceAuthError::NUM_STATES);
|
| - delegate_->OnUserCookiesFetchFailed(username_);
|
| + delegate_->OnCookiesFetchWithOAuth1Failed(username_);
|
| } else {
|
| UMA_HISTOGRAM_ENUMERATION("LoginVerifier.CookieFetchFailureWithRetry",
|
| error.state(),
|
| @@ -175,31 +176,31 @@ void OAuthLoginVerifier::OnCookieFetchFailed(
|
| }
|
| }
|
|
|
| -void OAuthLoginVerifier::OnIssueAuthTokenSuccess(
|
| +void OAuth1LoginVerifier::OnIssueAuthTokenSuccess(
|
| const std::string& service,
|
| const std::string& auth_token) {
|
| gaia_fetcher_.StartMergeSession(auth_token);
|
| }
|
|
|
| -void OAuthLoginVerifier::OnIssueAuthTokenFailure(
|
| +void OAuth1LoginVerifier::OnIssueAuthTokenFailure(
|
| const std::string& service,
|
| const GoogleServiceAuthError& error) {
|
| - DVLOG(1) << "Failed IssueAuthToken request,"
|
| - << " error.state=" << error.state();
|
| + LOG(WARNING) << "Failed IssueAuthToken request,"
|
| + << " error: " << error.state();
|
| OnCookieFetchFailed(error);
|
| }
|
|
|
| -void OAuthLoginVerifier::OnMergeSessionSuccess(const std::string& data) {
|
| +void OAuth1LoginVerifier::OnMergeSessionSuccess(const std::string& data) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| - DVLOG(1) << "MergeSession successful.";
|
| + LOG(WARNING) << "MergeSession successful.";
|
| step_ = VERIFICATION_STEP_COOKIES_FETCHED;
|
| - delegate_->OnUserCookiesFetchSucceeded(username_);
|
| + delegate_->OnCookiesFetchWithOAuth1Succeeded(username_);
|
| }
|
|
|
| -void OAuthLoginVerifier::OnMergeSessionFailure(
|
| +void OAuth1LoginVerifier::OnMergeSessionFailure(
|
| const GoogleServiceAuthError& error) {
|
| - DVLOG(1) << "Failed MergeSession request,"
|
| - << " error.state=" << error.state();
|
| + LOG(WARNING) << "Failed MergeSession request,"
|
| + << " error: " << error.state();
|
| OnCookieFetchFailed(error);
|
| }
|
|
|
|
|