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.
4
5#include "base/bind.h"
6#include "base/message_loop/message_loop.h"
7#include "chrome/browser/chromeos/login/user_flow.h"
8#include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
9
10namespace chromeos {
11
12namespace {
13
14void UnregisterFlow(const std::string& user_id) {
15  ChromeUserManager::Get()->ResetUserFlow(user_id);
16}
17
18} // namespace
19
20
21UserFlow::UserFlow() : host_(NULL) {}
22
23UserFlow::~UserFlow() {}
24
25DefaultUserFlow::~DefaultUserFlow() {}
26
27bool DefaultUserFlow::CanLockScreen() {
28  return true;
29}
30
31bool DefaultUserFlow::ShouldShowSettings() {
32  return true;
33}
34
35bool DefaultUserFlow::ShouldLaunchBrowser() {
36  return true;
37}
38
39bool DefaultUserFlow::ShouldSkipPostLoginScreens() {
40  return false;
41}
42
43bool DefaultUserFlow::SupportsEarlyRestartToApplyFlags() {
44  return true;
45}
46
47bool DefaultUserFlow::HandleLoginFailure(const AuthFailure& failure) {
48  return false;
49}
50
51void DefaultUserFlow::HandleLoginSuccess(const UserContext& context) {}
52
53bool DefaultUserFlow::HandlePasswordChangeDetected() {
54  return false;
55}
56
57void DefaultUserFlow::HandleOAuthTokenStatusChange(
58    user_manager::User::OAuthTokenStatus status) {
59}
60
61void DefaultUserFlow::LaunchExtraSteps(Profile* profile) {
62}
63
64ExtendedUserFlow::ExtendedUserFlow(const std::string& user_id)
65    : user_id_(user_id) {
66}
67
68ExtendedUserFlow::~ExtendedUserFlow() {
69}
70
71bool ExtendedUserFlow::ShouldShowSettings() {
72  return true;
73}
74
75void ExtendedUserFlow::UnregisterFlowSoon() {
76  std::string id_copy(user_id());
77  base::MessageLoop::current()->PostTask(FROM_HERE,
78      base::Bind(&UnregisterFlow,
79                 id_copy));
80}
81
82}  // namespace chromeos
83