OLD | NEW |
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. |
(...skipping 29 matching lines...) Expand all Loading... |
40 #include "google_apis/gaia/google_service_auth_error.h" | 40 #include "google_apis/gaia/google_service_auth_error.h" |
41 #include "google_apis/gaia/merge_session_helper.h" | 41 #include "google_apis/gaia/merge_session_helper.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 SigninClient; |
51 | 51 |
52 class SigninManager : public SigninManagerBase, | 52 class SigninManager : public SigninManagerBase, |
53 public GaiaAuthConsumer, | 53 public GaiaAuthConsumer, |
54 public content::RenderProcessHostObserver { | 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); |
65 | 65 |
66 // This is used to distinguish URLs belonging to the special web signin flow | 66 // This is used to distinguish URLs belonging to the special web signin flow |
67 // running in the special signin process from other URLs on the same domain. | 67 // running in the special signin process from other URLs on the same domain. |
68 // We do not grant WebUI privilieges / bindings to this process or to URLs of | 68 // We do not grant WebUI privilieges / bindings to this process or to URLs of |
69 // this scheme; enforcement of privileges is handled separately by | 69 // this scheme; enforcement of privileges is handled separately by |
70 // OneClickSigninHelper. | 70 // OneClickSigninHelper. |
71 static const char* kChromeSigninEffectiveSite; | 71 static const char* kChromeSigninEffectiveSite; |
72 | 72 |
73 explicit SigninManager(scoped_ptr<SigninManagerDelegate> delegate); | 73 explicit SigninManager(scoped_ptr<SigninClient> client); |
74 virtual ~SigninManager(); | 74 virtual ~SigninManager(); |
75 | 75 |
76 // Returns true if the username is allowed based on the policy string. | 76 // Returns true if the username is allowed based on the policy string. |
77 static bool IsUsernameAllowedByPolicy(const std::string& username, | 77 static bool IsUsernameAllowedByPolicy(const std::string& username, |
78 const std::string& policy); | 78 const std::string& policy); |
79 | 79 |
80 // Attempt to sign in this user with existing credentials from the cookie jar. | 80 // Attempt to sign in this user with existing credentials from the cookie jar. |
81 // |session_index| indicates which user account to use if the cookie jar | 81 // |session_index| indicates which user account to use if the cookie jar |
82 // contains a multi-login session. Otherwise the end result of this call is | 82 // contains a multi-login session. Otherwise the end result of this call is |
83 // the same as StartSignIn(). | 83 // the same as StartSignIn(). |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 // by ID, if there is one. | 279 // by ID, if there is one. |
280 int signin_host_id_; | 280 int signin_host_id_; |
281 | 281 |
282 // The RenderProcessHosts being observed. | 282 // The RenderProcessHosts being observed. |
283 std::set<content::RenderProcessHost*> signin_hosts_observed_; | 283 std::set<content::RenderProcessHost*> signin_hosts_observed_; |
284 | 284 |
285 // Callback invoked during signin after an OAuth token has been fetched | 285 // Callback invoked during signin after an OAuth token has been fetched |
286 // but before signin is complete. | 286 // but before signin is complete. |
287 OAuthTokenFetchedCallback oauth_token_fetched_callback_; | 287 OAuthTokenFetchedCallback oauth_token_fetched_callback_; |
288 | 288 |
289 scoped_ptr<SigninManagerDelegate> delegate_; | 289 scoped_ptr<SigninClient> client_; |
290 | 290 |
291 // 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- |
292 // profile-specific local prefs (like kGoogleServicesUsernamePattern). | 292 // profile-specific local prefs (like kGoogleServicesUsernamePattern). |
293 PrefChangeRegistrar local_state_pref_registrar_; | 293 PrefChangeRegistrar local_state_pref_registrar_; |
294 | 294 |
295 // Helper object to listen for changes to the signin allowed preference. | 295 // Helper object to listen for changes to the signin allowed preference. |
296 BooleanPrefMember signin_allowed_; | 296 BooleanPrefMember signin_allowed_; |
297 | 297 |
298 // Helper to merge signed in account into the content area. | 298 // Helper to merge signed in account into the content area. |
299 scoped_ptr<MergeSessionHelper> merge_session_helper_; | 299 scoped_ptr<MergeSessionHelper> merge_session_helper_; |
300 | 300 |
301 DISALLOW_COPY_AND_ASSIGN(SigninManager); | 301 DISALLOW_COPY_AND_ASSIGN(SigninManager); |
302 }; | 302 }; |
303 | 303 |
304 #endif // !defined(OS_CHROMEOS) | 304 #endif // !defined(OS_CHROMEOS) |
305 | 305 |
306 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ | 306 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ |
OLD | NEW |