| 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 28 matching lines...) Expand all  Loading... | 
| 39 #include "content/public/browser/notification_registrar.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 SigninGlobalError; | 48 class SigninGlobalError; | 
|  | 49 class SigninManagerDelegate; | 
| 49 | 50 | 
| 50 class SigninManager : public SigninManagerBase, | 51 class SigninManager : public SigninManagerBase, | 
| 51                       public GaiaAuthConsumer, | 52                       public GaiaAuthConsumer, | 
| 52                       public UbertokenConsumer, | 53                       public UbertokenConsumer, | 
| 53                       public content::NotificationObserver { | 54                       public content::NotificationObserver { | 
| 54  public: | 55  public: | 
| 55   // 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, | 
| 56   // 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 | 
| 57   // callers to load policy and prompt the user appropriately before completing | 58   // callers to load policy and prompt the user appropriately before completing | 
| 58   // 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. | 
| 59   typedef base::Callback<void(const std::string&)> OAuthTokenFetchedCallback; | 60   typedef base::Callback<void(const std::string&)> OAuthTokenFetchedCallback; | 
| 60 | 61 | 
| 61   // 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 | 
| 62   // isolated, privileged signin process. | 63   // isolated, privileged signin process. | 
| 63   static bool IsWebBasedSigninFlowURL(const GURL& url); | 64   static bool IsWebBasedSigninFlowURL(const GURL& url); | 
| 64 | 65 | 
| 65   // 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 | 
| 66   // 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. | 
| 67   // 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 | 
| 68   // this scheme; enforcement of privileges is handled separately by | 69   // this scheme; enforcement of privileges is handled separately by | 
| 69   // OneClickSigninHelper. | 70   // OneClickSigninHelper. | 
| 70   static const char* kChromeSigninEffectiveSite; | 71   static const char* kChromeSigninEffectiveSite; | 
| 71 | 72 | 
| 72   SigninManager(); | 73   explicit SigninManager(scoped_ptr<SigninManagerDelegate> delegate); | 
| 73   virtual ~SigninManager(); | 74   virtual ~SigninManager(); | 
| 74 | 75 | 
| 75   // Attempt to sign in this user with ClientLogin. If successful, set a | 76   // Attempt to sign in this user with ClientLogin. If successful, set a | 
| 76   // preference indicating the signed in user and send out a notification, | 77   // preference indicating the signed in user and send out a notification, | 
| 77   // then start fetching tokens for the user. | 78   // then start fetching tokens for the user. | 
| 78   // This is overridden for test subclasses that don't want to issue auth | 79   // This is overridden for test subclasses that don't want to issue auth | 
| 79   // requests. | 80   // requests. | 
| 80   virtual void StartSignIn(const std::string& username, | 81   virtual void StartSignIn(const std::string& username, | 
| 81                            const std::string& password, | 82                            const std::string& password, | 
| 82                            const std::string& login_token, | 83                            const std::string& login_token, | 
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 258   base::WeakPtrFactory<SigninManager> weak_pointer_factory_; | 259   base::WeakPtrFactory<SigninManager> weak_pointer_factory_; | 
| 259 | 260 | 
| 260   // See SetSigninProcess.  Tracks the currently active signin process | 261   // See SetSigninProcess.  Tracks the currently active signin process | 
| 261   // by ID, if there is one. | 262   // by ID, if there is one. | 
| 262   int signin_process_id_; | 263   int signin_process_id_; | 
| 263 | 264 | 
| 264   // Callback invoked during signin after an OAuth token has been fetched | 265   // Callback invoked during signin after an OAuth token has been fetched | 
| 265   // but before signin is complete. | 266   // but before signin is complete. | 
| 266   OAuthTokenFetchedCallback oauth_token_fetched_callback_; | 267   OAuthTokenFetchedCallback oauth_token_fetched_callback_; | 
| 267 | 268 | 
|  | 269   scoped_ptr<SigninManagerDelegate> delegate_; | 
|  | 270 | 
| 268   DISALLOW_COPY_AND_ASSIGN(SigninManager); | 271   DISALLOW_COPY_AND_ASSIGN(SigninManager); | 
| 269 }; | 272 }; | 
| 270 | 273 | 
| 271 #endif  // !defined(OS_CHROMEOS) | 274 #endif  // !defined(OS_CHROMEOS) | 
| 272 | 275 | 
| 273 #endif  // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ | 276 #endif  // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ | 
| OLD | NEW | 
|---|