| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/sync/sync_setup_flow.h" | 14 #include "chrome/browser/sync/sync_setup_flow.h" |
| 15 #include "chrome/browser/sync/util/oauth.h" |
| 15 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 16 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 // If we just need to pop open an individual dialog, say to collect | 21 // If we just need to pop open an individual dialog, say to collect |
| 21 // gaia credentials in the event of a steady-state auth failure, this is | 22 // gaia credentials in the event of a steady-state auth failure, this is |
| 22 // a "discrete" run (as in not a continuous wizard flow). This returns | 23 // a "discrete" run (as in not a continuous wizard flow). This returns |
| 23 // the end state to pass to Run for a given |start_state|. | 24 // the end state to pass to Run for a given |start_state|. |
| 24 SyncSetupWizard::State GetEndStateForDiscreteRun( | 25 SyncSetupWizard::State GetEndStateForDiscreteRun( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 87 } |
| 87 } | 88 } |
| 88 | 89 |
| 89 bool SyncSetupWizard::IsVisible() const { | 90 bool SyncSetupWizard::IsVisible() const { |
| 90 return flow_container_->get_flow() != NULL && | 91 return flow_container_->get_flow() != NULL && |
| 91 flow_container_->get_flow()->IsAttached(); | 92 flow_container_->get_flow()->IsAttached(); |
| 92 } | 93 } |
| 93 | 94 |
| 94 // static | 95 // static |
| 95 SyncSetupWizard::State SyncSetupWizard::GetLoginState() { | 96 SyncSetupWizard::State SyncSetupWizard::GetLoginState() { |
| 96 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableSyncOAuth)) | 97 return browser_sync::IsUsingOAuth() ? |
| 97 return SyncSetupWizard::OAUTH_LOGIN; | 98 SyncSetupWizard::OAUTH_LOGIN : |
| 98 return SyncSetupWizard::GAIA_LOGIN; | 99 SyncSetupWizard::GAIA_LOGIN; |
| 99 } | 100 } |
| 100 | 101 |
| 101 void SyncSetupWizard::Focus() { | 102 void SyncSetupWizard::Focus() { |
| 102 SyncSetupFlow* flow = flow_container_->get_flow(); | 103 SyncSetupFlow* flow = flow_container_->get_flow(); |
| 103 if (flow) | 104 if (flow) |
| 104 flow->Focus(); | 105 flow->Focus(); |
| 105 } | 106 } |
| 106 | 107 |
| 107 SyncSetupFlow* SyncSetupWizard::AttachSyncSetupHandler( | 108 SyncSetupFlow* SyncSetupWizard::AttachSyncSetupHandler( |
| 108 SyncSetupFlowHandler* handler) { | 109 SyncSetupFlowHandler* handler) { |
| 109 SyncSetupFlow* flow = flow_container_->get_flow(); | 110 SyncSetupFlow* flow = flow_container_->get_flow(); |
| 110 if (!flow || !flow->AttachSyncSetupHandler(handler)) | 111 if (!flow || !flow->AttachSyncSetupHandler(handler)) |
| 111 return NULL; | 112 return NULL; |
| 112 | 113 |
| 113 return flow; | 114 return flow; |
| 114 } | 115 } |
| OLD | NEW |