summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-22 03:43:30 +0000
committerrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-22 03:43:30 +0000
commit4a68a433b3b92e4abcd743e3aae1ea7d9426f16c (patch)
tree140f8b8ccdfcb6868c72439dd3edd9120bc3bc7d /chrome/browser
parent864e1962e117c4badcd1bc2251d367f2a6be2abf (diff)
downloadchromium_src-4a68a433b3b92e4abcd743e3aae1ea7d9426f16c.zip
chromium_src-4a68a433b3b92e4abcd743e3aae1ea7d9426f16c.tar.gz
chromium_src-4a68a433b3b92e4abcd743e3aae1ea7d9426f16c.tar.bz2
Cleanup ParallelAuthenticator.
Picked up Zel's CL (http://codereview.chromium.org/9310034/) and fixed the unittest that was failing. patch from issue 9310034 R=zelidrag@chromium.org,xiyuan@chromium.org,nkostylev@chromium.org BUG=None TEST=All unit tests are passing and we can still login. Review URL: http://codereview.chromium.org/9425013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122962 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/automation/automation_provider_observers.h2
-rw-r--r--chrome/browser/automation/automation_provider_observers_chromeos.cc3
-rw-r--r--chrome/browser/chromeos/chrome_browser_main_chromeos.cc2
-rw-r--r--chrome/browser/chromeos/login/auth_attempt_state.cc9
-rw-r--r--chrome/browser/chromeos/login/auth_attempt_state.h7
-rw-r--r--chrome/browser/chromeos/login/authenticator.h16
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller.cc22
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller.h7
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller_browsertest.cc1
-rw-r--r--chrome/browser/chromeos/login/login_performer.cc20
-rw-r--r--chrome/browser/chromeos/login/login_performer.h9
-rw-r--r--chrome/browser/chromeos/login/login_status_consumer.cc5
-rw-r--r--chrome/browser/chromeos/login/login_status_consumer.h11
-rw-r--r--chrome/browser/chromeos/login/login_utils.cc15
-rw-r--r--chrome/browser/chromeos/login/login_utils.h1
-rw-r--r--chrome/browser/chromeos/login/login_utils_browsertest.cc4
-rw-r--r--chrome/browser/chromeos/login/mock_authenticator.cc8
-rw-r--r--chrome/browser/chromeos/login/mock_authenticator.h8
-rw-r--r--chrome/browser/chromeos/login/mock_login_status_consumer.cc10
-rw-r--r--chrome/browser/chromeos/login/mock_login_status_consumer.h16
-rw-r--r--chrome/browser/chromeos/login/online_attempt.cc21
-rw-r--r--chrome/browser/chromeos/login/online_attempt.h5
-rw-r--r--chrome/browser/chromeos/login/online_attempt_unittest.cc8
-rw-r--r--chrome/browser/chromeos/login/parallel_authenticator.cc28
-rw-r--r--chrome/browser/chromeos/login/parallel_authenticator.h15
-rw-r--r--chrome/browser/chromeos/login/parallel_authenticator_unittest.cc77
-rw-r--r--chrome/browser/chromeos/login/screen_locker.cc4
-rw-r--r--chrome/browser/chromeos/login/screen_locker.h1
-rw-r--r--chrome/browser/chromeos/login/screen_locker_tester.cc1
-rw-r--r--chrome/browser/chromeos/login/test_attempt_state.cc6
-rw-r--r--chrome/browser/chromeos/login/test_attempt_state.h4
-rw-r--r--chrome/browser/chromeos/login/wizard_controller_browsertest.cc2
32 files changed, 107 insertions, 241 deletions
diff --git a/chrome/browser/automation/automation_provider_observers.h b/chrome/browser/automation/automation_provider_observers.h
index 8dcff95..80c7d19 100644
--- a/chrome/browser/automation/automation_provider_observers.h
+++ b/chrome/browser/automation/automation_provider_observers.h
@@ -773,7 +773,6 @@ class LoginObserver : public chromeos::LoginStatusConsumer {
virtual void OnLoginSuccess(
const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests,
bool using_oauth);
@@ -826,7 +825,6 @@ class ScreenUnlockObserver : public ScreenLockUnlockObserver,
virtual void OnLoginSuccess(
const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests,
bool using_oauth) {}
diff --git a/chrome/browser/automation/automation_provider_observers_chromeos.cc b/chrome/browser/automation/automation_provider_observers_chromeos.cc
index 5475569..3b83e77 100644
--- a/chrome/browser/automation/automation_provider_observers_chromeos.cc
+++ b/chrome/browser/automation/automation_provider_observers_chromeos.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -92,7 +92,6 @@ void LoginObserver::OnLoginFailure(const chromeos::LoginFailure& error) {
void LoginObserver::OnLoginSuccess(
const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests,
bool using_oauth) {
controller_->set_login_status_consumer(NULL);
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
index d1cf8b2..a82b8af 100644
--- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
+++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -146,7 +146,6 @@ class StubLogin : public chromeos::LoginStatusConsumer,
void OnLoginSuccess(const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests,
bool using_oauth) {
pending_requests_ = pending_requests;
@@ -155,7 +154,6 @@ class StubLogin : public chromeos::LoginStatusConsumer,
chromeos::LoginUtils::Get()->PrepareProfile(username,
std::string(),
password,
- credentials,
pending_requests,
using_oauth,
false,
diff --git a/chrome/browser/chromeos/login/auth_attempt_state.cc b/chrome/browser/chromeos/login/auth_attempt_state.cc
index bcb6288..873aca1 100644
--- a/chrome/browser/chromeos/login/auth_attempt_state.cc
+++ b/chrome/browser/chromeos/login/auth_attempt_state.cc
@@ -43,7 +43,6 @@ AuthAttemptState::AuthAttemptState(const std::string& username,
unlock(true),
online_complete_(true),
online_outcome_(LoginFailure::UNLOCK_FAILED),
- credentials_(GaiaAuthConsumer::ClientLoginResult()),
hosted_policy_(GaiaAuthFetcher::HostedAccountsAllowed),
is_first_time_user_(false),
cryptohome_complete_(false),
@@ -61,7 +60,6 @@ AuthAttemptState::AuthAttemptState(const std::string& username,
unlock(true),
online_complete_(false),
online_outcome_(LoginFailure::NONE),
- credentials_(GaiaAuthConsumer::ClientLoginResult()),
hosted_policy_(GaiaAuthFetcher::HostedAccountsAllowed),
is_first_time_user_(user_is_new),
cryptohome_complete_(false),
@@ -72,12 +70,10 @@ AuthAttemptState::AuthAttemptState(const std::string& username,
AuthAttemptState::~AuthAttemptState() {}
void AuthAttemptState::RecordOnlineLoginStatus(
- const GaiaAuthConsumer::ClientLoginResult& credentials,
const LoginFailure& outcome) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
online_complete_ = true;
online_outcome_ = outcome;
- credentials_ = credentials;
// We're either going to not try again, or try again with HOSTED
// accounts not allowed, so just set this here.
DisableHosted();
@@ -113,11 +109,6 @@ const LoginFailure& AuthAttemptState::online_outcome() {
return online_outcome_;
}
-const GaiaAuthConsumer::ClientLoginResult& AuthAttemptState::credentials() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- return credentials_;
-}
-
bool AuthAttemptState::is_first_time_user() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
return is_first_time_user_;
diff --git a/chrome/browser/chromeos/login/auth_attempt_state.h b/chrome/browser/chromeos/login/auth_attempt_state.h
index e8741b8..ae17802 100644
--- a/chrome/browser/chromeos/login/auth_attempt_state.h
+++ b/chrome/browser/chromeos/login/auth_attempt_state.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -38,11 +38,10 @@ class AuthAttemptState {
virtual ~AuthAttemptState();
- // Copy |credentials| and |outcome| into this object, so we can have
+ // Copy |credentials| and copy |outcome| into this object, so we can have
// a copy we're sure to own, and can make available on the IO thread.
// Must be called from the IO thread.
void RecordOnlineLoginStatus(
- const GaiaAuthConsumer::ClientLoginResult& credentials,
const LoginFailure& outcome);
// The next attempt will not allow HOSTED accounts to log in.
@@ -59,7 +58,6 @@ class AuthAttemptState {
virtual bool online_complete();
virtual const LoginFailure& online_outcome();
- virtual const GaiaAuthConsumer::ClientLoginResult& credentials();
virtual bool is_first_time_user();
virtual GaiaAuthFetcher::HostedAccountsSetting hosted_policy();
@@ -91,7 +89,6 @@ class AuthAttemptState {
// Status of our online login attempt.
bool online_complete_;
LoginFailure online_outcome_;
- GaiaAuthConsumer::ClientLoginResult credentials_;
// Whether or not we're accepting HOSTED accounts during the current
// online auth attempt.
diff --git a/chrome/browser/chromeos/login/authenticator.h b/chrome/browser/chromeos/login/authenticator.h
index 0128149..ed43560 100644
--- a/chrome/browser/chromeos/login/authenticator.h
+++ b/chrome/browser/chromeos/login/authenticator.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -54,12 +54,10 @@ class Authenticator : public base::RefCountedThreadSafe<Authenticator> {
// Initiates incognito ("browse without signing in") login.
virtual void LoginOffTheRecord() = 0;
- // |credentials| are the tokens that we get back from the ClientLogin API.
// |request_pending| is true if we still plan to call consumer_ with the
// results of more requests.
// Must be called on the UI thread.
virtual void OnLoginSuccess(
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool request_pending) = 0;
// Must be called on the UI thread.
@@ -71,17 +69,13 @@ class Authenticator : public base::RefCountedThreadSafe<Authenticator> {
// occurred.
// Call this method to migrate the user's encrypted data
// forward to use his new password. |old_password| is the password
- // his data was last encrypted with, |result| is the blob of auth
- // data passed back through OnPasswordChangeDetected().
+ // his data was last encrypted with.
virtual void RecoverEncryptedData(
- const std::string& old_password,
- const GaiaAuthConsumer::ClientLoginResult& credentials) = 0;
+ const std::string& old_password) = 0;
// Call this method to erase the user's encrypted data
- // and create a new cryptohome. |result| is the blob of auth
- // data passed back through OnPasswordChangeDetected().
- virtual void ResyncEncryptedData(
- const GaiaAuthConsumer::ClientLoginResult& credentials) = 0;
+ // and create a new cryptohome.
+ virtual void ResyncEncryptedData() = 0;
// Attempt to authenticate online again.
virtual void RetryAuth(Profile* profile,
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc
index 4edfa2e..f8a880e 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -317,7 +317,6 @@ void ExistingUserController::CompleteLoginInternal(std::string username,
std::string password) {
resume_login_callback_.Reset();
- GaiaAuthConsumer::ClientLoginResult credentials;
if (!login_performer_.get()) {
LoginPerformer::Delegate* delegate = this;
if (login_performer_delegate_.get())
@@ -518,7 +517,6 @@ void ExistingUserController::OnLoginFailure(const LoginFailure& failure) {
void ExistingUserController::OnLoginSuccess(
const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests,
bool using_oauth) {
is_login_in_progress_ = false;
@@ -529,8 +527,6 @@ void ExistingUserController::OnLoginSuccess(
switches::kLoginScreen) == WizardController::kLoginScreenName;
ready_for_browser_launch_ = known_user || login_only;
- two_factor_credentials_ = credentials.two_factor;
-
bool has_cookies =
login_performer_->auth_mode() == LoginPerformer::AUTH_MODE_EXTENSION;
@@ -546,7 +542,6 @@ void ExistingUserController::OnLoginSuccess(
LoginUtils::Get()->PrepareProfile(username,
display_email_,
password,
- credentials,
pending_requests,
using_oauth,
has_cookies,
@@ -583,8 +578,7 @@ void ExistingUserController::OnProfilePrepared(Profile* profile) {
// Inform |login_status_consumer_| about successful login after
// browser launch. Set most params to empty since they're not needed.
if (login_status_consumer_)
- login_status_consumer_->OnLoginSuccess(
- "", "", GaiaAuthConsumer::ClientLoginResult(), false, false);
+ login_status_consumer_->OnLoginSuccess("", "", false, false);
host_ = NULL;
}
login_display_->OnFadeOut();
@@ -609,13 +603,12 @@ void ExistingUserController::OnOffTheRecordLoginSuccess() {
login_status_consumer_->OnOffTheRecordLoginSuccess();
}
-void ExistingUserController::OnPasswordChangeDetected(
- const GaiaAuthConsumer::ClientLoginResult& credentials) {
+void ExistingUserController::OnPasswordChangeDetected() {
// Must not proceed without signature verification.
bool trusted_setting_available = cros_settings_->GetTrusted(
kDeviceOwner,
base::Bind(&ExistingUserController::OnPasswordChangeDetected,
- weak_factory_.GetWeakPtr(), credentials));
+ weak_factory_.GetWeakPtr()));
if (!trusted_setting_available) {
// Value of owner email is still not verified.
@@ -636,7 +629,7 @@ void ExistingUserController::OnPasswordChangeDetected(
window->Show();
if (login_status_consumer_)
- login_status_consumer_->OnPasswordChangeDetected(credentials);
+ login_status_consumer_->OnPasswordChangeDetected();
display_email_.clear();
}
@@ -740,13 +733,6 @@ void ExistingUserController::InitializeStartUrls() const {
customization->ApplyCustomization();
}
- if (two_factor_credentials_) {
- // If we have a two factor error and and this is a new user,
- // load the personal settings page.
- // TODO(stevenjb): direct the user to a lightweight sync login page.
- start_urls.push_back(kSettingsSyncLoginURL);
- }
-
for (size_t i = 0; i < start_urls.size(); ++i)
CommandLine::ForCurrentProcess()->AppendArg(start_urls[i]);
}
diff --git a/chrome/browser/chromeos/login/existing_user_controller.h b/chrome/browser/chromeos/login/existing_user_controller.h
index 21a035d..c27f55f 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.h
+++ b/chrome/browser/chromeos/login/existing_user_controller.h
@@ -113,12 +113,10 @@ class ExistingUserController : public LoginDisplay::Delegate,
virtual void OnLoginSuccess(
const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests,
bool using_oauth) OVERRIDE;
virtual void OnOffTheRecordLoginSuccess() OVERRIDE;
- virtual void OnPasswordChangeDetected(
- const GaiaAuthConsumer::ClientLoginResult& credentials) OVERRIDE;
+ virtual void OnPasswordChangeDetected() OVERRIDE;
virtual void WhiteListCheckFailed(const std::string& email) OVERRIDE;
virtual void OnOnlineChecked(
const std::string& username, bool success) OVERRIDE;
@@ -216,9 +214,6 @@ class ExistingUserController : public LoginDisplay::Delegate,
// Whether everything is ready to launch the browser.
bool ready_for_browser_launch_;
- // Whether two factor credentials were used.
- bool two_factor_credentials_;
-
// Used to verify ownership before starting enterprise enrollment.
scoped_ptr<OwnershipStatusChecker> ownership_checker_;
diff --git a/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc b/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc
index 7174521..ffdf80a 100644
--- a/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc
@@ -89,7 +89,6 @@ class MockLoginPerformerDelegate : public LoginPerformer::Delegate {
virtual void OnLoginSuccess(const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& result,
bool pending_requests,
bool using_oauth) OVERRIDE {
ignore_result(controller_->login_performer_.release());
diff --git a/chrome/browser/chromeos/login/login_performer.cc b/chrome/browser/chromeos/login/login_performer.cc
index 53cd4fc..3038914 100644
--- a/chrome/browser/chromeos/login/login_performer.cc
+++ b/chrome/browser/chromeos/login/login_performer.cc
@@ -119,7 +119,6 @@ void LoginPerformer::OnLoginFailure(const LoginFailure& failure) {
void LoginPerformer::OnLoginSuccess(
const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests,
bool using_oauth) {
content::RecordAction(UserMetricsAction("Login_Success"));
@@ -142,7 +141,6 @@ void LoginPerformer::OnLoginSuccess(
delegate_->OnLoginSuccess(username,
password,
- credentials,
pending_requests,
using_oauth);
return;
@@ -152,7 +150,6 @@ void LoginPerformer::OnLoginSuccess(
<< "Pending request w/o delegate_ should not happen!";
// It is not guaranted, that profile creation has been finished yet. So use
// async version here.
- credentials_ = credentials;
ProfileManager::CreateDefaultProfileAsync(
base::Bind(&LoginPerformer::OnProfileCreated,
weak_factory_.GetWeakPtr()));
@@ -177,9 +174,6 @@ void LoginPerformer::OnProfileCreated(
if (using_oauth_)
LoginUtils::Get()->StartTokenServices(profile);
- LoginUtils::Get()->StartSignedInServices(profile, credentials_);
- credentials_ = GaiaAuthConsumer::ClientLoginResult();
-
// Don't unlock screen if it was locked while we're waiting
// for initial online auth.
if (ScreenLocker::default_screen_locker() &&
@@ -206,11 +200,9 @@ void LoginPerformer::OnOffTheRecordLoginSuccess() {
NOTREACHED();
}
-void LoginPerformer::OnPasswordChangeDetected(
- const GaiaAuthConsumer::ClientLoginResult& credentials) {
- cached_credentials_ = credentials;
+void LoginPerformer::OnPasswordChangeDetected() {
if (delegate_) {
- delegate_->OnPasswordChangeDetected(credentials);
+ delegate_->OnPasswordChangeDetected();
} else {
last_login_failure_ =
LoginFailure::FromNetworkAuthFailure(GoogleServiceAuthError(
@@ -338,17 +330,13 @@ void LoginPerformer::RecoverEncryptedData(const std::string& old_password) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&Authenticator::RecoverEncryptedData, authenticator_.get(),
- old_password,
- cached_credentials_));
- cached_credentials_ = GaiaAuthConsumer::ClientLoginResult();
+ old_password));
}
void LoginPerformer::ResyncEncryptedData() {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- base::Bind(&Authenticator::ResyncEncryptedData, authenticator_.get(),
- cached_credentials_));
- cached_credentials_ = GaiaAuthConsumer::ClientLoginResult();
+ base::Bind(&Authenticator::ResyncEncryptedData, authenticator_.get()));
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/chromeos/login/login_performer.h b/chrome/browser/chromeos/login/login_performer.h
index b9ce8fb..a930452 100644
--- a/chrome/browser/chromeos/login/login_performer.h
+++ b/chrome/browser/chromeos/login/login_performer.h
@@ -78,12 +78,10 @@ class LoginPerformer : public LoginStatusConsumer,
virtual void OnLoginSuccess(
const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests,
bool using_oauth) OVERRIDE;
virtual void OnOffTheRecordLoginSuccess() OVERRIDE;
- virtual void OnPasswordChangeDetected(
- const GaiaAuthConsumer::ClientLoginResult& credentials) OVERRIDE;
+ virtual void OnPasswordChangeDetected() OVERRIDE;
// Completes login process that has already been authenticated with
// provided |username| and |password|.
@@ -175,9 +173,6 @@ class LoginPerformer : public LoginStatusConsumer,
// sign-in server. LoginFailure.None() by default.
LoginFailure last_login_failure_;
- // Cached credentials data when password change is detected.
- GaiaAuthConsumer::ClientLoginResult cached_credentials_;
-
// Username and password for the current login attempt.
std::string username_;
std::string password_;
@@ -201,8 +196,6 @@ class LoginPerformer : public LoginStatusConsumer,
// is locked during that stage. No need to resolve screen lock action then.
bool initial_online_auth_pending_;
- GaiaAuthConsumer::ClientLoginResult credentials_;
-
// Authorization mode type.
AuthorizationMode auth_mode_;
diff --git a/chrome/browser/chromeos/login/login_status_consumer.cc b/chrome/browser/chromeos/login/login_status_consumer.cc
index 3d40ea5..6ee5916 100644
--- a/chrome/browser/chromeos/login/login_status_consumer.cc
+++ b/chrome/browser/chromeos/login/login_status_consumer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,8 +6,7 @@
namespace chromeos {
-void LoginStatusConsumer::OnPasswordChangeDetected(
- const GaiaAuthConsumer::ClientLoginResult& credentials) {
+void LoginStatusConsumer::OnPasswordChangeDetected() {
NOTREACHED();
}
diff --git a/chrome/browser/chromeos/login/login_status_consumer.h b/chrome/browser/chromeos/login/login_status_consumer.h
index 1e32b6b..62bb85f 100644
--- a/chrome/browser/chromeos/login/login_status_consumer.h
+++ b/chrome/browser/chromeos/login/login_status_consumer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -101,20 +101,17 @@ class LoginStatusConsumer {
// The current login attempt has ended in failure, with error |error|.
virtual void OnLoginFailure(const LoginFailure& error) = 0;
// The current login attempt has succeeded for
- // |username|/|password|, returning |credentials|. If
- // |pending_requests| is false, we're totally done. If it's true,
- // we will still have some more results to report later.
+ // |username|/|password|. If |pending_requests| is false, we're totally done.
+ // If it's true, we will still have some more results to report later.
virtual void OnLoginSuccess(
const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests,
bool using_oauth) = 0;
// The current guest login attempt has succeeded.
virtual void OnOffTheRecordLoginSuccess() {}
// The same password didn't work both online and offline.
- virtual void OnPasswordChangeDetected(
- const GaiaAuthConsumer::ClientLoginResult& credentials);
+ virtual void OnPasswordChangeDetected();
};
} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc
index a709016..9c4564e 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -32,6 +32,7 @@
#include "chrome/browser/chromeos/cros_settings_names.h"
#include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
#include "chrome/browser/chromeos/dbus/session_manager_client.h"
+#include "chrome/browser/chromeos/gdata/gdata.h"
#include "chrome/browser/chromeos/input_method/input_method_manager.h"
#include "chrome/browser/chromeos/input_method/input_method_util.h"
#include "chrome/browser/chromeos/login/cookie_fetcher.h"
@@ -557,7 +558,6 @@ class LoginUtilsImpl : public LoginUtils,
const std::string& username,
const std::string& display_email,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests,
bool using_oauth,
bool has_cookies,
@@ -651,7 +651,6 @@ class LoginUtilsImpl : public LoginUtils,
Profile::CreateStatus status);
std::string password_;
- GaiaAuthConsumer::ClientLoginResult credentials_;
bool pending_requests_;
bool using_oauth_;
bool has_cookies_;
@@ -702,7 +701,6 @@ void LoginUtilsImpl::PrepareProfile(
const std::string& username,
const std::string& display_email,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests,
bool using_oauth,
bool has_cookies,
@@ -730,7 +728,6 @@ void LoginUtilsImpl::PrepareProfile(
password_ = password;
- credentials_ = credentials;
pending_requests_ = pending_requests;
using_oauth_ = using_oauth;
has_cookies_ = has_cookies;
@@ -878,9 +875,6 @@ void LoginUtilsImpl::OnProfileCreated(
// resolved.
if (delegate_)
delegate_->OnProfilePrepared(user_profile);
-
- // TODO(altimofeev): Need to sanitize memory used to store password.
- credentials_ = GaiaAuthConsumer::ClientLoginResult();
}
void LoginUtilsImpl::FetchOAuth1AccessToken(Profile* auth_profile) {
@@ -921,6 +915,7 @@ void LoginUtilsImpl::StartSignedInServices(
static bool initialized = false;
if (!initialized) {
initialized = true;
+ gdata::DocumentsService::GetInstance()->Initialize(user_profile);
// Pass the updated passphrase to the sync service for use in decrypting
// data encrypted with the user's GAIA password.
ProfileSyncService* sync_service =
@@ -1109,12 +1104,6 @@ scoped_refptr<Authenticator> LoginUtilsImpl::CreateAuthenticator(
if (ScreenLocker::default_screen_locker())
authenticator_ = NULL;
- // In case of non-WebUI login new instance of Authenticator is supposed
- // to be created on each call.
- // TODO(nkostylev): Clean up after WebUI login migration is complete.
- if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kWebUILogin))
- authenticator_ = NULL;
-
if (authenticator_ == NULL)
authenticator_ = new ParallelAuthenticator(consumer);
return authenticator_;
diff --git a/chrome/browser/chromeos/login/login_utils.h b/chrome/browser/chromeos/login/login_utils.h
index 1f8ce58..976e7ca 100644
--- a/chrome/browser/chromeos/login/login_utils.h
+++ b/chrome/browser/chromeos/login/login_utils.h
@@ -62,7 +62,6 @@ class LoginUtils {
const std::string& username,
const std::string& display_email,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests,
bool using_oauth,
bool has_cookies,
diff --git a/chrome/browser/chromeos/login/login_utils_browsertest.cc b/chrome/browser/chromeos/login/login_utils_browsertest.cc
index 64ba01f..b8a0aa7 100644
--- a/chrome/browser/chromeos/login/login_utils_browsertest.cc
+++ b/chrome/browser/chromeos/login/login_utils_browsertest.cc
@@ -220,7 +220,6 @@ class LoginUtilsTestBase : public TESTBASE,
virtual void OnLoginSuccess(const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& creds,
bool pending_requests,
bool using_oauth) OVERRIDE {
FAIL() << "OnLoginSuccess not expected";
@@ -250,9 +249,8 @@ class LoginUtilsTestBase : public TESTBASE,
username,
"password");
- GaiaAuthConsumer::ClientLoginResult credentials;
LoginUtils::Get()->PrepareProfile(username, std::string(), "password",
- credentials, false, true, false, this);
+ false, true, false, this);
loop_.RunAllPending();
}
diff --git a/chrome/browser/chromeos/login/mock_authenticator.cc b/chrome/browser/chromeos/login/mock_authenticator.cc
index c71cf7d..b7adc33 100644
--- a/chrome/browser/chromeos/login/mock_authenticator.cc
+++ b/chrome/browser/chromeos/login/mock_authenticator.cc
@@ -18,8 +18,7 @@ void MockAuthenticator::AuthenticateToLogin(Profile* profile,
const std::string& login_captcha) {
if (expected_username_ == username && expected_password_ == password) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- base::Bind(&MockAuthenticator::OnLoginSuccess, this,
- GaiaAuthConsumer::ClientLoginResult(), false));
+ base::Bind(&MockAuthenticator::OnLoginSuccess, this, false));
}
GoogleServiceAuthError error(
GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
@@ -33,7 +32,7 @@ void MockAuthenticator::CompleteLogin(Profile* profile,
const std::string& password) {
CHECK_EQ(expected_username_, username);
CHECK_EQ(expected_password_, password);
- OnLoginSuccess(GaiaAuthConsumer::ClientLoginResult(), false);
+ OnLoginSuccess(false);
}
void MockAuthenticator::AuthenticateToUnlock(const std::string& username,
@@ -47,13 +46,11 @@ void MockAuthenticator::LoginOffTheRecord() {
}
void MockAuthenticator::OnLoginSuccess(
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool request_pending) {
// If we want to be more like the real thing, we could save username
// in AuthenticateToLogin, but there's not much of a point.
consumer_->OnLoginSuccess(expected_username_,
expected_password_,
- credentials,
request_pending,
false);
}
@@ -77,7 +74,6 @@ void MockLoginUtils::PrepareProfile(
const std::string& username,
const std::string& display_email,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& res,
bool pending_requests,
bool using_oauth,
bool has_cookies,
diff --git a/chrome/browser/chromeos/login/mock_authenticator.h b/chrome/browser/chromeos/login/mock_authenticator.h
index 7739c78..ca5fb77 100644
--- a/chrome/browser/chromeos/login/mock_authenticator.h
+++ b/chrome/browser/chromeos/login/mock_authenticator.h
@@ -48,17 +48,14 @@ class MockAuthenticator : public Authenticator {
virtual void LoginOffTheRecord() OVERRIDE;
virtual void OnLoginSuccess(
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool request_pending) OVERRIDE;
virtual void OnLoginFailure(const LoginFailure& failure) OVERRIDE;
virtual void RecoverEncryptedData(
- const std::string& old_password,
- const GaiaAuthConsumer::ClientLoginResult& credentials) OVERRIDE {}
+ const std::string& old_password) OVERRIDE {}
- virtual void ResyncEncryptedData(
- const GaiaAuthConsumer::ClientLoginResult& credentials) OVERRIDE {}
+ virtual void ResyncEncryptedData() OVERRIDE {}
virtual void RetryAuth(Profile* profile,
const std::string& username,
@@ -82,7 +79,6 @@ class MockLoginUtils : public LoginUtils {
virtual void PrepareProfile(const std::string& username,
const std::string& display_email,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& res,
bool pending_requests,
bool using_oauth,
bool has_cookies,
diff --git a/chrome/browser/chromeos/login/mock_login_status_consumer.cc b/chrome/browser/chromeos/login/mock_login_status_consumer.cc
index 3ac5883..887b3b1 100644
--- a/chrome/browser/chromeos/login/mock_login_status_consumer.cc
+++ b/chrome/browser/chromeos/login/mock_login_status_consumer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -29,7 +29,6 @@ void MockConsumer::OnGuestSuccessQuitAndFail() {
void MockConsumer::OnSuccessQuit(
const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests,
bool using_oauth) {
MessageLoop::current()->Quit();
@@ -39,7 +38,6 @@ void MockConsumer::OnSuccessQuit(
void MockConsumer::OnSuccessQuitAndFail(
const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests,
bool using_oauth) {
ADD_FAILURE() << "Login should NOT have succeeded!";
@@ -58,14 +56,12 @@ void MockConsumer::OnFailQuitAndFail(const LoginFailure& error) {
}
// static
-void MockConsumer::OnMigrateQuit(
- const GaiaAuthConsumer::ClientLoginResult& credentials) {
+void MockConsumer::OnMigrateQuit() {
MessageLoop::current()->Quit();
}
// static
-void MockConsumer::OnMigrateQuitAndFail(
- const GaiaAuthConsumer::ClientLoginResult& credentials) {
+void MockConsumer::OnMigrateQuitAndFail() {
ADD_FAILURE() << "Should not have detected a PW change!";
MessageLoop::current()->Quit();
}
diff --git a/chrome/browser/chromeos/login/mock_login_status_consumer.h b/chrome/browser/chromeos/login/mock_login_status_consumer.h
index c93eb78..b30a070 100644
--- a/chrome/browser/chromeos/login/mock_login_status_consumer.h
+++ b/chrome/browser/chromeos/login/mock_login_status_consumer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -17,15 +17,13 @@ class MockConsumer : public LoginStatusConsumer {
virtual ~MockConsumer();
MOCK_METHOD1(OnLoginFailure, void(const LoginFailure& error));
- MOCK_METHOD5(OnLoginSuccess, void(
+ MOCK_METHOD4(OnLoginSuccess, void(
const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& result,
bool pending_requests,
bool using_oauth));
MOCK_METHOD0(OnOffTheRecordLoginSuccess, void(void));
- MOCK_METHOD1(OnPasswordChangeDetected,
- void(const GaiaAuthConsumer::ClientLoginResult& result));
+ MOCK_METHOD0(OnPasswordChangeDetected, void(void));
// The following functions can be used in gmock Invoke() clauses.
@@ -37,13 +35,11 @@ class MockConsumer : public LoginStatusConsumer {
static void OnSuccessQuit(
const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests,
bool using_oauth);
static void OnSuccessQuitAndFail(
const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests,
bool using_oauth);
@@ -52,10 +48,8 @@ class MockConsumer : public LoginStatusConsumer {
static void OnFailQuitAndFail(const LoginFailure& error);
// Compatible with LoginStatusConsumer::OnPasswordChangeDetected()
- static void OnMigrateQuit(
- const GaiaAuthConsumer::ClientLoginResult& credentials);
- static void OnMigrateQuitAndFail(
- const GaiaAuthConsumer::ClientLoginResult& credentials);
+ static void OnMigrateQuit();
+ static void OnMigrateQuitAndFail();
};
} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/online_attempt.cc b/chrome/browser/chromeos/login/online_attempt.cc
index dc17353..4569f17 100644
--- a/chrome/browser/chromeos/login/online_attempt.cc
+++ b/chrome/browser/chromeos/login/online_attempt.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -76,7 +76,7 @@ void OnlineAttempt::Initiate(Profile* auth_profile) {
}
void OnlineAttempt::OnClientLoginSuccess(
- const GaiaAuthConsumer::ClientLoginResult& credentials) {
+ const GaiaAuthConsumer::ClientLoginResult& unused) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
VLOG(1) << "Online login successful!";
@@ -95,7 +95,7 @@ void OnlineAttempt::OnClientLoginSuccess(
TryClientLogin();
return;
}
- TriggerResolve(credentials, LoginFailure::None());
+ TriggerResolve(LoginFailure::None());
}
void OnlineAttempt::OnClientLoginFailure(
@@ -122,8 +122,7 @@ 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.";
- TriggerResolve(GaiaAuthConsumer::ClientLoginResult(),
- LoginFailure::FromNetworkAuthFailure(
+ TriggerResolve(LoginFailure::FromNetworkAuthFailure(
GoogleServiceAuthError(
GoogleServiceAuthError::HOSTED_NOT_ALLOWED)));
return;
@@ -131,14 +130,12 @@ void OnlineAttempt::OnClientLoginFailure(
if (error.state() == GoogleServiceAuthError::TWO_FACTOR) {
LOG(WARNING) << "Two factor authenticated. Sync will not work.";
- TriggerResolve(GaiaAuthConsumer::ClientLoginResult(),
- LoginFailure::None());
+ TriggerResolve(LoginFailure::None());
return;
}
VLOG(2) << "ClientLogin attempt failed with " << error.state();
- TriggerResolve(GaiaAuthConsumer::ClientLoginResult(),
- LoginFailure::FromNetworkAuthFailure(error));
+ TriggerResolve(LoginFailure::FromNetworkAuthFailure(error));
}
void OnlineAttempt::OnOAuthLoginSuccess(const std::string& sid,
@@ -201,15 +198,13 @@ void OnlineAttempt::CancelClientLogin() {
LOG(WARNING) << "Canceling ClientLogin attempt.";
CancelRequest();
- TriggerResolve(GaiaAuthConsumer::ClientLoginResult(),
- LoginFailure(LoginFailure::LOGIN_TIMED_OUT));
+ TriggerResolve(LoginFailure(LoginFailure::LOGIN_TIMED_OUT));
}
}
void OnlineAttempt::TriggerResolve(
- const GaiaAuthConsumer::ClientLoginResult& credentials,
const LoginFailure& outcome) {
- attempt_->RecordOnlineLoginStatus(credentials, outcome);
+ attempt_->RecordOnlineLoginStatus(outcome);
client_fetcher_.reset(NULL);
oauth_fetcher_.reset(NULL);
resolver_->Resolve();
diff --git a/chrome/browser/chromeos/login/online_attempt.h b/chrome/browser/chromeos/login/online_attempt.h
index 283ce1c..eef744a 100644
--- a/chrome/browser/chromeos/login/online_attempt.h
+++ b/chrome/browser/chromeos/login/online_attempt.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -62,8 +62,7 @@ class OnlineAttempt
void TryClientLogin();
void CancelClientLogin();
- void TriggerResolve(const GaiaAuthConsumer::ClientLoginResult& credentials,
- const LoginFailure& outcome);
+ void TriggerResolve(const LoginFailure& outcome);
bool HasPendingFetch();
void CancelRequest();
diff --git a/chrome/browser/chromeos/login/online_attempt_unittest.cc b/chrome/browser/chromeos/login/online_attempt_unittest.cc
index b04283b..12e8fa7 100644
--- a/chrome/browser/chromeos/login/online_attempt_unittest.cc
+++ b/chrome/browser/chromeos/login/online_attempt_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -107,17 +107,16 @@ class OnlineAttemptTest : public testing::Test {
};
TEST_F(OnlineAttemptTest, LoginSuccess) {
- GaiaAuthConsumer::ClientLoginResult result;
EXPECT_CALL(*(resolver_.get()), Resolve())
.Times(1)
.RetiresOnSaturation();
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- base::Bind(&OnlineAttempt::OnClientLoginSuccess, attempt_.get(), result));
+ base::Bind(&OnlineAttempt::OnClientLoginSuccess, attempt_.get(),
+ GaiaAuthConsumer::ClientLoginResult()));
// Force IO thread to finish tasks so I can verify |state_|.
io_thread_.Stop();
- EXPECT_TRUE(result == state_.credentials());
}
TEST_F(OnlineAttemptTest, LoginCancelRetry) {
@@ -268,7 +267,6 @@ TEST_F(OnlineAttemptTest, TwoFactorSuccess) {
io_thread_.Stop();
EXPECT_TRUE(GoogleServiceAuthError::None() ==
state_.online_outcome().error());
- EXPECT_TRUE(GaiaAuthConsumer::ClientLoginResult() == state_.credentials());
}
} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/parallel_authenticator.cc b/chrome/browser/chromeos/login/parallel_authenticator.cc
index 76b36f7..b6dc973 100644
--- a/chrome/browser/chromeos/login/parallel_authenticator.cc
+++ b/chrome/browser/chromeos/login/parallel_authenticator.cc
@@ -175,10 +175,8 @@ ParallelAuthenticator::ParallelAuthenticator(LoginStatusConsumer* consumer)
check_key_attempted_(false),
already_reported_success_(false),
using_oauth_(
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kWebUILogin) &&
!CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSkipOAuthLogin)) {
+ switches::kSkipOAuthLogin)) {
// If not already owned, this is a no-op. If it is, this loads the owner's
// public key off of disk.
OwnershipService::GetSharedInstance()->StartLoadOwnerKeyAttempt();
@@ -282,7 +280,6 @@ void ParallelAuthenticator::LoginOffTheRecord() {
}
void ParallelAuthenticator::OnLoginSuccess(
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool request_pending) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
VLOG(1) << "Login success";
@@ -298,7 +295,6 @@ void ParallelAuthenticator::OnLoginSuccess(
}
consumer_->OnLoginSuccess(current_state_->username,
current_state_->password,
- credentials,
request_pending,
using_oauth_);
}
@@ -314,10 +310,9 @@ void ParallelAuthenticator::OnOffTheRecordLoginSuccess() {
consumer_->OnOffTheRecordLoginSuccess();
}
-void ParallelAuthenticator::OnPasswordChangeDetected(
- const GaiaAuthConsumer::ClientLoginResult& credentials) {
+void ParallelAuthenticator::OnPasswordChangeDetected() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- consumer_->OnPasswordChangeDetected(credentials);
+ consumer_->OnPasswordChangeDetected();
}
void ParallelAuthenticator::OnLoginFailure(const LoginFailure& error) {
@@ -342,8 +337,7 @@ void ParallelAuthenticator::RecordOAuthCheckFailure(
}
void ParallelAuthenticator::RecoverEncryptedData(
- const std::string& old_password,
- const GaiaAuthConsumer::ClientLoginResult& credentials) {
+ const std::string& old_password) {
std::string old_hash =
CrosLibrary::Get()->GetCryptohomeLibrary()->HashPassword(old_password);
migrate_attempted_ = true;
@@ -358,8 +352,7 @@ void ParallelAuthenticator::RecoverEncryptedData(
old_hash)));
}
-void ParallelAuthenticator::ResyncEncryptedData(
- const GaiaAuthConsumer::ClientLoginResult& credentials) {
+void ParallelAuthenticator::ResyncEncryptedData() {
remove_attempted_ = true;
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
@@ -445,8 +438,7 @@ void ParallelAuthenticator::Resolve() {
case NEED_OLD_PW:
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- base::Bind(&ParallelAuthenticator::OnPasswordChangeDetected, this,
- current_state_->credentials()));
+ base::Bind(&ParallelAuthenticator::OnPasswordChangeDetected, this));
break;
case ONLINE_FAILED:
// In this case, we know online login was rejected because the account
@@ -467,8 +459,7 @@ void ParallelAuthenticator::Resolve() {
// OnLoginSuccess(..., ..., true) -> OnLoginFailure().
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- base::Bind(&ParallelAuthenticator::OnLoginSuccess, this,
- current_state_->credentials(), true));
+ base::Bind(&ParallelAuthenticator::OnLoginSuccess, this, true));
}
}
const LoginFailure& login_failure =
@@ -518,7 +509,7 @@ void ParallelAuthenticator::Resolve() {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&ParallelAuthenticator::OnLoginSuccess, this,
- current_state_->credentials(), request_pending));
+ request_pending));
break;
case GUEST_LOGIN:
BrowserThread::PostTask(
@@ -690,8 +681,7 @@ ParallelAuthenticator::ResolveOnlineSuccessState(
void ParallelAuthenticator::ResolveLoginCompletionStatus() {
// Shortcut online state resolution process.
- current_state_->RecordOnlineLoginStatus(GaiaAuthConsumer::ClientLoginResult(),
- LoginFailure::None());
+ current_state_->RecordOnlineLoginStatus(LoginFailure::None());
Resolve();
}
diff --git a/chrome/browser/chromeos/login/parallel_authenticator.h b/chrome/browser/chromeos/login/parallel_authenticator.h
index 0da87d9..d7fb0ac 100644
--- a/chrome/browser/chromeos/login/parallel_authenticator.h
+++ b/chrome/browser/chromeos/login/parallel_authenticator.h
@@ -117,15 +117,12 @@ class ParallelAuthenticator : public Authenticator,
// These methods must be called on the UI thread, as they make DBus calls
// and also call back to the login UI.
virtual void OnLoginSuccess(
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool request_pending) OVERRIDE;
virtual void OnLoginFailure(const LoginFailure& error) OVERRIDE;
virtual void RecoverEncryptedData(
- const std::string& old_password,
- const GaiaAuthConsumer::ClientLoginResult& credentials) OVERRIDE;
- virtual void ResyncEncryptedData(
- const GaiaAuthConsumer::ClientLoginResult& credentials) OVERRIDE;
+ const std::string& old_password) OVERRIDE;
+ virtual void ResyncEncryptedData() OVERRIDE;
virtual void RetryAuth(Profile* profile,
const std::string& username,
const std::string& password,
@@ -141,8 +138,7 @@ class ParallelAuthenticator : public Authenticator,
virtual void Resolve() OVERRIDE;
void OnOffTheRecordLoginSuccess();
- void OnPasswordChangeDetected(
- const GaiaAuthConsumer::ClientLoginResult& credentials);
+ void OnPasswordChangeDetected();
private:
// Returns the AuthState we're in, given the status info we have at
@@ -181,6 +177,11 @@ class ParallelAuthenticator : public Authenticator,
// Must be called on the IO thread.
AuthState ResolveOnlineSuccessState(AuthState offline_state);
+ // Used to disable oauth, used for testing.
+ void set_using_oauth(bool value) {
+ using_oauth_ = value;
+ }
+
// Used for testing.
void set_attempt_state(TestAttemptState* new_state) { // takes ownership.
current_state_.reset(new_state);
diff --git a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc
index 1670fad..e3b29df 100644
--- a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc
+++ b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc
@@ -110,6 +110,7 @@ class ParallelAuthenticatorTest : public testing::Test {
io_thread_.Start();
auth_ = new ParallelAuthenticator(&consumer_);
+ auth_->set_using_oauth(false);
state_.reset(new TestAttemptState(username_,
password_,
hash_ascii_,
@@ -146,7 +147,7 @@ class ParallelAuthenticatorTest : public testing::Test {
// Allow test to fail and exit gracefully, even if OnLoginSuccess()
// wasn't supposed to happen.
void FailOnLoginSuccess() {
- ON_CALL(consumer_, OnLoginSuccess(_, _, _, _, _))
+ ON_CALL(consumer_, OnLoginSuccess(_, _, _, _))
.WillByDefault(Invoke(MockConsumer::OnSuccessQuitAndFail));
}
@@ -165,9 +166,8 @@ class ParallelAuthenticatorTest : public testing::Test {
void ExpectLoginSuccess(const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& result,
bool pending) {
- EXPECT_CALL(consumer_, OnLoginSuccess(username, password, result, pending,
+ EXPECT_CALL(consumer_, OnLoginSuccess(username, password, pending,
false))
.WillOnce(Invoke(MockConsumer::OnSuccessQuit))
.RetiresOnSaturation();
@@ -180,7 +180,7 @@ class ParallelAuthenticatorTest : public testing::Test {
}
void ExpectPasswordChange() {
- EXPECT_CALL(consumer_, OnPasswordChangeDetected(result_))
+ EXPECT_CALL(consumer_, OnPasswordChangeDetected())
.WillOnce(Invoke(MockConsumer::OnMigrateQuit))
.RetiresOnSaturation();
}
@@ -207,7 +207,6 @@ class ParallelAuthenticatorTest : public testing::Test {
std::string username_;
std::string password_;
std::string hash_ascii_;
- GaiaAuthConsumer::ClientLoginResult result_;
// Initializes / shuts down a stub CrosLibrary.
chromeos::ScopedStubCrosEnabler stub_cros_enabler_;
@@ -222,21 +221,20 @@ class ParallelAuthenticatorTest : public testing::Test {
};
TEST_F(ParallelAuthenticatorTest, OnLoginSuccess) {
- EXPECT_CALL(consumer_, OnLoginSuccess(username_, password_, result_, false,
- false))
+ EXPECT_CALL(consumer_, OnLoginSuccess(username_, password_, false, false))
.Times(1)
.RetiresOnSaturation();
SetAttemptState(auth_, state_.release());
- auth_->OnLoginSuccess(result_, false);
+ auth_->OnLoginSuccess(false);
}
TEST_F(ParallelAuthenticatorTest, OnPasswordChangeDetected) {
- EXPECT_CALL(consumer_, OnPasswordChangeDetected(result_))
+ EXPECT_CALL(consumer_, OnPasswordChangeDetected())
.Times(1)
.RetiresOnSaturation();
SetAttemptState(auth_, state_.release());
- auth_->OnPasswordChangeDetected(result_);
+ auth_->OnPasswordChangeDetected();
}
TEST_F(ParallelAuthenticatorTest, ResolveNothingDone) {
@@ -280,8 +278,7 @@ TEST_F(ParallelAuthenticatorTest, ResolveNeedOldPw) {
// and been rejected because of unmatched key; additionally,
// an online auth attempt has completed successfully.
state_->PresetCryptohomeStatus(false, cryptohome::MOUNT_ERROR_KEY_FAILURE);
- state_->PresetOnlineLoginStatus(GaiaAuthConsumer::ClientLoginResult(),
- LoginFailure::None());
+ state_->PresetOnlineLoginStatus(LoginFailure::None());
scoped_refptr<ResolveChecker> checker(
new ResolveChecker(state_.release(),
auth_.get(),
@@ -332,7 +329,7 @@ TEST_F(ParallelAuthenticatorTest, DriveGuestLoginButFail) {
}
TEST_F(ParallelAuthenticatorTest, DriveDataResync) {
- ExpectLoginSuccess(username_, password_, result_, false);
+ ExpectLoginSuccess(username_, password_, false);
FailOnLoginFailure();
// Set up mock cryptohome library to respond successfully to a cryptohome
@@ -346,10 +343,10 @@ TEST_F(ParallelAuthenticatorTest, DriveDataResync) {
.Times(1)
.RetiresOnSaturation();
- state_->PresetOnlineLoginStatus(result_, LoginFailure::None());
+ state_->PresetOnlineLoginStatus(LoginFailure::None());
SetAttemptState(auth_, state_.release());
- auth_->ResyncEncryptedData(result_);
+ auth_->ResyncEncryptedData();
message_loop_.Run();
}
@@ -365,7 +362,7 @@ TEST_F(ParallelAuthenticatorTest, DriveResyncFail) {
SetAttemptState(auth_, state_.release());
- auth_->ResyncEncryptedData(result_);
+ auth_->ResyncEncryptedData();
message_loop_.Run();
}
@@ -374,14 +371,14 @@ TEST_F(ParallelAuthenticatorTest, DriveRequestOldPassword) {
ExpectPasswordChange();
state_->PresetCryptohomeStatus(false, cryptohome::MOUNT_ERROR_KEY_FAILURE);
- state_->PresetOnlineLoginStatus(result_, LoginFailure::None());
+ state_->PresetOnlineLoginStatus(LoginFailure::None());
SetAttemptState(auth_, state_.release());
RunResolve(auth_.get(), &message_loop_);
}
TEST_F(ParallelAuthenticatorTest, DriveDataRecover) {
- ExpectLoginSuccess(username_, password_, result_, false);
+ ExpectLoginSuccess(username_, password_, false);
FailOnLoginFailure();
// Set up mock cryptohome library to respond successfully to a key migration.
@@ -396,10 +393,10 @@ TEST_F(ParallelAuthenticatorTest, DriveDataRecover) {
.WillOnce(Return(std::string()))
.RetiresOnSaturation();
- state_->PresetOnlineLoginStatus(result_, LoginFailure::None());
+ state_->PresetOnlineLoginStatus(LoginFailure::None());
SetAttemptState(auth_, state_.release());
- auth_->RecoverEncryptedData(std::string(), result_);
+ auth_->RecoverEncryptedData(std::string());
message_loop_.Run();
}
@@ -419,7 +416,7 @@ TEST_F(ParallelAuthenticatorTest, DriveDataRecoverButFail) {
SetAttemptState(auth_, state_.release());
- auth_->RecoverEncryptedData(std::string(), result_);
+ auth_->RecoverEncryptedData(std::string());
message_loop_.Run();
}
@@ -459,8 +456,7 @@ TEST_F(ParallelAuthenticatorTest, ResolveCreateNew) {
// an online auth attempt has completed successfully.
state_->PresetCryptohomeStatus(false,
cryptohome::MOUNT_ERROR_USER_DOES_NOT_EXIST);
- state_->PresetOnlineLoginStatus(GaiaAuthConsumer::ClientLoginResult(),
- LoginFailure::None());
+ state_->PresetOnlineLoginStatus(LoginFailure::None());
scoped_refptr<ResolveChecker> checker(
new ResolveChecker(state_.release(),
auth_.get(),
@@ -469,7 +465,7 @@ TEST_F(ParallelAuthenticatorTest, ResolveCreateNew) {
}
TEST_F(ParallelAuthenticatorTest, DriveCreateForNewUser) {
- ExpectLoginSuccess(username_, password_, result_, false);
+ ExpectLoginSuccess(username_, password_, false);
FailOnLoginFailure();
// Set up mock cryptohome library to respond successfully to a cryptohome
@@ -484,15 +480,14 @@ TEST_F(ParallelAuthenticatorTest, DriveCreateForNewUser) {
// an online auth attempt has completed successfully.
state_->PresetCryptohomeStatus(false,
cryptohome::MOUNT_ERROR_USER_DOES_NOT_EXIST);
- state_->PresetOnlineLoginStatus(GaiaAuthConsumer::ClientLoginResult(),
- LoginFailure::None());
+ state_->PresetOnlineLoginStatus(LoginFailure::None());
SetAttemptState(auth_, state_.release());
RunResolve(auth_.get(), &message_loop_);
}
TEST_F(ParallelAuthenticatorTest, DriveOfflineLogin) {
- ExpectLoginSuccess(username_, password_, result_, false);
+ ExpectLoginSuccess(username_, password_, false);
FailOnLoginFailure();
// Set up state as though a cryptohome mount attempt has occurred and
@@ -500,15 +495,14 @@ TEST_F(ParallelAuthenticatorTest, DriveOfflineLogin) {
state_->PresetCryptohomeStatus(true, 0);
GoogleServiceAuthError error =
GoogleServiceAuthError::FromConnectionError(net::ERR_CONNECTION_RESET);
- state_->PresetOnlineLoginStatus(result_,
- LoginFailure::FromNetworkAuthFailure(error));
+ state_->PresetOnlineLoginStatus(LoginFailure::FromNetworkAuthFailure(error));
SetAttemptState(auth_, state_.release());
RunResolve(auth_.get(), &message_loop_);
}
TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginDelayedOnline) {
- ExpectLoginSuccess(username_, password_, result_, true);
+ ExpectLoginSuccess(username_, password_, true);
FailOnLoginFailure();
// Set up state as though a cryptohome mount attempt has occurred and
@@ -522,14 +516,14 @@ TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginDelayedOnline) {
GoogleServiceAuthError error(
GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
LoginFailure failure = LoginFailure::FromNetworkAuthFailure(error);
- state_.release()->PresetOnlineLoginStatus(result_, failure);
+ state_.release()->PresetOnlineLoginStatus(failure);
ExpectLoginFailure(failure);
RunResolve(auth_.get(), &message_loop_);
}
TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginGetNewPassword) {
- ExpectLoginSuccess(username_, password_, result_, true);
+ ExpectLoginSuccess(username_, password_, true);
FailOnLoginFailure();
// Set up mock cryptohome library to respond successfully to a key migration.
@@ -555,13 +549,13 @@ TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginGetNewPassword) {
GoogleServiceAuthError error(
GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
LoginFailure failure = LoginFailure::FromNetworkAuthFailure(error);
- state_.release()->PresetOnlineLoginStatus(result_, failure);
+ state_.release()->PresetOnlineLoginStatus(failure);
ExpectLoginFailure(failure);
RunResolve(auth_.get(), &message_loop_);
// After the request below completes, OnLoginSuccess gets called again.
- ExpectLoginSuccess(username_, password_, result_, false);
+ ExpectLoginSuccess(username_, password_, false);
MockFactory<SuccessFetcher> factory;
TestingProfile profile;
@@ -575,7 +569,7 @@ TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginGetNewPassword) {
}
TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginGetCaptchad) {
- ExpectLoginSuccess(username_, password_, result_, true);
+ ExpectLoginSuccess(username_, password_, true);
FailOnLoginFailure();
EXPECT_CALL(*mock_library_, HashPassword(_))
.WillOnce(Return(std::string()))
@@ -592,7 +586,7 @@ TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginGetCaptchad) {
GoogleServiceAuthError error(
GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
LoginFailure failure = LoginFailure::FromNetworkAuthFailure(error);
- state_.release()->PresetOnlineLoginStatus(result_, failure);
+ state_.release()->PresetOnlineLoginStatus(failure);
ExpectLoginFailure(failure);
RunResolve(auth_.get(), &message_loop_);
@@ -617,14 +611,13 @@ TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginGetCaptchad) {
}
TEST_F(ParallelAuthenticatorTest, DriveOnlineLogin) {
- GaiaAuthConsumer::ClientLoginResult success("sid", "lsid", "", "");
- ExpectLoginSuccess(username_, password_, success, false);
+ ExpectLoginSuccess(username_, password_, false);
FailOnLoginFailure();
// Set up state as though a cryptohome mount attempt has occurred and
// succeeded.
state_->PresetCryptohomeStatus(true, 0);
- state_->PresetOnlineLoginStatus(success, LoginFailure::None());
+ state_->PresetOnlineLoginStatus(LoginFailure::None());
SetAttemptState(auth_, state_.release());
RunResolve(auth_.get(), &message_loop_);
@@ -634,7 +627,7 @@ TEST_F(ParallelAuthenticatorTest, DriveOnlineLogin) {
TEST_F(ParallelAuthenticatorTest, DISABLED_DriveNeedNewPassword) {
FailOnLoginSuccess(); // Set failing on success as the default...
// ...but expect ONE successful login first.
- ExpectLoginSuccess(username_, password_, result_, true);
+ ExpectLoginSuccess(username_, password_, true);
GoogleServiceAuthError error(
GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
LoginFailure failure = LoginFailure::FromNetworkAuthFailure(error);
@@ -643,14 +636,14 @@ TEST_F(ParallelAuthenticatorTest, DISABLED_DriveNeedNewPassword) {
// Set up state as though a cryptohome mount attempt has occurred and
// succeeded.
state_->PresetCryptohomeStatus(true, 0);
- state_->PresetOnlineLoginStatus(result_, failure);
+ state_->PresetOnlineLoginStatus(failure);
SetAttemptState(auth_, state_.release());
RunResolve(auth_.get(), &message_loop_);
}
TEST_F(ParallelAuthenticatorTest, DriveUnlock) {
- ExpectLoginSuccess(username_, std::string(), result_, false);
+ ExpectLoginSuccess(username_, std::string(), false);
FailOnLoginFailure();
// Set up mock cryptohome library to respond successfully to a cryptohome
diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc
index f58960c..bbc9e81 100644
--- a/chrome/browser/chromeos/login/screen_locker.cc
+++ b/chrome/browser/chromeos/login/screen_locker.cc
@@ -258,7 +258,6 @@ void ScreenLocker::OnLoginFailure(const LoginFailure& error) {
void ScreenLocker::OnLoginSuccess(
const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& unused,
bool pending_requests,
bool using_oauth) {
VLOG(1) << "OnLoginSuccess: Sending Unlock request.";
@@ -286,8 +285,7 @@ void ScreenLocker::OnLoginSuccess(
NotifyScreenUnlockRequested();
if (login_status_consumer_)
- login_status_consumer_->OnLoginSuccess(username, password,
- unused, pending_requests,
+ login_status_consumer_->OnLoginSuccess(username, password, pending_requests,
using_oauth);
}
diff --git a/chrome/browser/chromeos/login/screen_locker.h b/chrome/browser/chromeos/login/screen_locker.h
index 2dbc3ac..863abca 100644
--- a/chrome/browser/chromeos/login/screen_locker.h
+++ b/chrome/browser/chromeos/login/screen_locker.h
@@ -50,7 +50,6 @@ class ScreenLocker : public LoginStatusConsumer {
virtual void OnLoginFailure(const chromeos::LoginFailure& error) OVERRIDE;
virtual void OnLoginSuccess(const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& result,
bool pending_requests,
bool using_oauth) OVERRIDE;
diff --git a/chrome/browser/chromeos/login/screen_locker_tester.cc b/chrome/browser/chromeos/login/screen_locker_tester.cc
index 482630c..f531563 100644
--- a/chrome/browser/chromeos/login/screen_locker_tester.cc
+++ b/chrome/browser/chromeos/login/screen_locker_tester.cc
@@ -48,7 +48,6 @@ class LoginAttemptObserver : public chromeos::LoginStatusConsumer {
virtual void OnLoginSuccess(
const std::string& username,
const std::string& password,
- const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests,
bool using_oauth) {
LoginAttempted();
diff --git a/chrome/browser/chromeos/login/test_attempt_state.cc b/chrome/browser/chromeos/login/test_attempt_state.cc
index 2193a9b..2423b1fd 100644
--- a/chrome/browser/chromeos/login/test_attempt_state.cc
+++ b/chrome/browser/chromeos/login/test_attempt_state.cc
@@ -32,11 +32,9 @@ TestAttemptState::TestAttemptState(const std::string& username,
TestAttemptState::~TestAttemptState() {}
void TestAttemptState::PresetOnlineLoginStatus(
- const GaiaAuthConsumer::ClientLoginResult& credentials,
const LoginFailure& outcome) {
online_complete_ = true;
online_outcome_ = outcome;
- credentials_ = credentials;
}
void TestAttemptState::DisableHosted() {
@@ -58,10 +56,6 @@ const LoginFailure& TestAttemptState::online_outcome() {
return online_outcome_;
}
-const GaiaAuthConsumer::ClientLoginResult& TestAttemptState::credentials() {
- return credentials_;
-}
-
bool TestAttemptState::is_first_time_user() {
return is_first_time_user_;
}
diff --git a/chrome/browser/chromeos/login/test_attempt_state.h b/chrome/browser/chromeos/login/test_attempt_state.h
index 9303d43..42dafc3 100644
--- a/chrome/browser/chromeos/login/test_attempt_state.h
+++ b/chrome/browser/chromeos/login/test_attempt_state.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -30,7 +30,6 @@ class TestAttemptState : public AuthAttemptState {
// Act as though an online login attempt completed already.
void PresetOnlineLoginStatus(
- const GaiaAuthConsumer::ClientLoginResult& credentials,
const LoginFailure& outcome);
// The next attempt will not allow HOSTED accounts to log in.
@@ -42,7 +41,6 @@ class TestAttemptState : public AuthAttemptState {
// To allow state to be queried on the main thread during tests.
virtual bool online_complete() OVERRIDE;
virtual const LoginFailure& online_outcome() OVERRIDE;
- virtual const GaiaAuthConsumer::ClientLoginResult& credentials() OVERRIDE;
virtual bool is_first_time_user() OVERRIDE;
virtual GaiaAuthFetcher::HostedAccountsSetting hosted_policy() OVERRIDE;
virtual bool cryptohome_complete() OVERRIDE;
diff --git a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
index 33559a2..e6f1869 100644
--- a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
+++ b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
@@ -269,7 +269,7 @@ IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest,
std::string user;
EXPECT_TRUE(screen->IsAutoEnrollment(&user));
// This is the main expectation: after auto-enrollment, login is resumed.
- EXPECT_CALL(mock_consumer, OnLoginSuccess(_, _, _, _, _)).Times(1);
+ EXPECT_CALL(mock_consumer, OnLoginSuccess(_, _, _, _)).Times(1);
OnExit(ScreenObserver::ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED);
// Prevent browser launch when the profile is prepared:
browser_shutdown::SetTryingToQuit(true);