Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / chromeos / login / user_flow.h
blobcfb64b0cefb870fa25a0b1eb3f16e274de435d07
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 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) {
31 host_ = host;
34 LoginDisplayHost* host() {
35 return host_;
38 private:
39 LoginDisplayHost* host_;
42 // UserFlow implementation for regular login flow.
43 class DefaultUserFlow : public UserFlow {
44 public:
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)
53 OVERRIDE;
54 virtual void LaunchExtraSteps(Profile* profile) OVERRIDE;
57 // UserFlow stub for non-regular flows.
58 class ExtendedUserFlow : public UserFlow {
59 public:
60 explicit ExtendedUserFlow(const std::string& user_id);
61 virtual ~ExtendedUserFlow();
63 virtual bool ShouldShowSettings() OVERRIDE;
65 protected:
66 // Subclasses can call this method to unregister flow in the next event.
67 virtual void UnregisterFlowSoon();
68 std::string user_id() {
69 return user_id_;
72 private:
73 std::string user_id_;
76 } // namespace chromeos
78 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_FLOW_H_