| 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/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chromeos/login/auth/auth_status_consumer.h" | 10 #include "chromeos/login/auth/auth_status_consumer.h" |
| 11 #include "components/user_manager/user.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 |
| 25 // Provides ability to alter command line before session has started. |
| 26 virtual void AppendAdditionalCommandLineSwitches() = 0; |
| 27 |
| 24 // Indicates if screen locking should be enabled or disabled for a flow. | 28 // Indicates if screen locking should be enabled or disabled for a flow. |
| 25 virtual bool CanLockScreen() = 0; | 29 virtual bool CanLockScreen() = 0; |
| 26 virtual bool ShouldShowSettings() = 0; | 30 virtual bool ShouldShowSettings() = 0; |
| 27 virtual bool ShouldLaunchBrowser() = 0; | 31 virtual bool ShouldLaunchBrowser() = 0; |
| 28 virtual bool ShouldSkipPostLoginScreens() = 0; | 32 virtual bool ShouldSkipPostLoginScreens() = 0; |
| 29 virtual bool SupportsEarlyRestartToApplyFlags() = 0; | 33 virtual bool SupportsEarlyRestartToApplyFlags() = 0; |
| 30 virtual bool HandleLoginFailure(const AuthFailure& failure) = 0; | 34 virtual bool HandleLoginFailure(const AuthFailure& failure) = 0; |
| 31 virtual void HandleLoginSuccess(const UserContext& context) = 0; | 35 virtual void HandleLoginSuccess(const UserContext& context) = 0; |
| 32 virtual bool HandlePasswordChangeDetected() = 0; | 36 virtual bool HandlePasswordChangeDetected() = 0; |
| 33 virtual void HandleOAuthTokenStatusChange( | 37 virtual void HandleOAuthTokenStatusChange( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 44 | 48 |
| 45 private: | 49 private: |
| 46 LoginDisplayHost* host_; | 50 LoginDisplayHost* host_; |
| 47 }; | 51 }; |
| 48 | 52 |
| 49 // UserFlow implementation for regular login flow. | 53 // UserFlow implementation for regular login flow. |
| 50 class DefaultUserFlow : public UserFlow { | 54 class DefaultUserFlow : public UserFlow { |
| 51 public: | 55 public: |
| 52 virtual ~DefaultUserFlow(); | 56 virtual ~DefaultUserFlow(); |
| 53 | 57 |
| 58 virtual void AppendAdditionalCommandLineSwitches() override; |
| 54 virtual bool CanLockScreen() override; | 59 virtual bool CanLockScreen() override; |
| 55 virtual bool ShouldShowSettings() override; | 60 virtual bool ShouldShowSettings() override; |
| 56 virtual bool ShouldLaunchBrowser() override; | 61 virtual bool ShouldLaunchBrowser() override; |
| 57 virtual bool ShouldSkipPostLoginScreens() override; | 62 virtual bool ShouldSkipPostLoginScreens() override; |
| 58 virtual bool SupportsEarlyRestartToApplyFlags() override; | 63 virtual bool SupportsEarlyRestartToApplyFlags() override; |
| 59 virtual bool HandleLoginFailure(const AuthFailure& failure) override; | 64 virtual bool HandleLoginFailure(const AuthFailure& failure) override; |
| 60 virtual void HandleLoginSuccess(const UserContext& context) override; | 65 virtual void HandleLoginSuccess(const UserContext& context) override; |
| 61 virtual bool HandlePasswordChangeDetected() override; | 66 virtual bool HandlePasswordChangeDetected() override; |
| 62 virtual void HandleOAuthTokenStatusChange( | 67 virtual void HandleOAuthTokenStatusChange( |
| 63 user_manager::User::OAuthTokenStatus status) override; | 68 user_manager::User::OAuthTokenStatus status) override; |
| 64 virtual void LaunchExtraSteps(Profile* profile) override; | 69 virtual void LaunchExtraSteps(Profile* profile) override; |
| 65 }; | 70 }; |
| 66 | 71 |
| 67 // UserFlow stub for non-regular flows. | 72 // UserFlow stub for non-regular flows. |
| 68 class ExtendedUserFlow : public UserFlow { | 73 class ExtendedUserFlow : public UserFlow { |
| 69 public: | 74 public: |
| 70 explicit ExtendedUserFlow(const std::string& user_id); | 75 explicit ExtendedUserFlow(const std::string& user_id); |
| 71 virtual ~ExtendedUserFlow(); | 76 virtual ~ExtendedUserFlow(); |
| 72 | 77 |
| 78 virtual void AppendAdditionalCommandLineSwitches() override; |
| 73 virtual bool ShouldShowSettings() override; | 79 virtual bool ShouldShowSettings() override; |
| 80 virtual void HandleOAuthTokenStatusChange( |
| 81 user_manager::User::OAuthTokenStatus status) override; |
| 74 | 82 |
| 75 protected: | 83 protected: |
| 76 // Subclasses can call this method to unregister flow in the next event. | 84 // Subclasses can call this method to unregister flow in the next event. |
| 77 virtual void UnregisterFlowSoon(); | 85 virtual void UnregisterFlowSoon(); |
| 78 std::string user_id() { | 86 std::string user_id() { |
| 79 return user_id_; | 87 return user_id_; |
| 80 } | 88 } |
| 81 | 89 |
| 82 private: | 90 private: |
| 83 std::string user_id_; | 91 std::string user_id_; |
| 84 }; | 92 }; |
| 85 | 93 |
| 86 } // namespace chromeos | 94 } // namespace chromeos |
| 87 | 95 |
| 88 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_FLOW_H_ | 96 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_FLOW_H_ |
| OLD | NEW |