Home | History | Annotate | Download | only in login
      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/user_manager.h"
      9 
     10 namespace chromeos {
     11 
     12 namespace {
     13 
     14 void UnregisterFlow(const std::string& user_id) {
     15   UserManager::Get()->ResetUserFlow(user_id);
     16 }
     17 
     18 } // namespace
     19 
     20 
     21 UserFlow::UserFlow() : host_(NULL) {}
     22 
     23 UserFlow::~UserFlow() {}
     24 
     25 DefaultUserFlow::~DefaultUserFlow() {}
     26 
     27 bool DefaultUserFlow::ShouldShowSettings() {
     28   return true;
     29 }
     30 
     31 bool DefaultUserFlow::ShouldLaunchBrowser() {
     32   return true;
     33 }
     34 
     35 bool DefaultUserFlow::ShouldSkipPostLoginScreens() {
     36   return false;
     37 }
     38 
     39 bool DefaultUserFlow::HandleLoginFailure(const LoginFailure& failure) {
     40   return false;
     41 }
     42 
     43 bool DefaultUserFlow::HandlePasswordChangeDetected() {
     44   return false;
     45 }
     46 
     47 void DefaultUserFlow::HandleOAuthTokenStatusChange(
     48     User::OAuthTokenStatus status) {
     49 }
     50 
     51 void DefaultUserFlow::LaunchExtraSteps(Profile* profile) {
     52 }
     53 
     54 ExtendedUserFlow::ExtendedUserFlow(const std::string& user_id)
     55     : user_id_(user_id) {
     56 }
     57 
     58 ExtendedUserFlow::~ExtendedUserFlow() {
     59 }
     60 
     61 bool ExtendedUserFlow::ShouldShowSettings() {
     62   return true;
     63 }
     64 
     65 void ExtendedUserFlow::UnregisterFlowSoon() {
     66   std::string id_copy(user_id());
     67   base::MessageLoop::current()->PostTask(FROM_HERE,
     68       base::Bind(&UnregisterFlow,
     69                  id_copy));
     70 }
     71 
     72 }  // namespace chromeos
     73