Chromium Code Reviews| 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 "base/callback_list.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "components/keyed_service/core/keyed_service.h" | 11 #include "components/keyed_service/core/keyed_service.h" |
| 12 #include "components/signin/core/browser/webdata/token_web_data.h" | 12 #include "components/signin/core/browser/webdata/token_web_data.h" |
| 13 #include "net/cookies/cookie_store.h" | |
| 14 #include "url/gurl.h" | |
| 13 | 15 |
| 14 class PrefService; | 16 class PrefService; |
| 15 class SigninManagerBase; | 17 class SigninManagerBase; |
| 16 class TokenWebData; | 18 class TokenWebData; |
| 17 | 19 |
| 18 namespace net { | 20 namespace net { |
| 19 class CanonicalCookie; | |
| 20 class URLRequestContextGetter; | 21 class URLRequestContextGetter; |
| 21 } | 22 } |
| 22 | 23 |
| 23 #if defined(OS_IOS) | 24 #if defined(OS_IOS) |
| 24 namespace ios { | 25 namespace ios { |
| 25 // TODO(msarda): http://crbug.com/358544 Remove this iOS specific code from the | 26 // TODO(msarda): http://crbug.com/358544 Remove this iOS specific code from the |
| 26 // core SigninClient. | 27 // core SigninClient. |
| 27 class ProfileOAuth2TokenServiceIOSProvider; | 28 class ProfileOAuth2TokenServiceIOSProvider; |
| 28 } | 29 } |
| 29 #endif | 30 #endif |
| 30 | 31 |
| 31 // An interface that needs to be supplied to the Signin component by its | 32 // An interface that needs to be supplied to the Signin component by its |
| 32 // embedder. | 33 // embedder. |
| 33 class SigninClient : public KeyedService { | 34 class SigninClient : public KeyedService { |
| 34 public: | 35 public: |
| 35 typedef base::Callback<void(const net::CanonicalCookie* cookie)> | 36 // The subcription for cookie changed notifications. |
|
droger
2014/10/31 12:42:01
Indent.
msarda
2014/10/31 13:18:40
Done.
| |
| 36 CookieChangedCallback; | 37 class CookieChangedSubscription { |
|
droger
2014/10/31 12:42:01
Do we need this class?
An alternative to this wou
msarda
2014/10/31 13:18:40
This interface lives in //components. The implemen
droger
2014/10/31 13:56:09
The implementation could be in components too (I k
| |
| 37 | 38 public: |
| 38 typedef base::CallbackList<void(const net::CanonicalCookie* cookie)> | 39 virtual ~CookieChangedSubscription() {}; |
|
droger
2014/10/31 12:42:01
Should this be pure virtual?
msarda
2014/10/31 13:18:40
I tried this yesterday and it did not build. What
droger
2014/10/31 13:56:09
I thought it would be nice to prevent people to in
| |
| 39 CookieChangedCallbackList; | 40 }; |
| 40 | 41 |
| 41 ~SigninClient() override {} | 42 ~SigninClient() override {} |
| 42 | 43 |
| 43 // Gets the preferences associated with the client. | 44 // Gets the preferences associated with the client. |
| 44 virtual PrefService* GetPrefs() = 0; | 45 virtual PrefService* GetPrefs() = 0; |
| 45 | 46 |
| 46 // Gets the TokenWebData instance associated with the client. | 47 // Gets the TokenWebData instance associated with the client. |
| 47 virtual scoped_refptr<TokenWebData> GetDatabase() = 0; | 48 virtual scoped_refptr<TokenWebData> GetDatabase() = 0; |
| 48 | 49 |
| 49 // Returns whether it is possible to revoke credentials. | 50 // Returns whether it is possible to revoke credentials. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 63 virtual net::URLRequestContextGetter* GetURLRequestContext() = 0; | 64 virtual net::URLRequestContextGetter* GetURLRequestContext() = 0; |
| 64 | 65 |
| 65 // Returns whether the user's credentials should be merged into the cookie | 66 // Returns whether the user's credentials should be merged into the cookie |
| 66 // jar on signin completion. | 67 // jar on signin completion. |
| 67 virtual bool ShouldMergeSigninCredentialsIntoCookieJar() = 0; | 68 virtual bool ShouldMergeSigninCredentialsIntoCookieJar() = 0; |
| 68 | 69 |
| 69 // Returns a string containing the version info of the product in which the | 70 // Returns a string containing the version info of the product in which the |
| 70 // Signin component is being used. | 71 // Signin component is being used. |
| 71 virtual std::string GetProductVersion() = 0; | 72 virtual std::string GetProductVersion() = 0; |
| 72 | 73 |
| 73 // Adds or removes a callback that should be called when a cookie changes. | 74 // Adds a callback to be called each time a cookie for |url| with name |name| |
| 74 // TODO(blundell): Eliminate this interface in favor of having core signin | 75 // changes. |
| 75 // code observe cookie changes once //chrome/browser/net has been | 76 // Note that |callback| will always be called on the thread that |
| 76 // componentized. | 77 // |AddCookieChangedCallback| was called on. |
| 77 virtual scoped_ptr<CookieChangedCallbackList::Subscription> | 78 virtual scoped_ptr<CookieChangedSubscription> AddCookieChangedCallback( |
| 78 AddCookieChangedCallback(const CookieChangedCallback& callback) = 0; | 79 const GURL& url, |
| 80 const std::string& name, | |
| 81 const net::CookieStore::CookieChangedCallback& callback) = 0; | |
| 79 | 82 |
| 80 // Called when Google signin has succeeded. | 83 // Called when Google signin has succeeded. |
| 81 virtual void GoogleSigninSucceeded(const std::string& account_id, | 84 virtual void GoogleSigninSucceeded(const std::string& account_id, |
| 82 const std::string& username, | 85 const std::string& username, |
| 83 const std::string& password) {} | 86 const std::string& password) {} |
| 84 | 87 |
| 85 virtual void SetSigninProcess(int host_id) = 0; | 88 virtual void SetSigninProcess(int host_id) = 0; |
| 86 virtual void ClearSigninProcess() = 0; | 89 virtual void ClearSigninProcess() = 0; |
| 87 virtual bool IsSigninProcess(int host_id) const = 0; | 90 virtual bool IsSigninProcess(int host_id) const = 0; |
| 88 virtual bool HasSigninProcess() const = 0; | 91 virtual bool HasSigninProcess() const = 0; |
| 89 | 92 |
| 90 virtual bool IsFirstRun() const = 0; | 93 virtual bool IsFirstRun() const = 0; |
| 91 virtual base::Time GetInstallDate() = 0; | 94 virtual base::Time GetInstallDate() = 0; |
| 92 | 95 |
| 93 #if defined(OS_IOS) | 96 #if defined(OS_IOS) |
| 94 // TODO(msarda): http://crbug.com/358544 Remove this iOS specific code from | 97 // TODO(msarda): http://crbug.com/358544 Remove this iOS specific code from |
| 95 // the core SigninClient. | 98 // the core SigninClient. |
| 96 virtual ios::ProfileOAuth2TokenServiceIOSProvider* GetIOSProvider() = 0; | 99 virtual ios::ProfileOAuth2TokenServiceIOSProvider* GetIOSProvider() = 0; |
| 97 #endif | 100 #endif |
| 98 }; | 101 }; |
| 99 | 102 |
| 100 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_CLIENT_H_ | 103 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_CLIENT_H_ |
| OLD | NEW |