| 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 "chrome/browser/chromeos/login/user.h" | 10 #include "chrome/browser/chromeos/login/user.h" |
| 11 #include "chrome/browser/chromeos/login/user_flow.h" | 11 #include "chrome/browser/chromeos/login/user_flow.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 | |
| 35 // Interface that observers of UserManager must implement in order | 24 // Interface that observers of UserManager must implement in order |
| 36 // to receive notification when local state preferences is changed | 25 // to receive notification when local state preferences is changed |
| 37 class Observer { | 26 class Observer { |
| 38 public: | 27 public: |
| 39 // Called when the local state preferences is changed. | 28 // Called when the local state preferences is changed. |
| 40 virtual void LocalStateChanged(UserManager* user_manager); | 29 virtual void LocalStateChanged(UserManager* user_manager); |
| 41 | 30 |
| 42 // Called when merge session state is changed. | |
| 43 virtual void MergeSessionStateChanged(MergeSessionState state); | |
| 44 | |
| 45 protected: | 31 protected: |
| 46 virtual ~Observer(); | 32 virtual ~Observer(); |
| 47 }; | 33 }; |
| 48 | 34 |
| 49 // TODO(nkostylev): Refactor and move this observer out of UserManager. | 35 // TODO(nkostylev): Refactor and move this observer out of UserManager. |
| 50 // Observer interface that defines methods used to notify on user session / | 36 // Observer interface that defines methods used to notify on user session / |
| 51 // active user state changes. Default implementation is empty. | 37 // active user state changes. Default implementation is empty. |
| 52 class UserSessionStateObserver { | 38 class UserSessionStateObserver { |
| 53 public: | 39 public: |
| 54 // Called when active user has changed. | 40 // Called when active user has changed. |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 284 |
| 299 // Returns true if we're logged in and browser has been started i.e. | 285 // Returns true if we're logged in and browser has been started i.e. |
| 300 // browser_creator.LaunchBrowser(...) was called after sign in | 286 // browser_creator.LaunchBrowser(...) was called after sign in |
| 301 // or restart after crash. | 287 // or restart after crash. |
| 302 virtual bool IsSessionStarted() const = 0; | 288 virtual bool IsSessionStarted() const = 0; |
| 303 | 289 |
| 304 // Returns true iff browser has been restarted after crash and UserManager | 290 // Returns true iff browser has been restarted after crash and UserManager |
| 305 // finished restoring user sessions. | 291 // finished restoring user sessions. |
| 306 virtual bool UserSessionsRestored() const = 0; | 292 virtual bool UserSessionsRestored() const = 0; |
| 307 | 293 |
| 308 // Returns merge session status. | |
| 309 virtual MergeSessionState GetMergeSessionState() const = 0; | |
| 310 | |
| 311 // Changes merge session status. | |
| 312 virtual void SetMergeSessionState(MergeSessionState status) = 0; | |
| 313 | |
| 314 // Returns true when the browser has crashed and restarted during the current | 294 // Returns true when the browser has crashed and restarted during the current |
| 315 // user's session. | 295 // user's session. |
| 316 virtual bool HasBrowserRestarted() const = 0; | 296 virtual bool HasBrowserRestarted() const = 0; |
| 317 | 297 |
| 318 // Returns true if data stored or cached for the user with the given email | 298 // Returns true if data stored or cached for the user with the given email |
| 319 // address outside that user's cryptohome (wallpaper, avatar, OAuth token | 299 // address outside that user's cryptohome (wallpaper, avatar, OAuth token |
| 320 // status, display name, display email) is to be treated as ephemeral. | 300 // status, display name, display email) is to be treated as ephemeral. |
| 321 virtual bool IsUserNonCryptohomeDataEphemeral( | 301 virtual bool IsUserNonCryptohomeDataEphemeral( |
| 322 const std::string& email) const = 0; | 302 const std::string& email) const = 0; |
| 323 | 303 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 ScopedTestUserManager(); | 382 ScopedTestUserManager(); |
| 403 ~ScopedTestUserManager(); | 383 ~ScopedTestUserManager(); |
| 404 | 384 |
| 405 private: | 385 private: |
| 406 DISALLOW_COPY_AND_ASSIGN(ScopedTestUserManager); | 386 DISALLOW_COPY_AND_ASSIGN(ScopedTestUserManager); |
| 407 }; | 387 }; |
| 408 | 388 |
| 409 } // namespace chromeos | 389 } // namespace chromeos |
| 410 | 390 |
| 411 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ | 391 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ |
| OLD | NEW |