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

Side by Side Diff: chrome/browser/sync/signin_manager.h

Issue 7121014: When a user logs into sync, the appropriate cookies are retrieved so that (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fixing merge issue that caused previous trybots to fail Created 9 years, 6 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
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/sync/signin_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // The signin manager encapsulates some functionality tracking 5 // The signin manager encapsulates some functionality tracking
6 // which user is signed in. When a user is signed in, a ClientLogin 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 7 // request is run on their behalf. Auth tokens are fetched from Google
8 // and the results are stored in the TokenService. 8 // and the results are stored in the TokenService.
9 9
10 #ifndef CHROME_BROWSER_SYNC_SIGNIN_MANAGER_H_ 10 #ifndef CHROME_BROWSER_SYNC_SIGNIN_MANAGER_H_
11 #define CHROME_BROWSER_SYNC_SIGNIN_MANAGER_H_ 11 #define CHROME_BROWSER_SYNC_SIGNIN_MANAGER_H_
12 #pragma once 12 #pragma once
13 13
14 #include <string> 14 #include <string>
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "chrome/common/net/gaia/gaia_auth_consumer.h" 17 #include "chrome/common/net/gaia/gaia_auth_consumer.h"
18 #include "chrome/common/net/gaia/google_service_auth_error.h" 18 #include "chrome/common/net/gaia/google_service_auth_error.h"
19 #include "content/common/notification_observer.h"
20 #include "content/common/notification_registrar.h"
19 21
20 class GaiaAuthFetcher; 22 class GaiaAuthFetcher;
21 class Profile; 23 class Profile;
22 class PrefService; 24 class PrefService;
23 25
24 // Details for the Notification type GOOGLE_SIGNIN_SUCCESSFUL. 26 // Details for the Notification type GOOGLE_SIGNIN_SUCCESSFUL.
25 // A listener might use this to make note of a username / password 27 // A listener might use this to make note of a username / password
26 // pair for encryption keys. 28 // pair for encryption keys.
27 struct GoogleServiceSigninSuccessDetails { 29 struct GoogleServiceSigninSuccessDetails {
28 GoogleServiceSigninSuccessDetails(const std::string& in_username, 30 GoogleServiceSigninSuccessDetails(const std::string& in_username,
29 const std::string& in_password) 31 const std::string& in_password)
30 : username(in_username), 32 : username(in_username),
31 password(in_password) {} 33 password(in_password) {}
32 std::string username; 34 std::string username;
33 std::string password; 35 std::string password;
34 }; 36 };
35 37
38 #if !defined(OS_CHROMEOS)
39 class SigninManager : public GaiaAuthConsumer ,
40 public NotificationObserver {
41 #else
36 class SigninManager : public GaiaAuthConsumer { 42 class SigninManager : public GaiaAuthConsumer {
43 #endif
44
37 public: 45 public:
38 SigninManager(); 46 SigninManager();
39 virtual ~SigninManager(); 47 virtual ~SigninManager();
40 48
41 // Call to register our prefs. 49 // Call to register our prefs.
42 static void RegisterUserPrefs(PrefService* user_prefs); 50 static void RegisterUserPrefs(PrefService* user_prefs);
43 51
44 // If user was signed in, load tokens from DB if available. 52 // If user was signed in, load tokens from DB if available.
45 void Initialize(Profile* profile); 53 void Initialize(Profile* profile);
46 54
(...skipping 21 matching lines...) Expand all
68 void SignOut(); 76 void SignOut();
69 77
70 // GaiaAuthConsumer 78 // GaiaAuthConsumer
71 virtual void OnClientLoginSuccess(const ClientLoginResult& result); 79 virtual void OnClientLoginSuccess(const ClientLoginResult& result);
72 virtual void OnClientLoginFailure(const GoogleServiceAuthError& error); 80 virtual void OnClientLoginFailure(const GoogleServiceAuthError& error);
73 virtual void OnGetUserInfoSuccess(const std::string& key, 81 virtual void OnGetUserInfoSuccess(const std::string& key,
74 const std::string& value); 82 const std::string& value);
75 virtual void OnGetUserInfoKeyNotFound(const std::string& key); 83 virtual void OnGetUserInfoKeyNotFound(const std::string& key);
76 virtual void OnGetUserInfoFailure(const GoogleServiceAuthError& error); 84 virtual void OnGetUserInfoFailure(const GoogleServiceAuthError& error);
77 85
86 #if !defined(OS_CHROMEOS)
tim (not reviewing) 2011/06/14 13:18:29 maybe we should create a const in browser/defaults
Roger Tawa OOO till Jul 10th 2011/06/14 18:42:43 I don't want to compile any of this code in the ca
87 // NotificationObserver
88 virtual void Observe(NotificationType type,
89 const NotificationSource& source,
90 const NotificationDetails& details);
91 #endif
92
78 private: 93 private:
79 Profile* profile_; 94 Profile* profile_;
80 std::string username_; 95 std::string username_;
81 std::string password_; // This is kept empty whenever possible. 96 std::string password_; // This is kept empty whenever possible.
82 bool had_two_factor_error_; 97 bool had_two_factor_error_;
83 98
84 // Result of the last client login, kept pending the lookup of the 99 // Result of the last client login, kept pending the lookup of the
85 // canonical email. 100 // canonical email.
86 ClientLoginResult last_result_; 101 ClientLoginResult last_result_;
87 102
88 // Actual client login handler. 103 // Actual client login handler.
89 scoped_ptr<GaiaAuthFetcher> client_login_; 104 scoped_ptr<GaiaAuthFetcher> client_login_;
105
106 #if !defined(OS_CHROMEOS)
107 // Register for notifications from the TokenService.
108 NotificationRegistrar registrar_;
109 #endif
90 }; 110 };
91 111
92 #endif // CHROME_BROWSER_SYNC_SIGNIN_MANAGER_H_ 112 #endif // CHROME_BROWSER_SYNC_SIGNIN_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/sync/signin_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698