| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_CLIENT_H_ | 5 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_CLIENT_H_ |
| 6 #define COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_CLIENT_H_ | 6 #define COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_CLIENT_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/callback_list.h" |
| 9 #include "components/keyed_service/core/keyed_service.h" | 10 #include "components/keyed_service/core/keyed_service.h" |
| 10 #include "components/signin/core/browser/webdata/token_web_data.h" | 11 #include "components/signin/core/browser/webdata/token_web_data.h" |
| 11 | 12 |
| 12 class PrefService; | 13 class PrefService; |
| 13 class SigninManagerBase; | 14 class SigninManagerBase; |
| 14 class TokenWebData; | 15 class TokenWebData; |
| 15 | 16 |
| 16 namespace net { | 17 namespace net { |
| 17 class CanonicalCookie; | 18 class CanonicalCookie; |
| 18 class URLRequestContextGetter; | 19 class URLRequestContextGetter; |
| 19 } | 20 } |
| 20 | 21 |
| 21 #if defined(OS_IOS) | 22 #if defined(OS_IOS) |
| 22 namespace ios { | 23 namespace ios { |
| 23 // TODO(msarda): http://crbug.com/358544 Remove this iOS specific code from the | 24 // TODO(msarda): http://crbug.com/358544 Remove this iOS specific code from the |
| 24 // core SigninClient. | 25 // core SigninClient. |
| 25 class ProfileOAuth2TokenServiceIOSProvider; | 26 class ProfileOAuth2TokenServiceIOSProvider; |
| 26 } | 27 } |
| 27 #endif | 28 #endif |
| 28 | 29 |
| 29 // An interface that needs to be supplied to the Signin component by its | 30 // An interface that needs to be supplied to the Signin component by its |
| 30 // embedder. | 31 // embedder. |
| 31 class SigninClient : public KeyedService { | 32 class SigninClient : public KeyedService { |
| 32 public: | 33 public: |
| 33 typedef base::Callback<void(const net::CanonicalCookie* cookie)> | 34 typedef base::Callback<void(const net::CanonicalCookie* cookie)> |
| 34 CookieChangedCallback; | 35 CookieChangedCallback; |
| 35 | 36 |
| 37 typedef base::CallbackList<void(const net::CanonicalCookie* cookie)> |
| 38 CookieChangedCallbackList; |
| 39 |
| 36 virtual ~SigninClient() {} | 40 virtual ~SigninClient() {} |
| 37 | 41 |
| 38 // Gets the preferences associated with the client. | 42 // Gets the preferences associated with the client. |
| 39 virtual PrefService* GetPrefs() = 0; | 43 virtual PrefService* GetPrefs() = 0; |
| 40 | 44 |
| 41 // Gets the TokenWebData instance associated with the client. | 45 // Gets the TokenWebData instance associated with the client. |
| 42 virtual scoped_refptr<TokenWebData> GetDatabase() = 0; | 46 virtual scoped_refptr<TokenWebData> GetDatabase() = 0; |
| 43 | 47 |
| 44 // Returns whether it is possible to revoke credentials. | 48 // Returns whether it is possible to revoke credentials. |
| 45 virtual bool CanRevokeCredentials() = 0; | 49 virtual bool CanRevokeCredentials() = 0; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 58 virtual net::URLRequestContextGetter* GetURLRequestContext() = 0; | 62 virtual net::URLRequestContextGetter* GetURLRequestContext() = 0; |
| 59 | 63 |
| 60 // Returns whether the user's credentials should be merged into the cookie | 64 // Returns whether the user's credentials should be merged into the cookie |
| 61 // jar on signin completion. | 65 // jar on signin completion. |
| 62 virtual bool ShouldMergeSigninCredentialsIntoCookieJar() = 0; | 66 virtual bool ShouldMergeSigninCredentialsIntoCookieJar() = 0; |
| 63 | 67 |
| 64 // Returns a string containing the version info of the product in which the | 68 // Returns a string containing the version info of the product in which the |
| 65 // Signin component is being used. | 69 // Signin component is being used. |
| 66 virtual std::string GetProductVersion() = 0; | 70 virtual std::string GetProductVersion() = 0; |
| 67 | 71 |
| 68 // Sets the callback that should be called when a cookie changes. The | 72 // Adds or removes a callback that should be called when a cookie changes. |
| 69 // callback will be called only if it is not empty. | |
| 70 // TODO(blundell): Eliminate this interface in favor of having core signin | 73 // TODO(blundell): Eliminate this interface in favor of having core signin |
| 71 // code observe cookie changes once //chrome/browser/net has been | 74 // code observe cookie changes once //chrome/browser/net has been |
| 72 // componentized. | 75 // componentized. |
| 73 virtual void SetCookieChangedCallback( | 76 virtual scoped_ptr<CookieChangedCallbackList::Subscription> |
| 74 const CookieChangedCallback& callback) = 0; | 77 AddCookieChangedCallback(const CookieChangedCallback& callback) = 0; |
| 75 | 78 |
| 76 // Called when Google signin has succeeded. | 79 // Called when Google signin has succeeded. |
| 77 virtual void GoogleSigninSucceeded(const std::string& username, | 80 virtual void GoogleSigninSucceeded(const std::string& username, |
| 78 const std::string& password) {} | 81 const std::string& password) {} |
| 79 | 82 |
| 80 virtual void SetSigninProcess(int host_id) = 0; | 83 virtual void SetSigninProcess(int host_id) = 0; |
| 81 virtual void ClearSigninProcess() = 0; | 84 virtual void ClearSigninProcess() = 0; |
| 82 virtual bool IsSigninProcess(int host_id) const = 0; | 85 virtual bool IsSigninProcess(int host_id) const = 0; |
| 83 virtual bool HasSigninProcess() const = 0; | 86 virtual bool HasSigninProcess() const = 0; |
| 84 | 87 |
| 85 | 88 |
| 86 #if defined(OS_IOS) | 89 #if defined(OS_IOS) |
| 87 // TODO(msarda): http://crbug.com/358544 Remove this iOS specific code from | 90 // TODO(msarda): http://crbug.com/358544 Remove this iOS specific code from |
| 88 // the core SigninClient. | 91 // the core SigninClient. |
| 89 virtual ios::ProfileOAuth2TokenServiceIOSProvider* GetIOSProvider() = 0; | 92 virtual ios::ProfileOAuth2TokenServiceIOSProvider* GetIOSProvider() = 0; |
| 90 #endif | 93 #endif |
| 91 }; | 94 }; |
| 92 | 95 |
| 93 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_CLIENT_H_ | 96 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_CLIENT_H_ |
| OLD | NEW |