Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / chromeos / login / user_flow.h
blobaa5d2558b08ee03949e85acc05304e76a8114cf3
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/profiles/profile.h"
10 #include "chromeos/login/auth/auth_status_consumer.h"
11 #include "components/user_manager/user.h"
13 namespace chromeos {
15 class UserContext;
17 class LoginDisplayHost;
18 // Defines possible variants of user flow upon logging in.
19 // See UserManager::SetUserFlow for usage contract.
20 class UserFlow {
21 public:
22 UserFlow();
23 virtual ~UserFlow() = 0;
25 // Provides ability to alter command line before session has started.
26 virtual void AppendAdditionalCommandLineSwitches() = 0;
28 // Indicates if screen locking should be enabled or disabled for a flow.
29 virtual bool CanLockScreen() = 0;
30 virtual bool ShouldShowSettings() = 0;
31 virtual bool ShouldLaunchBrowser() = 0;
32 virtual bool ShouldSkipPostLoginScreens() = 0;
33 virtual bool SupportsEarlyRestartToApplyFlags() = 0;
34 virtual bool HandleLoginFailure(const AuthFailure& failure) = 0;
35 virtual void HandleLoginSuccess(const UserContext& context) = 0;
36 virtual bool HandlePasswordChangeDetected() = 0;
37 virtual void HandleOAuthTokenStatusChange(
38 user_manager::User::OAuthTokenStatus status) = 0;
39 virtual void LaunchExtraSteps(Profile* profile) = 0;
40 void SetHost(LoginDisplayHost* host);
42 LoginDisplayHost* host() {
43 return host_;
46 private:
47 LoginDisplayHost* host_;
50 // UserFlow implementation for regular login flow.
51 class DefaultUserFlow : public UserFlow {
52 public:
53 ~DefaultUserFlow() override;
55 void AppendAdditionalCommandLineSwitches() override;
56 bool CanLockScreen() override;
57 bool ShouldShowSettings() override;
58 bool ShouldLaunchBrowser() override;
59 bool ShouldSkipPostLoginScreens() override;
60 bool SupportsEarlyRestartToApplyFlags() override;
61 bool HandleLoginFailure(const AuthFailure& failure) override;
62 void HandleLoginSuccess(const UserContext& context) override;
63 bool HandlePasswordChangeDetected() override;
64 void HandleOAuthTokenStatusChange(
65 user_manager::User::OAuthTokenStatus status) override;
66 void LaunchExtraSteps(Profile* profile) override;
69 // UserFlow stub for non-regular flows.
70 class ExtendedUserFlow : public UserFlow {
71 public:
72 explicit ExtendedUserFlow(const std::string& user_id);
73 ~ExtendedUserFlow() override;
75 void AppendAdditionalCommandLineSwitches() override;
76 bool ShouldShowSettings() override;
77 void HandleOAuthTokenStatusChange(
78 user_manager::User::OAuthTokenStatus status) override;
80 protected:
81 // Subclasses can call this method to unregister flow in the next event.
82 virtual void UnregisterFlowSoon();
83 std::string user_id() {
84 return user_id_;
87 private:
88 std::string user_id_;
91 } // namespace chromeos
93 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_FLOW_H_