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 // 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 // Called when the currently signed-in user for a user has been signed out. | 55 // Called when the currently signed-in user for a user has been signed out. |
56 virtual void GoogleSignedOut(const std::string& account_id, | 56 virtual void GoogleSignedOut(const std::string& account_id, |
57 const std::string& username) {} | 57 const std::string& username) {} |
58 | 58 |
59 protected: | 59 protected: |
60 virtual ~Observer() {} | 60 virtual ~Observer() {} |
61 }; | 61 }; |
62 | 62 |
63 SigninManagerBase(SigninClient* client); | 63 SigninManagerBase(SigninClient* client); |
64 virtual ~SigninManagerBase(); | 64 ~SigninManagerBase() override; |
65 | 65 |
66 // If user was signed in, load tokens from DB if available. | 66 // If user was signed in, load tokens from DB if available. |
67 virtual void Initialize(PrefService* local_state); | 67 virtual void Initialize(PrefService* local_state); |
68 bool IsInitialized() const; | 68 bool IsInitialized() const; |
69 | 69 |
70 // Returns true if a signin to Chrome is allowed (by policy or pref). | 70 // Returns true if a signin to Chrome is allowed (by policy or pref). |
71 // TODO(tim): kSigninAllowed is defined for all platforms in pref_names.h. | 71 // TODO(tim): kSigninAllowed is defined for all platforms in pref_names.h. |
72 // If kSigninAllowed pref was non-Chrome OS-only, this method wouldn't be | 72 // If kSigninAllowed pref was non-Chrome OS-only, this method wouldn't be |
73 // needed, but as is we provide this method to let all interested code | 73 // needed, but as is we provide this method to let all interested code |
74 // code query the value in one way, versus half using PrefService directly | 74 // code query the value in one way, versus half using PrefService directly |
(...skipping 27 matching lines...) Expand all Loading... |
102 // (by platform / depending on StartBehavior). Bug 88109. | 102 // (by platform / depending on StartBehavior). Bug 88109. |
103 void SetAuthenticatedUsername(const std::string& username); | 103 void SetAuthenticatedUsername(const std::string& username); |
104 | 104 |
105 // Returns true if there is an authenticated user. | 105 // Returns true if there is an authenticated user. |
106 bool IsAuthenticated() const; | 106 bool IsAuthenticated() const; |
107 | 107 |
108 // Returns true if there's a signin in progress. | 108 // Returns true if there's a signin in progress. |
109 virtual bool AuthInProgress() const; | 109 virtual bool AuthInProgress() const; |
110 | 110 |
111 // KeyedService implementation. | 111 // KeyedService implementation. |
112 virtual void Shutdown() override; | 112 void Shutdown() override; |
113 | 113 |
114 // Methods to register or remove observers of signin. | 114 // Methods to register or remove observers of signin. |
115 void AddObserver(Observer* observer); | 115 void AddObserver(Observer* observer); |
116 void RemoveObserver(Observer* observer); | 116 void RemoveObserver(Observer* observer); |
117 | 117 |
118 // Methods to register or remove SigninDiagnosticObservers. | 118 // Methods to register or remove SigninDiagnosticObservers. |
119 void AddSigninDiagnosticsObserver( | 119 void AddSigninDiagnosticsObserver( |
120 signin_internals_util::SigninDiagnosticsObserver* observer); | 120 signin_internals_util::SigninDiagnosticsObserver* observer); |
121 void RemoveSigninDiagnosticsObserver( | 121 void RemoveSigninDiagnosticsObserver( |
122 signin_internals_util::SigninDiagnosticsObserver* observer); | 122 signin_internals_util::SigninDiagnosticsObserver* observer); |
(...skipping 30 matching lines...) Expand all Loading... |
153 // The list of SigninDiagnosticObservers. | 153 // The list of SigninDiagnosticObservers. |
154 ObserverList<signin_internals_util::SigninDiagnosticsObserver, true> | 154 ObserverList<signin_internals_util::SigninDiagnosticsObserver, true> |
155 signin_diagnostics_observers_; | 155 signin_diagnostics_observers_; |
156 | 156 |
157 base::WeakPtrFactory<SigninManagerBase> weak_pointer_factory_; | 157 base::WeakPtrFactory<SigninManagerBase> weak_pointer_factory_; |
158 | 158 |
159 DISALLOW_COPY_AND_ASSIGN(SigninManagerBase); | 159 DISALLOW_COPY_AND_ASSIGN(SigninManagerBase); |
160 }; | 160 }; |
161 | 161 |
162 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_MANAGER_BASE_H_ | 162 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_MANAGER_BASE_H_ |
OLD | NEW |