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

Side by Side Diff: chrome/browser/sync/signin_manager_oauth.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // The signin manager encapsulates some functionality tracking
6 // which user is signed in. When a user is signed in, a ClientLogin
7 // request is run on their behalf. Auth tokens are fetched from Google
8 // and the results are stored in the TokenService.
9
10 #ifndef CHROME_BROWSER_SYNC_SIGNIN_MANAGER_OAUTH_H_
11 #define CHROME_BROWSER_SYNC_SIGNIN_MANAGER_OAUTH_H_
12 #pragma once
13
14 #include <string>
15
16 #include "base/logging.h"
17 #include "base/memory/scoped_ptr.h"
18 #include "chrome/browser/sync/signin_manager.h"
19 #include "chrome/common/net/gaia/authentication_consumer_oauth.h"
20 #include "chrome/common/net/gaia/authentication_fetcher_oauth.h"
21 #include "chrome/common/net/gaia/google_service_auth_error.h"
22
23 class AuthenticationFetcher;
24 class Profile;
25 class PrefService;
26
27 class SigninManagerOAuth : public SigninManager, AuthenticationConsumerOAuth {
28 public:
29 static const char kSigninManagerVariantName[];
30
31 SigninManagerOAuth();
32 virtual ~SigninManagerOAuth();
33
34 // Call to register our prefs.
35 static void RegisterUserPrefs(PrefService* user_prefs);
36
37 // If user was signed in, load tokens from DB if available.
38 virtual void Initialize(Profile* profile);
39
40 // If a user is signed in, this will return their name.
41 // Otherwise, it will return an empty string.
42 const std::string& GetUsername();
43
44 // Sets the user name. Used for migrating credentials from previous system.
45 void SetUsername(const std::string& username);
46
47 // Attempt to sign in this user. If successful, set a preference indicating
48 // the signed in user and send out a notification, then start fetching tokens
49 // for the user.
50 void StartSignIn(const std::string& username,
51 const std::string& password,
52 const std::string& login_token,
53 const std::string& login_captcha);
54
55 // Used when a second factor access code was required to complete a signin
56 // attempt.
57 void ProvideSecondFactorAccessCode(const std::string& access_code);
58
59 // Sign a user out, removing the preference, erasing all keys
60 // associated with the user, and canceling all auth in progress.
61 void SignOut();
62
63 // GaiaAuthConsumer
64 virtual void OnAuthenticationSuccess(AuthenticationResult* result);
65 virtual void OnAuthenticationFailure(const GoogleServiceAuthError& error);
66 virtual void OnGetUserInfoSuccess(const std::string& key,
67 const std::string& value);
68 virtual void OnGetUserInfoKeyNotFound(const std::string& key);
69 virtual void OnGetUserInfoFailure(const GoogleServiceAuthError& error);
70
71 private:
72 Profile* profile_;
73 std::string username_;
74 std::string password_; // This is kept empty whenever possible.
75 bool had_two_factor_error_;
76 };
77
78 #endif // CHROME_BROWSER_SYNC_SIGNIN_MANAGER_OAUTH_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/signin_manager_client_login.cc ('k') | chrome/browser/sync/signin_manager_oauth.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698