Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: chrome/browser/sync/signin_manager_client_login.h

Issue 6894027: Initial refactoring complete Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed some tests that were broken by previous refactoring Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/signin_manager.cc ('k') | chrome/browser/sync/signin_manager_client_login.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/signin_manager_client_login.h
diff --git a/chrome/browser/sync/signin_manager_client_login.h b/chrome/browser/sync/signin_manager_client_login.h
new file mode 100644
index 0000000000000000000000000000000000000000..71d2d6938d4b0dac729b1ddbc7ce7424ae1a21ae
--- /dev/null
+++ b/chrome/browser/sync/signin_manager_client_login.h
@@ -0,0 +1,76 @@
+// Copyright (c) 2011 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.
+//
+// The signin manager encapsulates some functionality tracking
+// which user is signed in. When a user is signed in, a ClientLogin
+// request is run on their behalf. Auth tokens are fetched from Google
+// and the results are stored in the TokenService.
+
+#ifndef CHROME_BROWSER_SYNC_SIGNIN_MANAGER_CLIENT_LOGIN_H_
+#define CHROME_BROWSER_SYNC_SIGNIN_MANAGER_CLIENT_LOGIN_H_
+#pragma once
+
+#include <string>
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/sync/signin_manager.h"
+#include "chrome/common/net/gaia/gaia_auth_consumer.h"
+#include "chrome/common/net/gaia/google_service_auth_error.h"
+
+class GaiaAuthFetcher;
+class Profile;
+class PrefService;
+
+class SigninManagerClientLogin : public SigninManager, GaiaAuthConsumer {
+ public:
+ static const char kSigninManagerVariantName[];
+
+ SigninManagerClientLogin();
+ virtual ~SigninManagerClientLogin();
+
+ // Call to register our prefs.
+ static void RegisterUserPrefs(PrefService* user_prefs);
+
+ // If user was signed in, load tokens from DB if available.
+ virtual void Initialize(Profile* profile);
+
+ // If a user is signed in, this will return their name.
+ // Otherwise, it will return an empty string.
+ const std::string& GetUsername();
+
+ // Sets the user name. Used for migrating credentials from previous system.
+ void SetUsername(const std::string& username);
+
+ // Attempt to sign in this user. If successful, set a preference indicating
+ // the signed in user and send out a notification, then start fetching tokens
+ // for the user.
+ void StartSignIn(const std::string& username,
+ const std::string& password,
+ const std::string& login_token,
+ const std::string& login_captcha);
+
+ // Used when a second factor access code was required to complete a signin
+ // attempt.
+ void ProvideSecondFactorAccessCode(const std::string& access_code);
+
+ // Sign a user out, removing the preference, erasing all keys
+ // associated with the user, and canceling all auth in progress.
+ void SignOut();
+
+ // GaiaAuthConsumer
+ virtual void OnClientLoginSuccess(ClientLoginResult* result);
+ virtual void OnClientLoginFailure(const GoogleServiceAuthError& error);
+ virtual void OnGetUserInfoSuccess(const std::string& key,
+ const std::string& value);
+ virtual void OnGetUserInfoKeyNotFound(const std::string& key);
+ virtual void OnGetUserInfoFailure(const GoogleServiceAuthError& error);
+
+ private:
+ Profile* profile_;
+ std::string username_;
+ std::string password_; // This is kept empty whenever possible.
+ bool had_two_factor_error_;
+};
+
+#endif // CHROME_BROWSER_SYNC_SIGNIN_MANAGER_CLIENT_LOGIN_H_
« no previous file with comments | « chrome/browser/sync/signin_manager.cc ('k') | chrome/browser/sync/signin_manager_client_login.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698