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 PrefService; | 13 class PrefService; |
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 // Returns a shared instance of a UserManager. Not thread-safe, should only be | 52 // Returns a shared instance of a UserManager. Not thread-safe, should only be |
39 // called from the main UI thread. | 53 // called from the main UI thread. |
40 static UserManager* Get(); | 54 static UserManager* Get(); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 virtual bool IsLoggedInAsGuest() const = 0; | 197 virtual bool IsLoggedInAsGuest() const = 0; |
184 | 198 |
185 // Returns true if we're logged in as the stub user used for testing on Linux. | 199 // Returns true if we're logged in as the stub user used for testing on Linux. |
186 virtual bool IsLoggedInAsStub() const = 0; | 200 virtual bool IsLoggedInAsStub() const = 0; |
187 | 201 |
188 // Returns true if we're logged in and browser has been started i.e. | 202 // Returns true if we're logged in and browser has been started i.e. |
189 // browser_creator.LaunchBrowser(...) was called after sign in | 203 // browser_creator.LaunchBrowser(...) was called after sign in |
190 // or restart after crash. | 204 // or restart after crash. |
191 virtual bool IsSessionStarted() const = 0; | 205 virtual bool IsSessionStarted() const = 0; |
192 | 206 |
| 207 // Returns merge session status. |
| 208 virtual MergeSessionState GetMergeSessionState() const = 0; |
| 209 |
| 210 // Changes merge session status. |
| 211 virtual void SetMergeSessionState(MergeSessionState status) = 0; |
| 212 |
193 // Returns true when the browser has crashed and restarted during the current | 213 // Returns true when the browser has crashed and restarted during the current |
194 // user's session. | 214 // user's session. |
195 virtual bool HasBrowserRestarted() const = 0; | 215 virtual bool HasBrowserRestarted() const = 0; |
196 | 216 |
197 // Returns true if data stored or cached for the user with the given email | 217 // Returns true if data stored or cached for the user with the given email |
198 // address outside that user's cryptohome (wallpaper, avatar, OAuth token | 218 // address outside that user's cryptohome (wallpaper, avatar, OAuth token |
199 // status, display name, display email) is to be treated as ephemeral. | 219 // status, display name, display email) is to be treated as ephemeral. |
200 virtual bool IsUserNonCryptohomeDataEphemeral( | 220 virtual bool IsUserNonCryptohomeDataEphemeral( |
201 const std::string& email) const = 0; | 221 const std::string& email) const = 0; |
202 | 222 |
203 virtual void AddObserver(Observer* obs) = 0; | 223 virtual void AddObserver(Observer* obs) = 0; |
204 virtual void RemoveObserver(Observer* obs) = 0; | 224 virtual void RemoveObserver(Observer* obs) = 0; |
205 | 225 |
206 virtual void NotifyLocalStateChanged() = 0; | 226 virtual void NotifyLocalStateChanged() = 0; |
207 }; | 227 }; |
208 | 228 |
209 } // namespace chromeos | 229 } // namespace chromeos |
210 | 230 |
211 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ | 231 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ |
OLD | NEW |