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/login_status_consumer.h" | 9 #include "chrome/browser/chromeos/login/login_status_consumer.h" |
| 10 #include "chrome/browser/profiles/profile.h" |
10 | 11 |
11 namespace chromeos { | 12 namespace chromeos { |
12 | 13 |
13 class LoginDisplayHost; | 14 class LoginDisplayHost; |
14 // Defines possible variants of user flow upon logging in. | 15 // Defines possible variants of user flow upon logging in. |
15 // See UserManager::SetUserFlow for usage contract. | 16 // See UserManager::SetUserFlow for usage contract. |
16 class UserFlow { | 17 class UserFlow { |
17 public: | 18 public: |
18 virtual ~UserFlow() = 0; | 19 virtual ~UserFlow() = 0; |
19 virtual bool ShouldLaunchBrowser() = 0; | 20 virtual bool ShouldLaunchBrowser() = 0; |
20 virtual bool ShouldSkipPostLoginScreens() = 0; | 21 virtual bool ShouldSkipPostLoginScreens() = 0; |
21 virtual bool HandleLoginFailure(const LoginFailure& failure, | 22 virtual bool HandleLoginFailure(const LoginFailure& failure, |
22 LoginDisplayHost* host) = 0; | 23 LoginDisplayHost* host) = 0; |
23 virtual bool HandlePasswordChangeDetected(LoginDisplayHost* host) = 0; | 24 virtual bool HandlePasswordChangeDetected(LoginDisplayHost* host) = 0; |
24 virtual void LaunchExtraSteps(LoginDisplayHost* host) = 0; | 25 virtual void LaunchExtraSteps(Profile* profile, LoginDisplayHost* host) = 0; |
25 }; | 26 }; |
26 | 27 |
27 // UserFlow implementation for regular login flow. | 28 // UserFlow implementation for regular login flow. |
28 class DefaultUserFlow : public UserFlow { | 29 class DefaultUserFlow : public UserFlow { |
29 public: | 30 public: |
30 virtual ~DefaultUserFlow(); | 31 virtual ~DefaultUserFlow(); |
31 | 32 |
32 virtual bool ShouldLaunchBrowser() OVERRIDE; | 33 virtual bool ShouldLaunchBrowser() OVERRIDE; |
33 virtual bool ShouldSkipPostLoginScreens() OVERRIDE; | 34 virtual bool ShouldSkipPostLoginScreens() OVERRIDE; |
34 virtual bool HandleLoginFailure(const LoginFailure& failure, | 35 virtual bool HandleLoginFailure(const LoginFailure& failure, |
35 LoginDisplayHost* host) OVERRIDE; | 36 LoginDisplayHost* host) OVERRIDE; |
36 virtual bool HandlePasswordChangeDetected(LoginDisplayHost* host) OVERRIDE; | 37 virtual bool HandlePasswordChangeDetected(LoginDisplayHost* host) OVERRIDE; |
37 virtual void LaunchExtraSteps(LoginDisplayHost* host) OVERRIDE; | 38 virtual void LaunchExtraSteps(Profile* profile, |
| 39 LoginDisplayHost* host) OVERRIDE; |
| 40 }; |
| 41 |
| 42 // UserFlow stub for non-regular flows. |
| 43 class ExtendedUserFlow : public UserFlow { |
| 44 public: |
| 45 explicit ExtendedUserFlow(const std::string& user_id); |
| 46 virtual ~ExtendedUserFlow(); |
| 47 |
| 48 protected: |
| 49 // Subclasses can call this method to unregister flow in the next event. |
| 50 virtual void UnregisterFlowSoon(); |
| 51 std::string user_id() { |
| 52 return user_id_; |
| 53 }; |
| 54 |
| 55 private: |
| 56 std::string user_id_; |
38 }; | 57 }; |
39 | 58 |
40 } // namespace chromeos | 59 } // namespace chromeos |
41 | 60 |
42 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_FLOW_H_ | 61 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_FLOW_H_ |
OLD | NEW |