| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/sync/glue/sync_start_util.h" | 5 #include "ios/chrome/browser/sync/glue/sync_start_util.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "components/browser_sync/profile_sync_service.h" | 10 #include "components/browser_sync/profile_sync_service.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 return; | 28 return; |
| 29 } | 29 } |
| 30 | 30 |
| 31 ios::ChromeBrowserState* browser_state = | 31 ios::ChromeBrowserState* browser_state = |
| 32 browser_state_manager->GetBrowserState(browser_state_path); | 32 browser_state_manager->GetBrowserState(browser_state_path); |
| 33 if (!browser_state) { | 33 if (!browser_state) { |
| 34 DVLOG(2) << "ChromeBrowserState not found, can't start sync."; | 34 DVLOG(2) << "ChromeBrowserState not found, can't start sync."; |
| 35 return; | 35 return; |
| 36 } | 36 } |
| 37 | 37 |
| 38 syncer::SyncService* sync_service = | 38 sync_driver::SyncService* sync_service = |
| 39 IOSChromeProfileSyncServiceFactory::GetForBrowserState(browser_state); | 39 IOSChromeProfileSyncServiceFactory::GetForBrowserState(browser_state); |
| 40 if (!sync_service) { | 40 if (!sync_service) { |
| 41 DVLOG(2) << "No SyncService for browser state, can't start sync."; | 41 DVLOG(2) << "No SyncService for browser state, can't start sync."; |
| 42 return; | 42 return; |
| 43 } | 43 } |
| 44 sync_service->OnDataTypeRequestsSyncStartup(type); | 44 sync_service->OnDataTypeRequestsSyncStartup(type); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void StartSyncProxy(const base::FilePath& browser_state_path, | 47 void StartSyncProxy(const base::FilePath& browser_state_path, |
| 48 syncer::ModelType type) { | 48 syncer::ModelType type) { |
| 49 web::WebThread::PostTask( | 49 web::WebThread::PostTask( |
| 50 web::WebThread::UI, FROM_HERE, | 50 web::WebThread::UI, FROM_HERE, |
| 51 base::Bind(&StartSyncOnUIThread, browser_state_path, type)); | 51 base::Bind(&StartSyncOnUIThread, browser_state_path, type)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 } // namespace | 54 } // namespace |
| 55 | 55 |
| 56 namespace sync_start_util { | 56 namespace sync_start_util { |
| 57 | 57 |
| 58 syncer::SyncableService::StartSyncFlare GetFlareForSyncableService( | 58 syncer::SyncableService::StartSyncFlare GetFlareForSyncableService( |
| 59 const base::FilePath& browser_state_path) { | 59 const base::FilePath& browser_state_path) { |
| 60 return base::Bind(&StartSyncProxy, browser_state_path); | 60 return base::Bind(&StartSyncProxy, browser_state_path); |
| 61 } | 61 } |
| 62 | 62 |
| 63 } // namespace sync_start_util | 63 } // namespace sync_start_util |
| 64 } // namespace ios | 64 } // namespace ios |
| OLD | NEW |