Fix infinite recursion on hiding panel when created during fullscreen mode.
[chromium-blink-merge.git] / chrome / browser / chromeos / login / user_flow.h
blob12527633976e090d2e45b8ee5aa2c80d4be83708
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"
13 namespace chromeos {
15 class LoginDisplayHost;
16 // Defines possible variants of user flow upon logging in.
17 // See UserManager::SetUserFlow for usage contract.
18 class UserFlow {
19 public:
20 UserFlow();
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) {
34 host_ = host;
37 LoginDisplayHost* host() {
38 return host_;
41 private:
42 LoginDisplayHost* host_;
45 // UserFlow implementation for regular login flow.
46 class DefaultUserFlow : public UserFlow {
47 public:
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)
58 OVERRIDE;
59 virtual void LaunchExtraSteps(Profile* profile) OVERRIDE;
62 // UserFlow stub for non-regular flows.
63 class ExtendedUserFlow : public UserFlow {
64 public:
65 explicit ExtendedUserFlow(const std::string& user_id);
66 virtual ~ExtendedUserFlow();
68 virtual bool ShouldShowSettings() OVERRIDE;
70 protected:
71 // Subclasses can call this method to unregister flow in the next event.
72 virtual void UnregisterFlowSoon();
73 std::string user_id() {
74 return user_id_;
77 private:
78 std::string user_id_;
81 } // namespace chromeos
83 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_FLOW_H_