| 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" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class URLRequestContextGetter; | 27 class URLRequestContextGetter; |
| 28 } | 28 } |
| 29 | 29 |
| 30 // 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 |
| 31 // embedder. | 31 // embedder. |
| 32 class SigninClient : public KeyedService { | 32 class SigninClient : public KeyedService { |
| 33 public: | 33 public: |
| 34 // The subcription for cookie changed notifications. | 34 // The subcription for cookie changed notifications. |
| 35 class CookieChangedSubscription { | 35 class CookieChangedSubscription { |
| 36 public: | 36 public: |
| 37 virtual ~CookieChangedSubscription() {}; | 37 virtual ~CookieChangedSubscription() {} |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 ~SigninClient() override {} | 40 ~SigninClient() override {} |
| 41 | 41 |
| 42 // If |for_ephemeral| is true, special kind of device ID for ephemeral users | 42 // If |for_ephemeral| is true, special kind of device ID for ephemeral users |
| 43 // is generated. | 43 // is generated. |
| 44 static std::string GenerateSigninScopedDeviceID(bool for_ephemeral); | 44 static std::string GenerateSigninScopedDeviceID(bool for_ephemeral); |
| 45 | 45 |
| 46 // Sign out. | 46 // Sign out. |
| 47 void SignOut(); | 47 void SignOut(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 virtual void OnSignedIn(const std::string& account_id, | 90 virtual void OnSignedIn(const std::string& account_id, |
| 91 const std::string& gaia_id, | 91 const std::string& gaia_id, |
| 92 const std::string& username, | 92 const std::string& username, |
| 93 const std::string& password) {} | 93 const std::string& password) {} |
| 94 | 94 |
| 95 // Called after Google signin has succeeded and GetUserInfo has returned. | 95 // Called after Google signin has succeeded and GetUserInfo has returned. |
| 96 virtual void PostSignedIn(const std::string& account_id, | 96 virtual void PostSignedIn(const std::string& account_id, |
| 97 const std::string& username, | 97 const std::string& username, |
| 98 const std::string& password) {} | 98 const std::string& password) {} |
| 99 | 99 |
| 100 // Called before Google signout started, call |sign_out| to start the sign out |
| 101 // process. |
| 102 virtual void PreSignOut(const base::Callback<void()>& sign_out); |
| 103 |
| 100 virtual bool IsFirstRun() const = 0; | 104 virtual bool IsFirstRun() const = 0; |
| 101 virtual base::Time GetInstallDate() = 0; | 105 virtual base::Time GetInstallDate() = 0; |
| 102 | 106 |
| 103 // Returns true if GAIA cookies are allowed in the content area. | 107 // Returns true if GAIA cookies are allowed in the content area. |
| 104 virtual bool AreSigninCookiesAllowed() = 0; | 108 virtual bool AreSigninCookiesAllowed() = 0; |
| 105 | 109 |
| 106 // Adds an observer to listen for changes to the state of sign in cookie | 110 // Adds an observer to listen for changes to the state of sign in cookie |
| 107 // settings. | 111 // settings. |
| 108 virtual void AddContentSettingsObserver( | 112 virtual void AddContentSettingsObserver( |
| 109 content_settings::Observer* observer) = 0; | 113 content_settings::Observer* observer) = 0; |
| 110 virtual void RemoveContentSettingsObserver( | 114 virtual void RemoveContentSettingsObserver( |
| 111 content_settings::Observer* observer) = 0; | 115 content_settings::Observer* observer) = 0; |
| 112 | 116 |
| 113 // Execute |callback| if and when there is a network connection. | 117 // Execute |callback| if and when there is a network connection. |
| 114 virtual void DelayNetworkCall(const base::Closure& callback) = 0; | 118 virtual void DelayNetworkCall(const base::Closure& callback) = 0; |
| 115 | 119 |
| 116 // Creates and returns a new platform-specific GaiaAuthFetcher. It is the | 120 // Creates and returns a new platform-specific GaiaAuthFetcher. It is the |
| 117 // responsability of the caller to delete the returned object. | 121 // responsability of the caller to delete the returned object. |
| 118 virtual GaiaAuthFetcher* CreateGaiaAuthFetcher( | 122 virtual GaiaAuthFetcher* CreateGaiaAuthFetcher( |
| 119 GaiaAuthConsumer* consumer, | 123 GaiaAuthConsumer* consumer, |
| 120 const std::string& source, | 124 const std::string& source, |
| 121 net::URLRequestContextGetter* getter) = 0; | 125 net::URLRequestContextGetter* getter) = 0; |
| 122 | 126 |
| 127 // Called once the credentials has been copied to another SigninManager. |
| 128 virtual void AfterCredentialsCopied() {} |
| 129 |
| 123 protected: | 130 protected: |
| 124 // Returns device id that is scoped to single signin. | 131 // Returns device id that is scoped to single signin. |
| 125 // Stores the ID in the kGoogleServicesSigninScopedDeviceId pref. | 132 // Stores the ID in the kGoogleServicesSigninScopedDeviceId pref. |
| 126 std::string GetOrCreateScopedDeviceIdPref(PrefService* prefs); | 133 std::string GetOrCreateScopedDeviceIdPref(PrefService* prefs); |
| 127 | 134 |
| 128 private: | 135 private: |
| 129 // Perform Chrome-specific sign out. This happens when user signs out or about | 136 // Perform Chrome-specific sign out. This happens when user signs out or about |
| 130 // to sign in. | 137 // to sign in. |
| 131 // This method should not be called from the outside of SigninClient. External | 138 // This method should not be called from the outside of SigninClient. External |
| 132 // callers must use SignOut() instead. | 139 // callers must use SignOut() instead. |
| 133 virtual void OnSignedOut() = 0; | 140 virtual void OnSignedOut() = 0; |
| 134 }; | 141 }; |
| 135 | 142 |
| 136 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_CLIENT_H_ | 143 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_CLIENT_H_ |
| OLD | NEW |