| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "components/browser_sync/profile_sync_service.h" | 5 #include "components/browser_sync/profile_sync_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cstddef> | 9 #include <cstddef> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "components/signin/core/browser/signin_metrics.h" | 38 #include "components/signin/core/browser/signin_metrics.h" |
| 39 #include "components/strings/grit/components_strings.h" | 39 #include "components/strings/grit/components_strings.h" |
| 40 #include "components/sync/base/bind_to_task_runner.h" | 40 #include "components/sync/base/bind_to_task_runner.h" |
| 41 #include "components/sync/base/cryptographer.h" | 41 #include "components/sync/base/cryptographer.h" |
| 42 #include "components/sync/base/passphrase_type.h" | 42 #include "components/sync/base/passphrase_type.h" |
| 43 #include "components/sync/base/pref_names.h" | 43 #include "components/sync/base/pref_names.h" |
| 44 #include "components/sync/base/report_unrecoverable_error.h" | 44 #include "components/sync/base/report_unrecoverable_error.h" |
| 45 #include "components/sync/base/stop_source.h" | 45 #include "components/sync/base/stop_source.h" |
| 46 #include "components/sync/base/system_encryptor.h" | 46 #include "components/sync/base/system_encryptor.h" |
| 47 #include "components/sync/device_info/device_info.h" | 47 #include "components/sync/device_info/device_info.h" |
| 48 #include "components/sync/device_info/device_info_service.h" | 48 #include "components/sync/device_info/device_info_sync_bridge.h" |
| 49 #include "components/sync/device_info/device_info_sync_service.h" | 49 #include "components/sync/device_info/device_info_sync_service.h" |
| 50 #include "components/sync/device_info/device_info_tracker.h" | 50 #include "components/sync/device_info/device_info_tracker.h" |
| 51 #include "components/sync/driver/backend_migrator.h" | 51 #include "components/sync/driver/backend_migrator.h" |
| 52 #include "components/sync/driver/change_processor.h" | 52 #include "components/sync/driver/change_processor.h" |
| 53 #include "components/sync/driver/directory_data_type_controller.h" | 53 #include "components/sync/driver/directory_data_type_controller.h" |
| 54 #include "components/sync/driver/glue/sync_backend_host_impl.h" | 54 #include "components/sync/driver/glue/sync_backend_host_impl.h" |
| 55 #include "components/sync/driver/signin_manager_wrapper.h" | 55 #include "components/sync/driver/signin_manager_wrapper.h" |
| 56 #include "components/sync/driver/sync_api_component_factory.h" | 56 #include "components/sync/driver/sync_api_component_factory.h" |
| 57 #include "components/sync/driver/sync_driver_switches.h" | 57 #include "components/sync/driver/sync_driver_switches.h" |
| 58 #include "components/sync/driver/sync_error_controller.h" | 58 #include "components/sync/driver/sync_error_controller.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 88 #if defined(OS_ANDROID) | 88 #if defined(OS_ANDROID) |
| 89 #include "components/sync/syncable/read_transaction.h" | 89 #include "components/sync/syncable/read_transaction.h" |
| 90 #endif | 90 #endif |
| 91 | 91 |
| 92 using sync_sessions::SessionsSyncManager; | 92 using sync_sessions::SessionsSyncManager; |
| 93 using syncer::BackendMigrator; | 93 using syncer::BackendMigrator; |
| 94 using syncer::ChangeProcessor; | 94 using syncer::ChangeProcessor; |
| 95 using syncer::DataTypeController; | 95 using syncer::DataTypeController; |
| 96 using syncer::DataTypeManager; | 96 using syncer::DataTypeManager; |
| 97 using syncer::DataTypeStatusTable; | 97 using syncer::DataTypeStatusTable; |
| 98 using syncer::DeviceInfoService; | 98 using syncer::DeviceInfoSyncBridge; |
| 99 using syncer::DeviceInfoSyncService; | 99 using syncer::DeviceInfoSyncService; |
| 100 using syncer::JsBackend; | 100 using syncer::JsBackend; |
| 101 using syncer::JsController; | 101 using syncer::JsController; |
| 102 using syncer::JsEventDetails; | 102 using syncer::JsEventDetails; |
| 103 using syncer::JsEventHandler; | 103 using syncer::JsEventHandler; |
| 104 using syncer::ModelSafeRoutingInfo; | 104 using syncer::ModelSafeRoutingInfo; |
| 105 using syncer::ModelType; | 105 using syncer::ModelType; |
| 106 using syncer::ModelTypeChangeProcessor; | 106 using syncer::ModelTypeChangeProcessor; |
| 107 using syncer::ModelTypeSet; | 107 using syncer::ModelTypeSet; |
| 108 using syncer::ModelTypeStore; | 108 using syncer::ModelTypeStore; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 syncer::ModelTypeSet(syncer::SESSIONS))); | 285 syncer::ModelTypeSet(syncer::SESSIONS))); |
| 286 | 286 |
| 287 if (base::FeatureList::IsEnabled(switches::kSyncUSSDeviceInfo)) { | 287 if (base::FeatureList::IsEnabled(switches::kSyncUSSDeviceInfo)) { |
| 288 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( | 288 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( |
| 289 blocking_pool_->GetSequencedTaskRunnerWithShutdownBehavior( | 289 blocking_pool_->GetSequencedTaskRunnerWithShutdownBehavior( |
| 290 blocking_pool_->GetSequenceToken(), | 290 blocking_pool_->GetSequenceToken(), |
| 291 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 291 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
| 292 // TODO(skym): Stop creating leveldb files when signed out. | 292 // TODO(skym): Stop creating leveldb files when signed out. |
| 293 // TODO(skym): Verify using AsUTF8Unsafe is okay here. Should work as long | 293 // TODO(skym): Verify using AsUTF8Unsafe is okay here. Should work as long |
| 294 // as the Local State file is guaranteed to be UTF-8. | 294 // as the Local State file is guaranteed to be UTF-8. |
| 295 device_info_service_ = base::MakeUnique<DeviceInfoService>( | 295 device_info_service_ = base::MakeUnique<DeviceInfoSyncBridge>( |
| 296 local_device_.get(), | 296 local_device_.get(), |
| 297 base::Bind(&ModelTypeStore::CreateStore, syncer::DEVICE_INFO, | 297 base::Bind(&ModelTypeStore::CreateStore, syncer::DEVICE_INFO, |
| 298 directory_path_.Append(base::FilePath(kLevelDBFolderName)) | 298 directory_path_.Append(base::FilePath(kLevelDBFolderName)) |
| 299 .AsUTF8Unsafe(), | 299 .AsUTF8Unsafe(), |
| 300 blocking_task_runner), | 300 blocking_task_runner), |
| 301 base::Bind(&ModelTypeChangeProcessor::Create)); | 301 base::Bind(&ModelTypeChangeProcessor::Create)); |
| 302 } else { | 302 } else { |
| 303 device_info_sync_service_ = | 303 device_info_sync_service_ = |
| 304 base::MakeUnique<DeviceInfoSyncService>(local_device_.get()); | 304 base::MakeUnique<DeviceInfoSyncService>(local_device_.get()); |
| 305 } | 305 } |
| (...skipping 2057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2363 } | 2363 } |
| 2364 | 2364 |
| 2365 syncer::SyncableService* ProfileSyncService::GetSessionsSyncableService() { | 2365 syncer::SyncableService* ProfileSyncService::GetSessionsSyncableService() { |
| 2366 return sessions_sync_manager_.get(); | 2366 return sessions_sync_manager_.get(); |
| 2367 } | 2367 } |
| 2368 | 2368 |
| 2369 syncer::SyncableService* ProfileSyncService::GetDeviceInfoSyncableService() { | 2369 syncer::SyncableService* ProfileSyncService::GetDeviceInfoSyncableService() { |
| 2370 return device_info_sync_service_.get(); | 2370 return device_info_sync_service_.get(); |
| 2371 } | 2371 } |
| 2372 | 2372 |
| 2373 syncer::ModelTypeSyncBridge* ProfileSyncService::GetDeviceInfoService() { | 2373 syncer::ModelTypeSyncBridge* ProfileSyncService::GetDeviceInfoSyncBridge() { |
| 2374 return device_info_service_.get(); | 2374 return device_info_service_.get(); |
| 2375 } | 2375 } |
| 2376 | 2376 |
| 2377 syncer::SyncService::SyncTokenStatus ProfileSyncService::GetSyncTokenStatus() | 2377 syncer::SyncService::SyncTokenStatus ProfileSyncService::GetSyncTokenStatus() |
| 2378 const { | 2378 const { |
| 2379 SyncTokenStatus status; | 2379 SyncTokenStatus status; |
| 2380 status.connection_status_update_time = connection_status_update_time_; | 2380 status.connection_status_update_time = connection_status_update_time_; |
| 2381 status.connection_status = connection_status_; | 2381 status.connection_status = connection_status_; |
| 2382 status.token_request_time = token_request_time_; | 2382 status.token_request_time = token_request_time_; |
| 2383 status.token_receive_time = token_receive_time_; | 2383 status.token_receive_time = token_receive_time_; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2496 | 2496 |
| 2497 DCHECK(startup_controller_->IsSetupInProgress()); | 2497 DCHECK(startup_controller_->IsSetupInProgress()); |
| 2498 startup_controller_->SetSetupInProgress(false); | 2498 startup_controller_->SetSetupInProgress(false); |
| 2499 | 2499 |
| 2500 if (IsBackendInitialized()) | 2500 if (IsBackendInitialized()) |
| 2501 ReconfigureDatatypeManager(); | 2501 ReconfigureDatatypeManager(); |
| 2502 NotifyObservers(); | 2502 NotifyObservers(); |
| 2503 } | 2503 } |
| 2504 | 2504 |
| 2505 } // namespace browser_sync | 2505 } // namespace browser_sync |
| OLD | NEW |