user_flow.cc revision cedac228d2dd51db4b79ea1e72c7f249408ee061
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/user_manager.h"
9
10namespace chromeos {
11
12namespace {
13
14void UnregisterFlow(const std::string& user_id) {
15  UserManager::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::HandleLoginFailure(const LoginFailure& failure) {
44  return false;
45}
46
47void DefaultUserFlow::HandleLoginSuccess(const UserContext& context) {}
48
49bool DefaultUserFlow::HandlePasswordChangeDetected() {
50  return false;
51}
52
53void DefaultUserFlow::HandleOAuthTokenStatusChange(
54    User::OAuthTokenStatus status) {
55}
56
57void DefaultUserFlow::LaunchExtraSteps(Profile* profile) {
58}
59
60ExtendedUserFlow::ExtendedUserFlow(const std::string& user_id)
61    : user_id_(user_id) {
62}
63
64ExtendedUserFlow::~ExtendedUserFlow() {
65}
66
67bool ExtendedUserFlow::ShouldShowSettings() {
68  return true;
69}
70
71void ExtendedUserFlow::UnregisterFlowSoon() {
72  std::string id_copy(user_id());
73  base::MessageLoop::current()->PostTask(FROM_HERE,
74      base::Bind(&UnregisterFlow,
75                 id_copy));
76}
77
78}  // namespace chromeos
79