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 CHROME_BROWSER_SIGNIN_ABOUT_SIGNIN_INTERNALS_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_ABOUT_SIGNIN_INTERNALS_H_ |
6 #define CHROME_BROWSER_SIGNIN_ABOUT_SIGNIN_INTERNALS_H_ | 6 #define CHROME_BROWSER_SIGNIN_ABOUT_SIGNIN_INTERNALS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 // Many values in SigninStatus are also associated with a timestamp. | 22 // Many values in SigninStatus are also associated with a timestamp. |
23 // This makes it easier to keep values and their associated times together. | 23 // This makes it easier to keep values and their associated times together. |
24 typedef std::pair<std::string, std::string> TimedSigninStatusValue; | 24 typedef std::pair<std::string, std::string> TimedSigninStatusValue; |
25 | 25 |
26 // This class collects authentication, signin and token information | 26 // This class collects authentication, signin and token information |
27 // to propagate to about:signin-internals via SigninInternalsUI. | 27 // to propagate to about:signin-internals via SigninInternalsUI. |
28 class AboutSigninInternals | 28 class AboutSigninInternals |
29 : public KeyedService, | 29 : public KeyedService, |
30 public signin_internals_util::SigninDiagnosticsObserver, | 30 public signin_internals_util::SigninDiagnosticsObserver, |
| 31 public SigninManagerFactory::Observer, |
31 public OAuth2TokenService::DiagnosticsObserver { | 32 public OAuth2TokenService::DiagnosticsObserver { |
32 public: | 33 public: |
33 class Observer { | 34 class Observer { |
34 public: | 35 public: |
35 // |info| will contain the dictionary of signin_status_ values as indicated | 36 // |info| will contain the dictionary of signin_status_ values as indicated |
36 // in the comments for GetSigninStatus() below. | 37 // in the comments for GetSigninStatus() below. |
37 virtual void OnSigninStateChanged( | 38 virtual void OnSigninStateChanged( |
38 scoped_ptr<base::DictionaryValue> info) = 0; | 39 scoped_ptr<base::DictionaryValue> info) = 0; |
39 }; | 40 }; |
40 | 41 |
41 AboutSigninInternals(); | 42 AboutSigninInternals(); |
42 virtual ~AboutSigninInternals(); | 43 virtual ~AboutSigninInternals(); |
43 | 44 |
44 // Each instance of SigninInternalsUI adds itself as an observer to be | 45 // Each instance of SigninInternalsUI adds itself as an observer to be |
45 // notified of all updates that AboutSigninInternals receives. | 46 // notified of all updates that AboutSigninInternals receives. |
46 void AddSigninObserver(Observer* observer); | 47 void AddSigninObserver(Observer* observer); |
47 void RemoveSigninObserver(Observer* observer); | 48 void RemoveSigninObserver(Observer* observer); |
48 | 49 |
49 // Pulls all signin values that have been persisted in the user prefs. | 50 // Pulls all signin values that have been persisted in the user prefs. |
50 void RefreshSigninPrefs(); | 51 void RefreshSigninPrefs(); |
51 | 52 |
52 // SigninManager::SigninDiagnosticsObserver implementation. | 53 // SigninManager::SigninDiagnosticsObserver implementation. |
53 virtual void NotifySigninValueChanged( | 54 virtual void NotifySigninValueChanged( |
54 const signin_internals_util::UntimedSigninStatusField& field, | 55 const signin_internals_util::UntimedSigninStatusField& field, |
55 const std::string& value) OVERRIDE; | 56 const std::string& value) OVERRIDE; |
56 | |
57 virtual void NotifySigninValueChanged( | 57 virtual void NotifySigninValueChanged( |
58 const signin_internals_util::TimedSigninStatusField& field, | 58 const signin_internals_util::TimedSigninStatusField& field, |
59 const std::string& value) OVERRIDE; | 59 const std::string& value) OVERRIDE; |
60 | 60 |
| 61 // SigninManagerFactory::Observer implementation. |
| 62 virtual void SigninManagerCreated(SigninManagerBase* manager) OVERRIDE; |
| 63 virtual void SigninManagerShutdown(SigninManagerBase* manager) OVERRIDE; |
| 64 |
61 void Initialize(Profile* profile); | 65 void Initialize(Profile* profile); |
62 | 66 |
63 // KeyedService implementation. | 67 // KeyedService implementation. |
64 virtual void Shutdown() OVERRIDE; | 68 virtual void Shutdown() OVERRIDE; |
65 | 69 |
66 // Returns a dictionary of values in signin_status_ for use in | 70 // Returns a dictionary of values in signin_status_ for use in |
67 // about:signin-internals. The values are formatted as shown - | 71 // about:signin-internals. The values are formatted as shown - |
68 // | 72 // |
69 // { "signin_info" : | 73 // { "signin_info" : |
70 // [ {"title": "Basic Information", | 74 // [ {"title": "Basic Information", |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // Encapsulates the actual signin and token related values. | 166 // Encapsulates the actual signin and token related values. |
163 // Most of the values are mirrored in the prefs for persistence. | 167 // Most of the values are mirrored in the prefs for persistence. |
164 SigninStatus signin_status_; | 168 SigninStatus signin_status_; |
165 | 169 |
166 ObserverList<Observer> signin_observers_; | 170 ObserverList<Observer> signin_observers_; |
167 | 171 |
168 DISALLOW_COPY_AND_ASSIGN(AboutSigninInternals); | 172 DISALLOW_COPY_AND_ASSIGN(AboutSigninInternals); |
169 }; | 173 }; |
170 | 174 |
171 #endif // CHROME_BROWSER_SIGNIN_ABOUT_SIGNIN_INTERNALS_H_ | 175 #endif // CHROME_BROWSER_SIGNIN_ABOUT_SIGNIN_INTERNALS_H_ |
OLD | NEW |