| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/singleton.h" |
| 9 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| 10 #include "chrome/common/pref_service.h" | 11 #include "chrome/common/pref_service.h" |
| 11 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 13 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
| 13 #include "chrome/browser/sync/profile_sync_service.h" | 14 #include "chrome/browser/sync/profile_sync_service.h" |
| 14 #include "chrome/browser/sync/sync_setup_flow.h" | 15 #include "chrome/browser/sync/sync_setup_flow.h" |
| 15 #include "chrome/common/jstemplate_builder.h" | 16 #include "chrome/common/jstemplate_builder.h" |
| 16 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
| 17 #include "grit/app_resources.h" | 18 #include "grit/app_resources.h" |
| 18 #include "grit/browser_resources.h" | 19 #include "grit/browser_resources.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 135 } |
| 135 | 136 |
| 136 SyncSetupWizard::SyncSetupWizard(ProfileSyncService* service) | 137 SyncSetupWizard::SyncSetupWizard(ProfileSyncService* service) |
| 137 : service_(service), | 138 : service_(service), |
| 138 flow_container_(new SyncSetupFlowContainer()) { | 139 flow_container_(new SyncSetupFlowContainer()) { |
| 139 // Register data sources for HTML content we require. | 140 // Register data sources for HTML content we require. |
| 140 // g_browser_process and/or io_thread may not exist during testing. | 141 // g_browser_process and/or io_thread may not exist during testing. |
| 141 if (g_browser_process && g_browser_process->io_thread()) { | 142 if (g_browser_process && g_browser_process->io_thread()) { |
| 142 // Add our network layer data source for 'cloudy' URLs. | 143 // Add our network layer data source for 'cloudy' URLs. |
| 143 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, | 144 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, |
| 144 NewRunnableMethod(&chrome_url_data_manager, | 145 NewRunnableMethod(Singleton<ChromeURLDataManager>().get(), |
| 145 &ChromeURLDataManager::AddDataSource, | 146 &ChromeURLDataManager::AddDataSource, |
| 146 new SyncResourcesSource())); | 147 new SyncResourcesSource())); |
| 147 } | 148 } |
| 148 } | 149 } |
| 149 | 150 |
| 150 SyncSetupWizard::~SyncSetupWizard() { | 151 SyncSetupWizard::~SyncSetupWizard() { |
| 151 delete flow_container_; | 152 delete flow_container_; |
| 152 } | 153 } |
| 153 | 154 |
| 154 void SyncSetupWizard::Step(State advance_state) { | 155 void SyncSetupWizard::Step(State advance_state) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 188 } |
| 188 | 189 |
| 189 // static | 190 // static |
| 190 SyncSetupWizard::State SyncSetupWizard::GetEndStateForDiscreteRun( | 191 SyncSetupWizard::State SyncSetupWizard::GetEndStateForDiscreteRun( |
| 191 State start_state) { | 192 State start_state) { |
| 192 State result = start_state == GAIA_LOGIN ? GAIA_SUCCESS : DONE; | 193 State result = start_state == GAIA_LOGIN ? GAIA_SUCCESS : DONE; |
| 193 DCHECK_NE(DONE, result) << | 194 DCHECK_NE(DONE, result) << |
| 194 "Invalid start state for discrete run: " << start_state; | 195 "Invalid start state for discrete run: " << start_state; |
| 195 return result; | 196 return result; |
| 196 } | 197 } |
| OLD | NEW |