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 "content/public/browser/notification_observer.h" | |
12 #include "content/public/browser/notification_registrar.h" | |
13 #include "content/public/browser/render_process_host_observer.h" | 11 #include "content/public/browser/render_process_host_observer.h" |
14 | 12 |
15 class CookieSettings; | 13 class CookieSettings; |
16 class Profile; | 14 class Profile; |
17 | 15 |
18 class ChromeSigninClient : public SigninClient, | 16 class ChromeSigninClient : public SigninClient, |
19 public content::NotificationObserver, | |
20 public content::RenderProcessHostObserver { | 17 public content::RenderProcessHostObserver { |
21 public: | 18 public: |
22 explicit ChromeSigninClient(Profile* profile); | 19 explicit ChromeSigninClient(Profile* profile); |
23 ~ChromeSigninClient() override; | 20 ~ChromeSigninClient() override; |
24 | 21 |
25 // Utility methods. | 22 // Utility methods. |
26 static bool ProfileAllowsSigninCookies(Profile* profile); | 23 static bool ProfileAllowsSigninCookies(Profile* profile); |
27 static bool SettingsAllowSigninCookies(CookieSettings* cookie_settings); | 24 static bool SettingsAllowSigninCookies(CookieSettings* cookie_settings); |
28 | 25 |
29 // Tracks the privileged signin process identified by |host_id| so that we | 26 // Tracks the privileged signin process identified by |host_id| so that we |
(...skipping 20 matching lines...) Expand all Loading... |
50 void OnSignedOut() override; | 47 void OnSignedOut() override; |
51 net::URLRequestContextGetter* GetURLRequestContext() override; | 48 net::URLRequestContextGetter* GetURLRequestContext() override; |
52 bool ShouldMergeSigninCredentialsIntoCookieJar() override; | 49 bool ShouldMergeSigninCredentialsIntoCookieJar() override; |
53 bool IsFirstRun() const override; | 50 bool IsFirstRun() const override; |
54 base::Time GetInstallDate() override; | 51 base::Time GetInstallDate() override; |
55 | 52 |
56 // Returns a string describing the chrome version environment. Version format: | 53 // Returns a string describing the chrome version environment. Version format: |
57 // <Build Info> <OS> <Version number> (<Last change>)<channel or "-devel"> | 54 // <Build Info> <OS> <Version number> (<Last change>)<channel or "-devel"> |
58 // If version information is unavailable, returns "invalid." | 55 // If version information is unavailable, returns "invalid." |
59 std::string GetProductVersion() override; | 56 std::string GetProductVersion() override; |
60 scoped_ptr<CookieChangedCallbackList::Subscription> AddCookieChangedCallback( | 57 scoped_ptr<CookieChangedSubscription> AddCookieChangedCallback( |
61 const CookieChangedCallback& callback) override; | 58 const GURL& url, |
| 59 const std::string& name, |
| 60 const net::CookieStore::CookieChangedCallback& callback) override; |
62 void GoogleSigninSucceeded(const std::string& account_id, | 61 void GoogleSigninSucceeded(const std::string& account_id, |
63 const std::string& username, | 62 const std::string& username, |
64 const std::string& password) override; | 63 const std::string& password) override; |
65 | 64 |
66 // content::NotificationObserver implementation. | |
67 void Observe(int type, | |
68 const content::NotificationSource& source, | |
69 const content::NotificationDetails& details) override; | |
70 | |
71 private: | 65 private: |
72 void RegisterForCookieChangedNotification(); | |
73 void UnregisterForCookieChangedNotification(); | |
74 | |
75 Profile* profile_; | 66 Profile* profile_; |
76 content::NotificationRegistrar registrar_; | |
77 | |
78 // The callbacks that will be called when notifications about cookie changes | |
79 // are received. | |
80 base::CallbackList<void(const net::CanonicalCookie* cookie)> callbacks_; | |
81 | 67 |
82 // See SetSigninProcess. Tracks the currently active signin process | 68 // See SetSigninProcess. Tracks the currently active signin process |
83 // by ID, if there is one. | 69 // by ID, if there is one. |
84 int signin_host_id_; | 70 int signin_host_id_; |
85 | 71 |
86 // The RenderProcessHosts being observed. | 72 // The RenderProcessHosts being observed. |
87 std::set<content::RenderProcessHost*> signin_hosts_observed_; | 73 std::set<content::RenderProcessHost*> signin_hosts_observed_; |
88 | 74 |
89 DISALLOW_COPY_AND_ASSIGN(ChromeSigninClient); | 75 DISALLOW_COPY_AND_ASSIGN(ChromeSigninClient); |
90 }; | 76 }; |
91 | 77 |
92 #endif // CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_CLIENT_H_ | 78 #endif // CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_CLIENT_H_ |
OLD | NEW |