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

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

Issue 126613002: Remove RenderProcessHost notifications from the signin manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 11 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 | « no previous file | chrome/browser/signin/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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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. See SigninManagerBase for full description of 6 // which user is signed in. See SigninManagerBase for full description of
7 // responsibilities. The class defined in this file provides functionality 7 // responsibilities. The class defined in this file provides functionality
8 // required by all platforms except Chrome OS. 8 // required by all platforms except Chrome OS.
9 // 9 //
10 // When a user is signed in, a ClientLogin request is run on their behalf. 10 // When a user is signed in, a ClientLogin request is run on their behalf.
11 // Auth tokens are fetched from Google and the results are stored in the 11 // Auth tokens are fetched from Google and the results are stored in the
12 // TokenService. 12 // TokenService.
13 // TODO(tim): Bug 92948, 226464. ClientLogin is all but gone from use. 13 // TODO(tim): Bug 92948, 226464. ClientLogin is all but gone from use.
14 14
15 #ifndef CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ 15 #ifndef CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_
16 #define CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ 16 #define CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_
17 17
18 #if defined(OS_CHROMEOS) 18 #if defined(OS_CHROMEOS)
19 // On Chrome OS, SigninManagerBase is all that exists. 19 // On Chrome OS, SigninManagerBase is all that exists.
20 #include "chrome/browser/signin/signin_manager_base.h" 20 #include "chrome/browser/signin/signin_manager_base.h"
21 21
22 #else 22 #else
23 23
24 #include <set>
24 #include <string> 25 #include <string>
25 26
26 #include "base/compiler_specific.h" 27 #include "base/compiler_specific.h"
27 #include "base/gtest_prod_util.h" 28 #include "base/gtest_prod_util.h"
28 #include "base/logging.h" 29 #include "base/logging.h"
29 #include "base/memory/scoped_ptr.h" 30 #include "base/memory/scoped_ptr.h"
30 #include "base/observer_list.h" 31 #include "base/observer_list.h"
31 #include "base/prefs/pref_change_registrar.h" 32 #include "base/prefs/pref_change_registrar.h"
32 #include "base/prefs/pref_member.h" 33 #include "base/prefs/pref_member.h"
33 #include "chrome/browser/profiles/profile.h" 34 #include "chrome/browser/profiles/profile.h"
34 #include "chrome/browser/signin/google_auto_login_helper.h" 35 #include "chrome/browser/signin/google_auto_login_helper.h"
35 #include "chrome/browser/signin/signin_internals_util.h" 36 #include "chrome/browser/signin/signin_internals_util.h"
36 #include "chrome/browser/signin/signin_manager_base.h" 37 #include "chrome/browser/signin/signin_manager_base.h"
37 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 38 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
38 #include "content/public/browser/notification_observer.h" 39 #include "content/public/browser/render_process_host_observer.h"
39 #include "content/public/browser/notification_registrar.h"
40 #include "google_apis/gaia/gaia_auth_consumer.h" 40 #include "google_apis/gaia/gaia_auth_consumer.h"
41 #include "google_apis/gaia/google_service_auth_error.h" 41 #include "google_apis/gaia/google_service_auth_error.h"
42 #include "net/cookies/canonical_cookie.h" 42 #include "net/cookies/canonical_cookie.h"
43 43
44 class CookieSettings; 44 class CookieSettings;
45 class GaiaAuthFetcher; 45 class GaiaAuthFetcher;
46 class ProfileIOData; 46 class ProfileIOData;
47 class PrefService; 47 class PrefService;
48 class SigninAccountIdHelper; 48 class SigninAccountIdHelper;
49 class SigninGlobalError; 49 class SigninGlobalError;
50 class SigninManagerDelegate; 50 class SigninManagerDelegate;
51 51
52 class SigninManager : public SigninManagerBase, 52 class SigninManager : public SigninManagerBase,
53 public GaiaAuthConsumer, 53 public GaiaAuthConsumer,
54 public content::NotificationObserver { 54 public content::RenderProcessHostObserver {
55 public: 55 public:
56 // The callback invoked once the OAuth token has been fetched during signin, 56 // The callback invoked once the OAuth token has been fetched during signin,
57 // but before the profile transitions to the "signed-in" state. This allows 57 // but before the profile transitions to the "signed-in" state. This allows
58 // callers to load policy and prompt the user appropriately before completing 58 // callers to load policy and prompt the user appropriately before completing
59 // signin. The callback is passed the just-fetched OAuth login refresh token. 59 // signin. The callback is passed the just-fetched OAuth login refresh token.
60 typedef base::Callback<void(const std::string&)> OAuthTokenFetchedCallback; 60 typedef base::Callback<void(const std::string&)> OAuthTokenFetchedCallback;
61 61
62 // Returns true if |url| is a web signin URL and should be hosted in an 62 // Returns true if |url| is a web signin URL and should be hosted in an
63 // isolated, privileged signin process. 63 // isolated, privileged signin process.
64 static bool IsWebBasedSigninFlowURL(const GURL& url); 64 static bool IsWebBasedSigninFlowURL(const GURL& url);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 virtual void OnClientLoginSuccess(const ClientLoginResult& result) OVERRIDE; 149 virtual void OnClientLoginSuccess(const ClientLoginResult& result) OVERRIDE;
150 virtual void OnClientLoginFailure( 150 virtual void OnClientLoginFailure(
151 const GoogleServiceAuthError& error) OVERRIDE; 151 const GoogleServiceAuthError& error) OVERRIDE;
152 virtual void OnClientOAuthSuccess(const ClientOAuthResult& result) OVERRIDE; 152 virtual void OnClientOAuthSuccess(const ClientOAuthResult& result) OVERRIDE;
153 virtual void OnClientOAuthFailure( 153 virtual void OnClientOAuthFailure(
154 const GoogleServiceAuthError& error) OVERRIDE; 154 const GoogleServiceAuthError& error) OVERRIDE;
155 virtual void OnGetUserInfoSuccess(const UserInfoMap& data) OVERRIDE; 155 virtual void OnGetUserInfoSuccess(const UserInfoMap& data) OVERRIDE;
156 virtual void OnGetUserInfoFailure( 156 virtual void OnGetUserInfoFailure(
157 const GoogleServiceAuthError& error) OVERRIDE; 157 const GoogleServiceAuthError& error) OVERRIDE;
158 158
159 // content::NotificationObserver 159 // content::RenderProcessHostObserver
160 virtual void Observe(int type, 160 virtual void RenderProcessHostDestroyed(
161 const content::NotificationSource& source, 161 content::RenderProcessHost* host) OVERRIDE;
162 const content::NotificationDetails& details) OVERRIDE;
163 162
164 // Tells the SigninManager whether to prohibit signout for this profile. 163 // Tells the SigninManager whether to prohibit signout for this profile.
165 // If |prohibit_signout| is true, then signout will be prohibited. 164 // If |prohibit_signout| is true, then signout will be prohibited.
166 void ProhibitSignout(bool prohibit_signout); 165 void ProhibitSignout(bool prohibit_signout);
167 166
168 // If true, signout is prohibited for this profile (calls to SignOut() are 167 // If true, signout is prohibited for this profile (calls to SignOut() are
169 // ignored). 168 // ignored).
170 bool IsSignoutProhibited() const; 169 bool IsSignoutProhibited() const;
171 170
172 // Checks if signin is allowed for the profile that owns |io_data|. This must 171 // Checks if signin is allowed for the profile that owns |io_data|. This must
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 std::string password_; // This is kept empty whenever possible. 250 std::string password_; // This is kept empty whenever possible.
252 bool had_two_factor_error_; 251 bool had_two_factor_error_;
253 252
254 // Result of the last client login, kept pending the lookup of the 253 // Result of the last client login, kept pending the lookup of the
255 // canonical email. 254 // canonical email.
256 ClientLoginResult last_result_; 255 ClientLoginResult last_result_;
257 256
258 // Actual client login handler. 257 // Actual client login handler.
259 scoped_ptr<GaiaAuthFetcher> client_login_; 258 scoped_ptr<GaiaAuthFetcher> client_login_;
260 259
261 // Registrar for notifications from the TokenService.
262 content::NotificationRegistrar registrar_;
263
264 // OAuth revocation fetcher for sign outs. 260 // OAuth revocation fetcher for sign outs.
265 scoped_ptr<GaiaAuthFetcher> revoke_token_fetcher_; 261 scoped_ptr<GaiaAuthFetcher> revoke_token_fetcher_;
266 262
267 // Fetcher for the obfuscated user id. 263 // Fetcher for the obfuscated user id.
268 scoped_ptr<SigninAccountIdHelper> account_id_helper_; 264 scoped_ptr<SigninAccountIdHelper> account_id_helper_;
269 265
270 // The type of sign being performed. This value is valid only between a call 266 // The type of sign being performed. This value is valid only between a call
271 // to one of the StartSigninXXX methods and when the sign in is either 267 // to one of the StartSigninXXX methods and when the sign in is either
272 // successful or not. 268 // successful or not.
273 SigninType type_; 269 SigninType type_;
274 270
275 // Temporarily saves the oauth2 refresh and access tokens when signing in 271 // Temporarily saves the oauth2 refresh and access tokens when signing in
276 // with credentials. These will be passed to TokenService so that it does 272 // with credentials. These will be passed to TokenService so that it does
277 // not need to mint new ones. 273 // not need to mint new ones.
278 ClientOAuthResult temp_oauth_login_tokens_; 274 ClientOAuthResult temp_oauth_login_tokens_;
279 275
280 base::WeakPtrFactory<SigninManager> weak_pointer_factory_; 276 base::WeakPtrFactory<SigninManager> weak_pointer_factory_;
281 277
282 // See SetSigninProcess. Tracks the currently active signin process 278 // See SetSigninProcess. Tracks the currently active signin process
283 // by ID, if there is one. 279 // by ID, if there is one.
284 int signin_host_id_; 280 int signin_host_id_;
285 281
282 // The RenderProcessHosts being observed.
283 std::set<content::RenderProcessHost*> signin_hosts_observed_;
284
286 // Callback invoked during signin after an OAuth token has been fetched 285 // Callback invoked during signin after an OAuth token has been fetched
287 // but before signin is complete. 286 // but before signin is complete.
288 OAuthTokenFetchedCallback oauth_token_fetched_callback_; 287 OAuthTokenFetchedCallback oauth_token_fetched_callback_;
289 288
290 scoped_ptr<SigninManagerDelegate> delegate_; 289 scoped_ptr<SigninManagerDelegate> delegate_;
291 290
292 // Helper object to listen for changes to signin preferences stored in non- 291 // Helper object to listen for changes to signin preferences stored in non-
293 // profile-specific local prefs (like kGoogleServicesUsernamePattern). 292 // profile-specific local prefs (like kGoogleServicesUsernamePattern).
294 PrefChangeRegistrar local_state_pref_registrar_; 293 PrefChangeRegistrar local_state_pref_registrar_;
295 294
296 // Helper object to listen for changes to the signin allowed preference. 295 // Helper object to listen for changes to the signin allowed preference.
297 BooleanPrefMember signin_allowed_; 296 BooleanPrefMember signin_allowed_;
298 297
299 // Helper to merge signed in account into the content area. 298 // Helper to merge signed in account into the content area.
300 scoped_ptr<GoogleAutoLoginHelper> merge_session_helper_; 299 scoped_ptr<GoogleAutoLoginHelper> merge_session_helper_;
301 300
302 DISALLOW_COPY_AND_ASSIGN(SigninManager); 301 DISALLOW_COPY_AND_ASSIGN(SigninManager);
303 }; 302 };
304 303
305 #endif // !defined(OS_CHROMEOS) 304 #endif // !defined(OS_CHROMEOS)
306 305
307 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ 306 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/signin/signin_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698