OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_ABOUT_SIGNIN_INTERNALS_H_ | 5 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_ABOUT_SIGNIN_INTERNALS_H_ |
6 #define COMPONENTS_SIGNIN_CORE_BROWSER_ABOUT_SIGNIN_INTERNALS_H_ | 6 #define COMPONENTS_SIGNIN_CORE_BROWSER_ABOUT_SIGNIN_INTERNALS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 // |info| will contain the dictionary of signin_status_ values as indicated | 41 // |info| will contain the dictionary of signin_status_ values as indicated |
42 // in the comments for GetSigninStatus() below. | 42 // in the comments for GetSigninStatus() below. |
43 virtual void OnSigninStateChanged(const base::DictionaryValue* info) = 0; | 43 virtual void OnSigninStateChanged(const base::DictionaryValue* info) = 0; |
44 | 44 |
45 // Notification that the cookie accounts are ready to be displayed. | 45 // Notification that the cookie accounts are ready to be displayed. |
46 virtual void OnCookieAccountsFetched(const base::DictionaryValue* info) = 0; | 46 virtual void OnCookieAccountsFetched(const base::DictionaryValue* info) = 0; |
47 }; | 47 }; |
48 | 48 |
49 AboutSigninInternals(ProfileOAuth2TokenService* token_service, | 49 AboutSigninInternals(ProfileOAuth2TokenService* token_service, |
50 SigninManagerBase* signin_manager); | 50 SigninManagerBase* signin_manager); |
51 virtual ~AboutSigninInternals(); | 51 ~AboutSigninInternals() override; |
52 | 52 |
53 // Each instance of SigninInternalsUI adds itself as an observer to be | 53 // Each instance of SigninInternalsUI adds itself as an observer to be |
54 // notified of all updates that AboutSigninInternals receives. | 54 // notified of all updates that AboutSigninInternals receives. |
55 void AddSigninObserver(Observer* observer); | 55 void AddSigninObserver(Observer* observer); |
56 void RemoveSigninObserver(Observer* observer); | 56 void RemoveSigninObserver(Observer* observer); |
57 | 57 |
58 // Pulls all signin values that have been persisted in the user prefs. | 58 // Pulls all signin values that have been persisted in the user prefs. |
59 void RefreshSigninPrefs(); | 59 void RefreshSigninPrefs(); |
60 | 60 |
61 // SigninManager::SigninDiagnosticsObserver implementation. | 61 // SigninManager::SigninDiagnosticsObserver implementation. |
62 virtual void NotifySigninValueChanged( | 62 void NotifySigninValueChanged( |
63 const signin_internals_util::UntimedSigninStatusField& field, | 63 const signin_internals_util::UntimedSigninStatusField& field, |
64 const std::string& value) override; | 64 const std::string& value) override; |
65 | 65 |
66 virtual void NotifySigninValueChanged( | 66 void NotifySigninValueChanged( |
67 const signin_internals_util::TimedSigninStatusField& field, | 67 const signin_internals_util::TimedSigninStatusField& field, |
68 const std::string& value) override; | 68 const std::string& value) override; |
69 | 69 |
70 void Initialize(SigninClient* client); | 70 void Initialize(SigninClient* client); |
71 | 71 |
72 // KeyedService implementation. | 72 // KeyedService implementation. |
73 virtual void Shutdown() override; | 73 void Shutdown() override; |
74 | 74 |
75 // Returns a dictionary of values in signin_status_ for use in | 75 // Returns a dictionary of values in signin_status_ for use in |
76 // about:signin-internals. The values are formatted as shown - | 76 // about:signin-internals. The values are formatted as shown - |
77 // | 77 // |
78 // { "signin_info" : | 78 // { "signin_info" : |
79 // [ {"title": "Basic Information", | 79 // [ {"title": "Basic Information", |
80 // "data": [List of {"label" : "foo-field", "value" : "foo"} elems] | 80 // "data": [List of {"label" : "foo-field", "value" : "foo"} elems] |
81 // }, | 81 // }, |
82 // { "title": "Detailed Information", | 82 // { "title": "Detailed Information", |
83 // "data": [List of {"label" : "foo-field", "value" : "foo"} elems] | 83 // "data": [List of {"label" : "foo-field", "value" : "foo"} elems] |
84 // }], | 84 // }], |
85 // "token_info" : | 85 // "token_info" : |
86 // [ List of {"name": "foo-name", "token" : "foo-token", | 86 // [ List of {"name": "foo-name", "token" : "foo-token", |
87 // "status": "foo_stat", "time" : "foo_time"} elems] | 87 // "status": "foo_stat", "time" : "foo_time"} elems] |
88 // } | 88 // } |
89 scoped_ptr<base::DictionaryValue> GetSigninStatus(); | 89 scoped_ptr<base::DictionaryValue> GetSigninStatus(); |
90 | 90 |
91 // Triggers a ListAccounts call to acquire a list of the email addresses | 91 // Triggers a ListAccounts call to acquire a list of the email addresses |
92 // corresponding to the cookies residing on the current cookie jar. | 92 // corresponding to the cookies residing on the current cookie jar. |
93 void GetCookieAccountsAsync(); | 93 void GetCookieAccountsAsync(); |
94 | 94 |
95 // OAuth2TokenService::DiagnosticsObserver implementations. | 95 // OAuth2TokenService::DiagnosticsObserver implementations. |
96 virtual void OnAccessTokenRequested( | 96 void OnAccessTokenRequested( |
97 const std::string& account_id, | 97 const std::string& account_id, |
98 const std::string& consumer_id, | 98 const std::string& consumer_id, |
99 const OAuth2TokenService::ScopeSet& scopes) override; | 99 const OAuth2TokenService::ScopeSet& scopes) override; |
100 virtual void OnFetchAccessTokenComplete( | 100 void OnFetchAccessTokenComplete(const std::string& account_id, |
101 const std::string& account_id, | 101 const std::string& consumer_id, |
102 const std::string& consumer_id, | 102 const OAuth2TokenService::ScopeSet& scopes, |
103 const OAuth2TokenService::ScopeSet& scopes, | 103 GoogleServiceAuthError error, |
104 GoogleServiceAuthError error, | 104 base::Time expiration_time) override; |
105 base::Time expiration_time) override; | 105 void OnTokenRemoved(const std::string& account_id, |
106 virtual void OnTokenRemoved(const std::string& account_id, | 106 const OAuth2TokenService::ScopeSet& scopes) override; |
107 const OAuth2TokenService::ScopeSet& scopes) | |
108 override; | |
109 | 107 |
110 void OnRefreshTokenReceived(std::string status); | 108 void OnRefreshTokenReceived(std::string status); |
111 void OnAuthenticationResultReceived(std::string status); | 109 void OnAuthenticationResultReceived(std::string status); |
112 | 110 |
113 private: | 111 private: |
114 // Encapsulates diagnostic information about tokens for different services. | 112 // Encapsulates diagnostic information about tokens for different services. |
115 struct TokenInfo { | 113 struct TokenInfo { |
116 TokenInfo(const std::string& consumer_id, | 114 TokenInfo(const std::string& consumer_id, |
117 const OAuth2TokenService::ScopeSet& scopes); | 115 const OAuth2TokenService::ScopeSet& scopes); |
118 ~TokenInfo(); | 116 ~TokenInfo(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // "status" : request status} elems] | 165 // "status" : request status} elems] |
168 // }], | 166 // }], |
169 // } | 167 // } |
170 scoped_ptr<base::DictionaryValue> ToValue(std::string product_version); | 168 scoped_ptr<base::DictionaryValue> ToValue(std::string product_version); |
171 }; | 169 }; |
172 | 170 |
173 void NotifyObservers(); | 171 void NotifyObservers(); |
174 | 172 |
175 | 173 |
176 // Overriden from GaiaAuthConsumer. | 174 // Overriden from GaiaAuthConsumer. |
177 virtual void OnListAccountsSuccess(const std::string& data) override; | 175 void OnListAccountsSuccess(const std::string& data) override; |
178 virtual void OnListAccountsFailure(const GoogleServiceAuthError& error) | 176 void OnListAccountsFailure(const GoogleServiceAuthError& error) override; |
179 override; | |
180 | 177 |
181 // Callback for ListAccounts. Once the email addresses are fetched from GAIA, | 178 // Callback for ListAccounts. Once the email addresses are fetched from GAIA, |
182 // they are pushed to the signin_internals_ui. | 179 // they are pushed to the signin_internals_ui. |
183 void OnListAccountsComplete( | 180 void OnListAccountsComplete( |
184 std::vector<std::pair<std::string, bool> >& gaia_accounts); | 181 std::vector<std::pair<std::string, bool> >& gaia_accounts); |
185 | 182 |
186 // Called when a cookie changes. If the cookie relates to a GAIA LSID cookie, | 183 // Called when a cookie changes. If the cookie relates to a GAIA LSID cookie, |
187 // then we call ListAccounts and update the UI element. | 184 // then we call ListAccounts and update the UI element. |
188 void OnCookieChanged(const net::CanonicalCookie* cookie); | 185 void OnCookieChanged(const net::CanonicalCookie* cookie); |
189 | 186 |
(...skipping 15 matching lines...) Expand all Loading... |
205 | 202 |
206 ObserverList<Observer> signin_observers_; | 203 ObserverList<Observer> signin_observers_; |
207 | 204 |
208 scoped_ptr<SigninClient::CookieChangedCallbackList::Subscription> | 205 scoped_ptr<SigninClient::CookieChangedCallbackList::Subscription> |
209 cookie_changed_subscription_; | 206 cookie_changed_subscription_; |
210 | 207 |
211 DISALLOW_COPY_AND_ASSIGN(AboutSigninInternals); | 208 DISALLOW_COPY_AND_ASSIGN(AboutSigninInternals); |
212 }; | 209 }; |
213 | 210 |
214 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ABOUT_SIGNIN_INTERNALS_H_ | 211 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ABOUT_SIGNIN_INTERNALS_H_ |
OLD | NEW |