| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/sync/sync_setup_wizard.h" | 5 #include "chrome/browser/sync/sync_setup_wizard.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <ostream> | 8 #include <ostream> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 flow_container_->set_flow(SyncSetupFlow::Run(service_, flow_container_, | 84 flow_container_->set_flow(SyncSetupFlow::Run(service_, flow_container_, |
| 85 advance_state, GetEndStateForDiscreteRun(advance_state))); | 85 advance_state, GetEndStateForDiscreteRun(advance_state))); |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool SyncSetupWizard::IsVisible() const { | 89 bool SyncSetupWizard::IsVisible() const { |
| 90 return flow_container_->get_flow() != NULL && | 90 return flow_container_->get_flow() != NULL && |
| 91 flow_container_->get_flow()->IsAttached(); | 91 flow_container_->get_flow()->IsAttached(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 // Returns true iff Sync is using OAuth-based authentication. See also |
| 95 // GetLoginState(). |
| 96 // static |
| 97 bool SyncSetupWizard::IsUsingOAuth() { |
| 98 return CommandLine::ForCurrentProcess()->HasSwitch( |
| 99 switches::kEnableSyncOAuth); |
| 100 } |
| 101 |
| 94 // static | 102 // static |
| 95 SyncSetupWizard::State SyncSetupWizard::GetLoginState() { | 103 SyncSetupWizard::State SyncSetupWizard::GetLoginState() { |
| 96 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableSyncOAuth)) | 104 return IsUsingOAuth() ? |
| 97 return SyncSetupWizard::OAUTH_LOGIN; | 105 SyncSetupWizard::OAUTH_LOGIN : |
| 98 return SyncSetupWizard::GAIA_LOGIN; | 106 SyncSetupWizard::GAIA_LOGIN; |
| 99 } | 107 } |
| 100 | 108 |
| 101 void SyncSetupWizard::Focus() { | 109 void SyncSetupWizard::Focus() { |
| 102 SyncSetupFlow* flow = flow_container_->get_flow(); | 110 SyncSetupFlow* flow = flow_container_->get_flow(); |
| 103 if (flow) | 111 if (flow) |
| 104 flow->Focus(); | 112 flow->Focus(); |
| 105 } | 113 } |
| 106 | 114 |
| 107 SyncSetupFlow* SyncSetupWizard::AttachSyncSetupHandler( | 115 SyncSetupFlow* SyncSetupWizard::AttachSyncSetupHandler( |
| 108 SyncSetupFlowHandler* handler) { | 116 SyncSetupFlowHandler* handler) { |
| 109 SyncSetupFlow* flow = flow_container_->get_flow(); | 117 SyncSetupFlow* flow = flow_container_->get_flow(); |
| 110 if (!flow || !flow->AttachSyncSetupHandler(handler)) | 118 if (!flow || !flow->AttachSyncSetupHandler(handler)) |
| 111 return NULL; | 119 return NULL; |
| 112 | 120 |
| 113 return flow; | 121 return flow; |
| 114 } | 122 } |
| OLD | NEW |