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_CHROMEOS_LOGIN_USER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
11 #include "chrome/browser/chromeos/login/user.h" | 11 #include "chrome/browser/chromeos/login/user.h" |
12 | 12 |
13 class PrefRegistrySimple; | 13 class PrefRegistrySimple; |
14 | 14 |
15 namespace chromeos { | 15 namespace chromeos { |
16 | 16 |
17 class RemoveUserDelegate; | 17 class RemoveUserDelegate; |
18 class UserImageManager; | 18 class UserImageManager; |
19 | 19 |
20 // Base class for UserManagerImpl - provides a mechanism for discovering users | 20 // Base class for UserManagerImpl - provides a mechanism for discovering users |
21 // who have logged into this Chrome OS device before and updating that list. | 21 // who have logged into this Chrome OS device before and updating that list. |
22 class UserManager { | 22 class UserManager { |
23 public: | 23 public: |
| 24 // Status of merge sessions process which is responsible for exchanging |
| 25 // user OAuth2 refresh token for GAIA cookies. |
| 26 enum MergeSessionState { |
| 27 // Session merge hasn't started yet. |
| 28 MERGE_STATUS_NOT_STARTED, |
| 29 // Session merge is in process. |
| 30 MERGE_STATUS_IN_PROCESS, |
| 31 // Session merge is completed. |
| 32 MERGE_STATUS_DONE, |
| 33 }; |
| 34 |
24 // Interface that observers of UserManager must implement in order | 35 // Interface that observers of UserManager must implement in order |
25 // to receive notification when local state preferences is changed | 36 // to receive notification when local state preferences is changed |
26 class Observer { | 37 class Observer { |
27 public: | 38 public: |
28 // Called when the local state preferences is changed | 39 // Called when the local state preferences is changed. |
29 virtual void LocalStateChanged(UserManager* user_manager) = 0; | 40 virtual void LocalStateChanged(UserManager* user_manager) = 0; |
30 | 41 |
| 42 // Called when merge session state is changed. |
| 43 virtual void MergeSessionStateChanged(MergeSessionState state) {} |
| 44 |
31 protected: | 45 protected: |
32 virtual ~Observer() {} | 46 virtual ~Observer() {} |
33 }; | 47 }; |
34 | 48 |
35 // Username for stub login when not running on ChromeOS. | 49 // Username for stub login when not running on ChromeOS. |
36 static const char kStubUser[]; | 50 static const char kStubUser[]; |
37 | 51 |
38 // Domain that is used for all locally managed users. | 52 // Domain that is used for all locally managed users. |
39 static const char kLocallyManagedUserDomain[]; | 53 static const char kLocallyManagedUserDomain[]; |
40 | 54 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 virtual bool IsLoggedInAsLocallyManagedUser() const = 0; | 218 virtual bool IsLoggedInAsLocallyManagedUser() const = 0; |
205 | 219 |
206 // Returns true if we're logged in as the stub user used for testing on Linux. | 220 // Returns true if we're logged in as the stub user used for testing on Linux. |
207 virtual bool IsLoggedInAsStub() const = 0; | 221 virtual bool IsLoggedInAsStub() const = 0; |
208 | 222 |
209 // Returns true if we're logged in and browser has been started i.e. | 223 // Returns true if we're logged in and browser has been started i.e. |
210 // browser_creator.LaunchBrowser(...) was called after sign in | 224 // browser_creator.LaunchBrowser(...) was called after sign in |
211 // or restart after crash. | 225 // or restart after crash. |
212 virtual bool IsSessionStarted() const = 0; | 226 virtual bool IsSessionStarted() const = 0; |
213 | 227 |
| 228 // Returns merge session status. |
| 229 virtual MergeSessionState GetMergeSessionState() const = 0; |
| 230 |
| 231 // Changes merge session status. |
| 232 virtual void SetMergeSessionState(MergeSessionState status) = 0; |
| 233 |
214 // Returns true when the browser has crashed and restarted during the current | 234 // Returns true when the browser has crashed and restarted during the current |
215 // user's session. | 235 // user's session. |
216 virtual bool HasBrowserRestarted() const = 0; | 236 virtual bool HasBrowserRestarted() const = 0; |
217 | 237 |
218 // Returns true if data stored or cached for the user with the given email | 238 // Returns true if data stored or cached for the user with the given email |
219 // address outside that user's cryptohome (wallpaper, avatar, OAuth token | 239 // address outside that user's cryptohome (wallpaper, avatar, OAuth token |
220 // status, display name, display email) is to be treated as ephemeral. | 240 // status, display name, display email) is to be treated as ephemeral. |
221 virtual bool IsUserNonCryptohomeDataEphemeral( | 241 virtual bool IsUserNonCryptohomeDataEphemeral( |
222 const std::string& email) const = 0; | 242 const std::string& email) const = 0; |
223 | 243 |
224 virtual void AddObserver(Observer* obs) = 0; | 244 virtual void AddObserver(Observer* obs) = 0; |
225 virtual void RemoveObserver(Observer* obs) = 0; | 245 virtual void RemoveObserver(Observer* obs) = 0; |
226 | 246 |
227 virtual void NotifyLocalStateChanged() = 0; | 247 virtual void NotifyLocalStateChanged() = 0; |
228 }; | 248 }; |
229 | 249 |
230 } // namespace chromeos | 250 } // namespace chromeos |
231 | 251 |
232 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ | 252 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ |
OLD | NEW |