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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_FLOW_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_FLOW_H_
8 #include "base/compiler_specific.h"
9 #include "chrome/browser/chromeos/login/login_status_consumer.h"
10 #include "chrome/browser/chromeos/login/user.h"
11 #include "chrome/browser/profiles/profile.h"
15 class LoginDisplayHost
;
16 // Defines possible variants of user flow upon logging in.
17 // See UserManager::SetUserFlow for usage contract.
21 virtual ~UserFlow() = 0;
22 // Indicates if screen locking should be enabled or disabled for a flow.
23 virtual bool CanLockScreen() = 0;
24 virtual bool ShouldShowSettings() = 0;
25 virtual bool ShouldLaunchBrowser() = 0;
26 virtual bool ShouldSkipPostLoginScreens() = 0;
27 virtual bool HandleLoginFailure(const LoginFailure
& failure
) = 0;
28 virtual void HandleLoginSuccess(const UserContext
& context
) = 0;
29 virtual bool HandlePasswordChangeDetected() = 0;
30 virtual void HandleOAuthTokenStatusChange(User::OAuthTokenStatus status
) = 0;
31 virtual void LaunchExtraSteps(Profile
* profile
) = 0;
33 void set_host(LoginDisplayHost
* host
) {
37 LoginDisplayHost
* host() {
42 LoginDisplayHost
* host_
;
45 // UserFlow implementation for regular login flow.
46 class DefaultUserFlow
: public UserFlow
{
48 virtual ~DefaultUserFlow();
50 virtual bool CanLockScreen() OVERRIDE
;
51 virtual bool ShouldShowSettings() OVERRIDE
;
52 virtual bool ShouldLaunchBrowser() OVERRIDE
;
53 virtual bool ShouldSkipPostLoginScreens() OVERRIDE
;
54 virtual bool HandleLoginFailure(const LoginFailure
& failure
) OVERRIDE
;
55 virtual void HandleLoginSuccess(const UserContext
& context
) OVERRIDE
;
56 virtual bool HandlePasswordChangeDetected() OVERRIDE
;
57 virtual void HandleOAuthTokenStatusChange(User::OAuthTokenStatus status
)
59 virtual void LaunchExtraSteps(Profile
* profile
) OVERRIDE
;
62 // UserFlow stub for non-regular flows.
63 class ExtendedUserFlow
: public UserFlow
{
65 explicit ExtendedUserFlow(const std::string
& user_id
);
66 virtual ~ExtendedUserFlow();
68 virtual bool ShouldShowSettings() OVERRIDE
;
71 // Subclasses can call this method to unregister flow in the next event.
72 virtual void UnregisterFlowSoon();
73 std::string
user_id() {
81 } // namespace chromeos
83 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_FLOW_H_