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 // The signin manager encapsulates some functionality tracking | 5 // The signin manager encapsulates some functionality tracking |
6 // which user is signed in. | 6 // which user is signed in. |
7 // | 7 // |
8 // **NOTE** on semantics of SigninManager: | 8 // **NOTE** on semantics of SigninManager: |
9 // | 9 // |
10 // Once a signin is successful, the username becomes "established" and will not | 10 // Once a signin is successful, the username becomes "established" and will not |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 std::string password; | 53 std::string password; |
54 }; | 54 }; |
55 | 55 |
56 // Details for the Notification type NOTIFICATION_GOOGLE_SIGNED_OUT. | 56 // Details for the Notification type NOTIFICATION_GOOGLE_SIGNED_OUT. |
57 struct GoogleServiceSignoutDetails { | 57 struct GoogleServiceSignoutDetails { |
58 explicit GoogleServiceSignoutDetails(const std::string& in_username) | 58 explicit GoogleServiceSignoutDetails(const std::string& in_username) |
59 : username(in_username) {} | 59 : username(in_username) {} |
60 std::string username; | 60 std::string username; |
61 }; | 61 }; |
62 | 62 |
63 class SigninManagerBase : public ProfileKeyedService { | 63 class SigninManagerBase : public BrowserContextKeyedService { |
64 public: | 64 public: |
65 SigninManagerBase(); | 65 SigninManagerBase(); |
66 virtual ~SigninManagerBase(); | 66 virtual ~SigninManagerBase(); |
67 | 67 |
68 // If user was signed in, load tokens from DB if available. | 68 // If user was signed in, load tokens from DB if available. |
69 virtual void Initialize(Profile* profile, PrefService* local_state); | 69 virtual void Initialize(Profile* profile, PrefService* local_state); |
70 bool IsInitialized() const; | 70 bool IsInitialized() const; |
71 | 71 |
72 // Returns true if a signin to Chrome is allowed (by policy or pref). | 72 // Returns true if a signin to Chrome is allowed (by policy or pref). |
73 // TODO(tim): kSigninAllowed is defined for all platforms in pref_names.h. | 73 // TODO(tim): kSigninAllowed is defined for all platforms in pref_names.h. |
(...skipping 18 matching lines...) Expand all Loading... |
92 virtual bool AuthInProgress() const; | 92 virtual bool AuthInProgress() const; |
93 | 93 |
94 SigninGlobalError* signin_global_error() { | 94 SigninGlobalError* signin_global_error() { |
95 return signin_global_error_.get(); | 95 return signin_global_error_.get(); |
96 } | 96 } |
97 | 97 |
98 const SigninGlobalError* signin_global_error() const { | 98 const SigninGlobalError* signin_global_error() const { |
99 return signin_global_error_.get(); | 99 return signin_global_error_.get(); |
100 } | 100 } |
101 | 101 |
102 // ProfileKeyedService implementation. | 102 // BrowserContextKeyedService implementation. |
103 virtual void Shutdown() OVERRIDE; | 103 virtual void Shutdown() OVERRIDE; |
104 | 104 |
105 // Methods to register or remove SigninDiagnosticObservers | 105 // Methods to register or remove SigninDiagnosticObservers |
106 void AddSigninDiagnosticsObserver( | 106 void AddSigninDiagnosticsObserver( |
107 signin_internals_util::SigninDiagnosticsObserver* observer); | 107 signin_internals_util::SigninDiagnosticsObserver* observer); |
108 void RemoveSigninDiagnosticsObserver( | 108 void RemoveSigninDiagnosticsObserver( |
109 signin_internals_util::SigninDiagnosticsObserver* observer); | 109 signin_internals_util::SigninDiagnosticsObserver* observer); |
110 | 110 |
111 protected: | 111 protected: |
112 // Lets different platforms initialize TokenService in their own way. | 112 // Lets different platforms initialize TokenService in their own way. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // The list of SigninDiagnosticObservers. | 144 // The list of SigninDiagnosticObservers. |
145 ObserverList<signin_internals_util::SigninDiagnosticsObserver, true> | 145 ObserverList<signin_internals_util::SigninDiagnosticsObserver, true> |
146 signin_diagnostics_observers_; | 146 signin_diagnostics_observers_; |
147 | 147 |
148 base::WeakPtrFactory<SigninManagerBase> weak_pointer_factory_; | 148 base::WeakPtrFactory<SigninManagerBase> weak_pointer_factory_; |
149 | 149 |
150 DISALLOW_COPY_AND_ASSIGN(SigninManagerBase); | 150 DISALLOW_COPY_AND_ASSIGN(SigninManagerBase); |
151 }; | 151 }; |
152 | 152 |
153 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_BASE_H_ | 153 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_BASE_H_ |
OLD | NEW |