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 "content/public/browser/render_process_host_observer.h" | 12 #include "content/public/browser/render_process_host_observer.h" |
12 | 13 |
13 class CookieSettings; | 14 class CookieSettings; |
14 class Profile; | 15 class Profile; |
15 | 16 |
16 class ChromeSigninClient : public SigninClient, | 17 class ChromeSigninClient : public SigninClient, |
17 public content::RenderProcessHostObserver { | 18 public content::RenderProcessHostObserver, |
| 19 public SigninErrorController::Observer { |
18 public: | 20 public: |
19 explicit ChromeSigninClient(Profile* profile); | 21 explicit ChromeSigninClient( |
| 22 Profile* profile, SigninErrorController* signin_error_controller); |
20 ~ChromeSigninClient() override; | 23 ~ChromeSigninClient() override; |
21 | 24 |
22 // Utility methods. | 25 // Utility methods. |
23 static bool ProfileAllowsSigninCookies(Profile* profile); | 26 static bool ProfileAllowsSigninCookies(Profile* profile); |
24 static bool SettingsAllowSigninCookies(CookieSettings* cookie_settings); | 27 static bool SettingsAllowSigninCookies(CookieSettings* cookie_settings); |
25 | 28 |
26 // 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 |
27 // 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 |
28 // the current context (see OneClickSigninHelper). All of this tracking | 31 // the current context (see OneClickSigninHelper). All of this tracking |
29 // state is reset once the renderer process terminates. | 32 // state is reset once the renderer process terminates. |
(...skipping 28 matching lines...) Expand all Loading... |
58 const GURL& url, | 61 const GURL& url, |
59 const std::string& name, | 62 const std::string& name, |
60 const net::CookieStore::CookieChangedCallback& callback) override; | 63 const net::CookieStore::CookieChangedCallback& callback) override; |
61 void OnSignedIn(const std::string& account_id, | 64 void OnSignedIn(const std::string& account_id, |
62 const std::string& username, | 65 const std::string& username, |
63 const std::string& password) override; | 66 const std::string& password) override; |
64 void PostSignedIn(const std::string& account_id, | 67 void PostSignedIn(const std::string& account_id, |
65 const std::string& username, | 68 const std::string& username, |
66 const std::string& password) override; | 69 const std::string& password) override; |
67 | 70 |
| 71 // SigninErrorController::Observer implementation. |
| 72 void OnErrorChanged() override; |
| 73 |
68 private: | 74 private: |
69 Profile* profile_; | 75 Profile* profile_; |
70 | 76 |
| 77 SigninErrorController* signin_error_controller_; |
| 78 |
71 // See SetSigninProcess. Tracks the currently active signin process | 79 // See SetSigninProcess. Tracks the currently active signin process |
72 // by ID, if there is one. | 80 // by ID, if there is one. |
73 int signin_host_id_; | 81 int signin_host_id_; |
74 | 82 |
75 // The RenderProcessHosts being observed. | 83 // The RenderProcessHosts being observed. |
76 std::set<content::RenderProcessHost*> signin_hosts_observed_; | 84 std::set<content::RenderProcessHost*> signin_hosts_observed_; |
77 | 85 |
78 DISALLOW_COPY_AND_ASSIGN(ChromeSigninClient); | 86 DISALLOW_COPY_AND_ASSIGN(ChromeSigninClient); |
79 }; | 87 }; |
80 | 88 |
81 #endif // CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_CLIENT_H_ | 89 #endif // CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_CLIENT_H_ |
OLD | NEW |