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 virtual bool ShouldShowSettings() = 0;
23 virtual bool ShouldLaunchBrowser() = 0;
24 virtual bool ShouldSkipPostLoginScreens() = 0;
25 virtual bool HandleLoginFailure(const LoginFailure
& failure
) = 0;
26 virtual bool HandlePasswordChangeDetected() = 0;
27 virtual void HandleOAuthTokenStatusChange(User::OAuthTokenStatus status
) = 0;
28 virtual void LaunchExtraSteps(Profile
* profile
) = 0;
30 void set_host(LoginDisplayHost
* host
) {
34 LoginDisplayHost
* host() {
39 LoginDisplayHost
* host_
;
42 // UserFlow implementation for regular login flow.
43 class DefaultUserFlow
: public UserFlow
{
45 virtual ~DefaultUserFlow();
47 virtual bool ShouldShowSettings() OVERRIDE
;
48 virtual bool ShouldLaunchBrowser() OVERRIDE
;
49 virtual bool ShouldSkipPostLoginScreens() OVERRIDE
;
50 virtual bool HandleLoginFailure(const LoginFailure
& failure
) OVERRIDE
;
51 virtual bool HandlePasswordChangeDetected() OVERRIDE
;
52 virtual void HandleOAuthTokenStatusChange(User::OAuthTokenStatus status
)
54 virtual void LaunchExtraSteps(Profile
* profile
) OVERRIDE
;
57 // UserFlow stub for non-regular flows.
58 class ExtendedUserFlow
: public UserFlow
{
60 explicit ExtendedUserFlow(const std::string
& user_id
);
61 virtual ~ExtendedUserFlow();
63 virtual bool ShouldShowSettings() OVERRIDE
;
66 // Subclasses can call this method to unregister flow in the next event.
67 virtual void UnregisterFlowSoon();
68 std::string
user_id() {
76 } // namespace chromeos
78 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_FLOW_H_