blob: c487e26505cdfd3bc236d3b6b9b9dcb6613a5e8e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_FLOW_H_
#define CHROME_BROWSER_CHROMEOS_LOGIN_USER_FLOW_H_
#include "base/compiler_specific.h"
#include "chrome/browser/profiles/profile.h"
#include "chromeos/login/auth/auth_status_consumer.h"
#include "components/user_manager/user.h"
namespace chromeos {
class UserContext;
class LoginDisplayHost;
// Defines possible variants of user flow upon logging in.
// See UserManager::SetUserFlow for usage contract.
class UserFlow {
public:
UserFlow();
virtual ~UserFlow() = 0;
// Indicates if screen locking should be enabled or disabled for a flow.
virtual bool CanLockScreen() = 0;
virtual bool ShouldShowSettings() = 0;
virtual bool ShouldLaunchBrowser() = 0;
virtual bool ShouldSkipPostLoginScreens() = 0;
virtual bool HandleLoginFailure(const AuthFailure& failure) = 0;
virtual void HandleLoginSuccess(const UserContext& context) = 0;
virtual bool HandlePasswordChangeDetected() = 0;
virtual void HandleOAuthTokenStatusChange(
user_manager::User::OAuthTokenStatus status) = 0;
virtual void LaunchExtraSteps(Profile* profile) = 0;
void set_host(LoginDisplayHost* host) {
host_ = host;
}
LoginDisplayHost* host() {
return host_;
}
private:
LoginDisplayHost* host_;
};
// UserFlow implementation for regular login flow.
class DefaultUserFlow : public UserFlow {
public:
virtual ~DefaultUserFlow();
virtual bool CanLockScreen() OVERRIDE;
virtual bool ShouldShowSettings() OVERRIDE;
virtual bool ShouldLaunchBrowser() OVERRIDE;
virtual bool ShouldSkipPostLoginScreens() OVERRIDE;
virtual bool HandleLoginFailure(const AuthFailure& failure) OVERRIDE;
virtual void HandleLoginSuccess(const UserContext& context) OVERRIDE;
virtual bool HandlePasswordChangeDetected() OVERRIDE;
virtual void HandleOAuthTokenStatusChange(
user_manager::User::OAuthTokenStatus status) OVERRIDE;
virtual void LaunchExtraSteps(Profile* profile) OVERRIDE;
};
// UserFlow stub for non-regular flows.
class ExtendedUserFlow : public UserFlow {
public:
explicit ExtendedUserFlow(const std::string& user_id);
virtual ~ExtendedUserFlow();
virtual bool ShouldShowSettings() OVERRIDE;
protected:
// Subclasses can call this method to unregister flow in the next event.
virtual void UnregisterFlowSoon();
std::string user_id() {
return user_id_;
}
private:
std::string user_id_;
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_FLOW_H_
|