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/keyed_service/core/keyed_service.h" | |
11 #include "components/signin/core/browser/signin_client.h" | 10 #include "components/signin/core/browser/signin_client.h" |
12 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
14 #include "content/public/browser/render_process_host_observer.h" | 13 #include "content/public/browser/render_process_host_observer.h" |
15 | 14 |
16 class CookieSettings; | 15 class CookieSettings; |
17 class Profile; | 16 class Profile; |
18 | 17 |
19 class ChromeSigninClient : public SigninClient, | 18 class ChromeSigninClient : public SigninClient, |
20 public KeyedService, | |
21 public content::NotificationObserver, | 19 public content::NotificationObserver, |
22 public content::RenderProcessHostObserver { | 20 public content::RenderProcessHostObserver { |
23 public: | 21 public: |
24 explicit ChromeSigninClient(Profile* profile); | 22 explicit ChromeSigninClient(Profile* profile); |
25 virtual ~ChromeSigninClient(); | 23 virtual ~ChromeSigninClient(); |
26 | 24 |
27 // Utility methods. | 25 // Utility methods. |
28 static bool ProfileAllowsSigninCookies(Profile* profile); | 26 static bool ProfileAllowsSigninCookies(Profile* profile); |
29 static bool SettingsAllowSigninCookies(CookieSettings* cookie_settings); | 27 static bool SettingsAllowSigninCookies(CookieSettings* cookie_settings); |
30 | 28 |
31 // Tracks the privileged signin process identified by |host_id| so that we | 29 // Tracks the privileged signin process identified by |host_id| so that we |
32 // can later ask (via IsSigninProcess) if it is safe to sign the user in from | 30 // can later ask (via IsSigninProcess) if it is safe to sign the user in from |
33 // the current context (see OneClickSigninHelper). All of this tracking | 31 // the current context (see OneClickSigninHelper). All of this tracking |
34 // state is reset once the renderer process terminates. | 32 // state is reset once the renderer process terminates. |
35 // | 33 // |
36 // N.B. This is the id returned by RenderProcessHost::GetID(). | 34 // N.B. This is the id returned by RenderProcessHost::GetID(). |
37 // TODO(guohui): Eliminate these APIs once the web-based signin flow is | 35 // TODO(guohui): Eliminate these APIs once the web-based signin flow is |
38 // replaced by a native flow. crbug.com/347247 | 36 // replaced by a native flow. crbug.com/347247 |
39 void SetSigninProcess(int host_id); | 37 virtual void SetSigninProcess(int host_id) OVERRIDE; |
40 void ClearSigninProcess(); | 38 virtual void ClearSigninProcess() OVERRIDE; |
41 bool IsSigninProcess(int host_id) const; | 39 virtual bool IsSigninProcess(int host_id) const OVERRIDE; |
42 bool HasSigninProcess() const; | 40 virtual bool HasSigninProcess() const OVERRIDE; |
43 | 41 |
44 // content::RenderProcessHostObserver implementation. | 42 // content::RenderProcessHostObserver implementation. |
45 virtual void RenderProcessHostDestroyed(content::RenderProcessHost* host) | 43 virtual void RenderProcessHostDestroyed(content::RenderProcessHost* host) |
46 OVERRIDE; | 44 OVERRIDE; |
47 | 45 |
48 // SigninClient implementation. | 46 // SigninClient implementation. |
49 virtual PrefService* GetPrefs() OVERRIDE; | 47 virtual PrefService* GetPrefs() OVERRIDE; |
50 virtual scoped_refptr<TokenWebData> GetDatabase() OVERRIDE; | 48 virtual scoped_refptr<TokenWebData> GetDatabase() OVERRIDE; |
51 virtual bool CanRevokeCredentials() OVERRIDE; | 49 virtual bool CanRevokeCredentials() OVERRIDE; |
52 virtual net::URLRequestContextGetter* GetURLRequestContext() OVERRIDE; | 50 virtual net::URLRequestContextGetter* GetURLRequestContext() OVERRIDE; |
(...skipping 28 matching lines...) Expand all Loading... |
81 // by ID, if there is one. | 79 // by ID, if there is one. |
82 int signin_host_id_; | 80 int signin_host_id_; |
83 | 81 |
84 // The RenderProcessHosts being observed. | 82 // The RenderProcessHosts being observed. |
85 std::set<content::RenderProcessHost*> signin_hosts_observed_; | 83 std::set<content::RenderProcessHost*> signin_hosts_observed_; |
86 | 84 |
87 DISALLOW_COPY_AND_ASSIGN(ChromeSigninClient); | 85 DISALLOW_COPY_AND_ASSIGN(ChromeSigninClient); |
88 }; | 86 }; |
89 | 87 |
90 #endif // CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_CLIENT_H_ | 88 #endif // CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_CLIENT_H_ |
OLD | NEW |