| 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 CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_CLIENT_H_ |
| 6 #define CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_CLIENT_H_ | 6 #define CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_CLIENT_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "components/signin/core/browser/signin_client.h" | 10 #include "components/signin/core/browser/signin_client.h" |
| 11 #include "components/signin/core/browser/signin_error_controller.h" | 11 #include "components/signin/core/browser/signin_error_controller.h" |
| 12 #include "content/public/browser/render_process_host_observer.h" | |
| 13 | 12 |
| 14 class CookieSettings; | 13 class CookieSettings; |
| 15 class Profile; | 14 class Profile; |
| 16 | 15 |
| 17 class ChromeSigninClient : public SigninClient, | 16 class ChromeSigninClient : public SigninClient, |
| 18 public content::RenderProcessHostObserver, | |
| 19 public SigninErrorController::Observer { | 17 public SigninErrorController::Observer { |
| 20 public: | 18 public: |
| 21 explicit ChromeSigninClient( | 19 explicit ChromeSigninClient( |
| 22 Profile* profile, SigninErrorController* signin_error_controller); | 20 Profile* profile, SigninErrorController* signin_error_controller); |
| 23 ~ChromeSigninClient() override; | 21 ~ChromeSigninClient() override; |
| 24 | 22 |
| 25 // Utility methods. | 23 // Utility methods. |
| 26 static bool ProfileAllowsSigninCookies(Profile* profile); | 24 static bool ProfileAllowsSigninCookies(Profile* profile); |
| 27 static bool SettingsAllowSigninCookies(CookieSettings* cookie_settings); | 25 static bool SettingsAllowSigninCookies(CookieSettings* cookie_settings); |
| 28 | 26 |
| 29 // Tracks the privileged signin process identified by |host_id| so that we | |
| 30 // can later ask (via IsSigninProcess) if it is safe to sign the user in from | |
| 31 // the current context (see OneClickSigninHelper). All of this tracking | |
| 32 // state is reset once the renderer process terminates. | |
| 33 // | |
| 34 // N.B. This is the id returned by RenderProcessHost::GetID(). | |
| 35 // TODO(guohui): Eliminate these APIs once the web-based signin flow is | |
| 36 // replaced by a native flow. crbug.com/347247 | |
| 37 void SetSigninProcess(int host_id) override; | |
| 38 void ClearSigninProcess() override; | |
| 39 bool IsSigninProcess(int host_id) const override; | |
| 40 bool HasSigninProcess() const override; | |
| 41 | |
| 42 // content::RenderProcessHostObserver implementation. | |
| 43 void RenderProcessHostDestroyed(content::RenderProcessHost* host) override; | |
| 44 | |
| 45 // SigninClient implementation. | 27 // SigninClient implementation. |
| 46 PrefService* GetPrefs() override; | 28 PrefService* GetPrefs() override; |
| 47 scoped_refptr<TokenWebData> GetDatabase() override; | 29 scoped_refptr<TokenWebData> GetDatabase() override; |
| 48 bool CanRevokeCredentials() override; | 30 bool CanRevokeCredentials() override; |
| 49 std::string GetSigninScopedDeviceId() override; | 31 std::string GetSigninScopedDeviceId() override; |
| 50 void OnSignedOut() override; | 32 void OnSignedOut() override; |
| 51 net::URLRequestContextGetter* GetURLRequestContext() override; | 33 net::URLRequestContextGetter* GetURLRequestContext() override; |
| 52 bool ShouldMergeSigninCredentialsIntoCookieJar() override; | 34 bool ShouldMergeSigninCredentialsIntoCookieJar() override; |
| 53 bool IsFirstRun() const override; | 35 bool IsFirstRun() const override; |
| 54 base::Time GetInstallDate() override; | 36 base::Time GetInstallDate() override; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 74 const std::string& password) override; | 56 const std::string& password) override; |
| 75 | 57 |
| 76 // SigninErrorController::Observer implementation. | 58 // SigninErrorController::Observer implementation. |
| 77 void OnErrorChanged() override; | 59 void OnErrorChanged() override; |
| 78 | 60 |
| 79 private: | 61 private: |
| 80 Profile* profile_; | 62 Profile* profile_; |
| 81 | 63 |
| 82 SigninErrorController* signin_error_controller_; | 64 SigninErrorController* signin_error_controller_; |
| 83 | 65 |
| 84 // See SetSigninProcess. Tracks the currently active signin process | |
| 85 // by ID, if there is one. | |
| 86 int signin_host_id_; | |
| 87 | |
| 88 // The RenderProcessHosts being observed. | |
| 89 std::set<content::RenderProcessHost*> signin_hosts_observed_; | |
| 90 | |
| 91 DISALLOW_COPY_AND_ASSIGN(ChromeSigninClient); | 66 DISALLOW_COPY_AND_ASSIGN(ChromeSigninClient); |
| 92 }; | 67 }; |
| 93 | 68 |
| 94 #endif // CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_CLIENT_H_ | 69 #endif // CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_CLIENT_H_ |
| OLD | NEW |