| 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_FLOW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_FLOW_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_FLOW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_FLOW_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "chrome/browser/chromeos/login/users/user.h" | |
| 10 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chromeos/login/auth/auth_status_consumer.h" | 10 #include "chromeos/login/auth/auth_status_consumer.h" |
| 11 #include "components/user_manager/user.h" |
| 12 | 12 |
| 13 namespace chromeos { | 13 namespace chromeos { |
| 14 | 14 |
| 15 class UserContext; | 15 class UserContext; |
| 16 | 16 |
| 17 class LoginDisplayHost; | 17 class LoginDisplayHost; |
| 18 // Defines possible variants of user flow upon logging in. | 18 // Defines possible variants of user flow upon logging in. |
| 19 // See UserManager::SetUserFlow for usage contract. | 19 // See UserManager::SetUserFlow for usage contract. |
| 20 class UserFlow { | 20 class UserFlow { |
| 21 public: | 21 public: |
| 22 UserFlow(); | 22 UserFlow(); |
| 23 virtual ~UserFlow() = 0; | 23 virtual ~UserFlow() = 0; |
| 24 // Indicates if screen locking should be enabled or disabled for a flow. | 24 // Indicates if screen locking should be enabled or disabled for a flow. |
| 25 virtual bool CanLockScreen() = 0; | 25 virtual bool CanLockScreen() = 0; |
| 26 virtual bool ShouldShowSettings() = 0; | 26 virtual bool ShouldShowSettings() = 0; |
| 27 virtual bool ShouldLaunchBrowser() = 0; | 27 virtual bool ShouldLaunchBrowser() = 0; |
| 28 virtual bool ShouldSkipPostLoginScreens() = 0; | 28 virtual bool ShouldSkipPostLoginScreens() = 0; |
| 29 virtual bool HandleLoginFailure(const AuthFailure& failure) = 0; | 29 virtual bool HandleLoginFailure(const AuthFailure& failure) = 0; |
| 30 virtual void HandleLoginSuccess(const UserContext& context) = 0; | 30 virtual void HandleLoginSuccess(const UserContext& context) = 0; |
| 31 virtual bool HandlePasswordChangeDetected() = 0; | 31 virtual bool HandlePasswordChangeDetected() = 0; |
| 32 virtual void HandleOAuthTokenStatusChange(User::OAuthTokenStatus status) = 0; | 32 virtual void HandleOAuthTokenStatusChange( |
| 33 user_manager::User::OAuthTokenStatus status) = 0; |
| 33 virtual void LaunchExtraSteps(Profile* profile) = 0; | 34 virtual void LaunchExtraSteps(Profile* profile) = 0; |
| 34 | 35 |
| 35 void set_host(LoginDisplayHost* host) { | 36 void set_host(LoginDisplayHost* host) { |
| 36 host_ = host; | 37 host_ = host; |
| 37 } | 38 } |
| 38 | 39 |
| 39 LoginDisplayHost* host() { | 40 LoginDisplayHost* host() { |
| 40 return host_; | 41 return host_; |
| 41 } | 42 } |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 LoginDisplayHost* host_; | 45 LoginDisplayHost* host_; |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 // UserFlow implementation for regular login flow. | 48 // UserFlow implementation for regular login flow. |
| 48 class DefaultUserFlow : public UserFlow { | 49 class DefaultUserFlow : public UserFlow { |
| 49 public: | 50 public: |
| 50 virtual ~DefaultUserFlow(); | 51 virtual ~DefaultUserFlow(); |
| 51 | 52 |
| 52 virtual bool CanLockScreen() OVERRIDE; | 53 virtual bool CanLockScreen() OVERRIDE; |
| 53 virtual bool ShouldShowSettings() OVERRIDE; | 54 virtual bool ShouldShowSettings() OVERRIDE; |
| 54 virtual bool ShouldLaunchBrowser() OVERRIDE; | 55 virtual bool ShouldLaunchBrowser() OVERRIDE; |
| 55 virtual bool ShouldSkipPostLoginScreens() OVERRIDE; | 56 virtual bool ShouldSkipPostLoginScreens() OVERRIDE; |
| 56 virtual bool HandleLoginFailure(const AuthFailure& failure) OVERRIDE; | 57 virtual bool HandleLoginFailure(const AuthFailure& failure) OVERRIDE; |
| 57 virtual void HandleLoginSuccess(const UserContext& context) OVERRIDE; | 58 virtual void HandleLoginSuccess(const UserContext& context) OVERRIDE; |
| 58 virtual bool HandlePasswordChangeDetected() OVERRIDE; | 59 virtual bool HandlePasswordChangeDetected() OVERRIDE; |
| 59 virtual void HandleOAuthTokenStatusChange(User::OAuthTokenStatus status) | 60 virtual void HandleOAuthTokenStatusChange( |
| 60 OVERRIDE; | 61 user_manager::User::OAuthTokenStatus status) OVERRIDE; |
| 61 virtual void LaunchExtraSteps(Profile* profile) OVERRIDE; | 62 virtual void LaunchExtraSteps(Profile* profile) OVERRIDE; |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 // UserFlow stub for non-regular flows. | 65 // UserFlow stub for non-regular flows. |
| 65 class ExtendedUserFlow : public UserFlow { | 66 class ExtendedUserFlow : public UserFlow { |
| 66 public: | 67 public: |
| 67 explicit ExtendedUserFlow(const std::string& user_id); | 68 explicit ExtendedUserFlow(const std::string& user_id); |
| 68 virtual ~ExtendedUserFlow(); | 69 virtual ~ExtendedUserFlow(); |
| 69 | 70 |
| 70 virtual bool ShouldShowSettings() OVERRIDE; | 71 virtual bool ShouldShowSettings() OVERRIDE; |
| 71 | 72 |
| 72 protected: | 73 protected: |
| 73 // Subclasses can call this method to unregister flow in the next event. | 74 // Subclasses can call this method to unregister flow in the next event. |
| 74 virtual void UnregisterFlowSoon(); | 75 virtual void UnregisterFlowSoon(); |
| 75 std::string user_id() { | 76 std::string user_id() { |
| 76 return user_id_; | 77 return user_id_; |
| 77 } | 78 } |
| 78 | 79 |
| 79 private: | 80 private: |
| 80 std::string user_id_; | 81 std::string user_id_; |
| 81 }; | 82 }; |
| 82 | 83 |
| 83 } // namespace chromeos | 84 } // namespace chromeos |
| 84 | 85 |
| 85 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_FLOW_H_ | 86 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_FLOW_H_ |
| OLD | NEW |