| 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 "chrome/browser/sync/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "chrome/browser/prefs/pref_service_syncable.h" | 35 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 36 #include "chrome/browser/profiles/profile.h" | 36 #include "chrome/browser/profiles/profile.h" |
| 37 #include "chrome/browser/services/gcm/gcm_profile_service.h" | 37 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
| 38 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 38 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
| 39 #include "chrome/browser/signin/about_signin_internals_factory.h" | 39 #include "chrome/browser/signin/about_signin_internals_factory.h" |
| 40 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 40 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
| 41 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 41 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 42 #include "chrome/browser/signin/signin_manager_factory.h" | 42 #include "chrome/browser/signin/signin_manager_factory.h" |
| 43 #include "chrome/browser/sync/backend_migrator.h" | 43 #include "chrome/browser/sync/backend_migrator.h" |
| 44 #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" | 44 #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" |
| 45 #include "chrome/browser/sync/glue/device_info.h" | |
| 46 #include "chrome/browser/sync/glue/favicon_cache.h" | 45 #include "chrome/browser/sync/glue/favicon_cache.h" |
| 47 #include "chrome/browser/sync/glue/sync_backend_host.h" | 46 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 48 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" | 47 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" |
| 49 #include "chrome/browser/sync/glue/sync_start_util.h" | 48 #include "chrome/browser/sync/glue/sync_start_util.h" |
| 50 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" | 49 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" |
| 51 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" | 50 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" |
| 52 #include "chrome/browser/sync/sessions/notification_service_sessions_router.h" | 51 #include "chrome/browser/sync/sessions/notification_service_sessions_router.h" |
| 53 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" | 52 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" |
| 54 #include "chrome/browser/sync/sync_error_controller.h" | 53 #include "chrome/browser/sync/sync_error_controller.h" |
| 55 #include "chrome/browser/sync/sync_type_preference_provider.h" | 54 #include "chrome/browser/sync/sync_type_preference_provider.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 67 #include "components/invalidation/invalidation_service.h" | 66 #include "components/invalidation/invalidation_service.h" |
| 68 #include "components/invalidation/profile_invalidation_provider.h" | 67 #include "components/invalidation/profile_invalidation_provider.h" |
| 69 #include "components/password_manager/core/browser/password_store.h" | 68 #include "components/password_manager/core/browser/password_store.h" |
| 70 #include "components/pref_registry/pref_registry_syncable.h" | 69 #include "components/pref_registry/pref_registry_syncable.h" |
| 71 #include "components/signin/core/browser/about_signin_internals.h" | 70 #include "components/signin/core/browser/about_signin_internals.h" |
| 72 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 71 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 73 #include "components/signin/core/browser/signin_manager.h" | 72 #include "components/signin/core/browser/signin_manager.h" |
| 74 #include "components/signin/core/browser/signin_metrics.h" | 73 #include "components/signin/core/browser/signin_metrics.h" |
| 75 #include "components/sync_driver/change_processor.h" | 74 #include "components/sync_driver/change_processor.h" |
| 76 #include "components/sync_driver/data_type_controller.h" | 75 #include "components/sync_driver/data_type_controller.h" |
| 76 #include "components/sync_driver/device_info.h" |
| 77 #include "components/sync_driver/pref_names.h" | 77 #include "components/sync_driver/pref_names.h" |
| 78 #include "components/sync_driver/system_encryptor.h" | 78 #include "components/sync_driver/system_encryptor.h" |
| 79 #include "components/sync_driver/user_selectable_sync_type.h" | 79 #include "components/sync_driver/user_selectable_sync_type.h" |
| 80 #include "content/public/browser/browser_thread.h" | 80 #include "content/public/browser/browser_thread.h" |
| 81 #include "content/public/browser/notification_details.h" | 81 #include "content/public/browser/notification_details.h" |
| 82 #include "content/public/browser/notification_service.h" | 82 #include "content/public/browser/notification_service.h" |
| 83 #include "content/public/browser/notification_source.h" | 83 #include "content/public/browser/notification_source.h" |
| 84 #include "net/cookies/cookie_monster.h" | 84 #include "net/cookies/cookie_monster.h" |
| 85 #include "net/url_request/url_request_context_getter.h" | 85 #include "net/url_request/url_request_context_getter.h" |
| 86 #include "sync/api/sync_error.h" | 86 #include "sync/api/sync_error.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 98 #include "sync/util/cryptographer.h" | 98 #include "sync/util/cryptographer.h" |
| 99 #include "ui/base/l10n/l10n_util.h" | 99 #include "ui/base/l10n/l10n_util.h" |
| 100 #include "ui/base/l10n/time_format.h" | 100 #include "ui/base/l10n/time_format.h" |
| 101 | 101 |
| 102 #if defined(OS_ANDROID) | 102 #if defined(OS_ANDROID) |
| 103 #include "sync/internal_api/public/read_transaction.h" | 103 #include "sync/internal_api/public/read_transaction.h" |
| 104 #endif | 104 #endif |
| 105 | 105 |
| 106 using browser_sync::NotificationServiceSessionsRouter; | 106 using browser_sync::NotificationServiceSessionsRouter; |
| 107 using browser_sync::ProfileSyncServiceStartBehavior; | 107 using browser_sync::ProfileSyncServiceStartBehavior; |
| 108 using browser_sync::SessionsSyncManager; |
| 108 using browser_sync::SyncBackendHost; | 109 using browser_sync::SyncBackendHost; |
| 109 using sync_driver::ChangeProcessor; | 110 using sync_driver::ChangeProcessor; |
| 110 using sync_driver::DataTypeController; | 111 using sync_driver::DataTypeController; |
| 111 using sync_driver::DataTypeManager; | 112 using sync_driver::DataTypeManager; |
| 112 using sync_driver::DataTypeStatusTable; | 113 using sync_driver::DataTypeStatusTable; |
| 114 using sync_driver::DeviceInfoSyncService; |
| 113 using syncer::ModelType; | 115 using syncer::ModelType; |
| 114 using syncer::ModelTypeSet; | 116 using syncer::ModelTypeSet; |
| 115 using syncer::JsBackend; | 117 using syncer::JsBackend; |
| 116 using syncer::JsController; | 118 using syncer::JsController; |
| 117 using syncer::JsEventDetails; | 119 using syncer::JsEventDetails; |
| 118 using syncer::JsEventHandler; | 120 using syncer::JsEventHandler; |
| 119 using syncer::ModelSafeRoutingInfo; | 121 using syncer::ModelSafeRoutingInfo; |
| 120 using syncer::SyncCredentials; | 122 using syncer::SyncCredentials; |
| 121 using syncer::SyncProtocolError; | 123 using syncer::SyncProtocolError; |
| 122 using syncer::WeakHandle; | 124 using syncer::WeakHandle; |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 | 446 |
| 445 browser_sync::FaviconCache* ProfileSyncService::GetFaviconCache() { | 447 browser_sync::FaviconCache* ProfileSyncService::GetFaviconCache() { |
| 446 return sessions_sync_manager_->GetFaviconCache(); | 448 return sessions_sync_manager_->GetFaviconCache(); |
| 447 } | 449 } |
| 448 | 450 |
| 449 browser_sync::SyncedWindowDelegatesGetter* | 451 browser_sync::SyncedWindowDelegatesGetter* |
| 450 ProfileSyncService::GetSyncedWindowDelegatesGetter() const { | 452 ProfileSyncService::GetSyncedWindowDelegatesGetter() const { |
| 451 return sessions_sync_manager_->GetSyncedWindowDelegatesGetter(); | 453 return sessions_sync_manager_->GetSyncedWindowDelegatesGetter(); |
| 452 } | 454 } |
| 453 | 455 |
| 454 browser_sync::DeviceInfoTracker* ProfileSyncService::GetDeviceInfoTracker() | 456 sync_driver::DeviceInfoTracker* ProfileSyncService::GetDeviceInfoTracker() |
| 455 const { | 457 const { |
| 456 if (!IsDataTypeControllerRunning(syncer::DEVICE_INFO)) | 458 if (!IsDataTypeControllerRunning(syncer::DEVICE_INFO)) |
| 457 return NULL; | 459 return NULL; |
| 458 | 460 |
| 459 return device_info_sync_service_.get(); | 461 return device_info_sync_service_.get(); |
| 460 } | 462 } |
| 461 | 463 |
| 462 browser_sync::LocalDeviceInfoProvider* | 464 sync_driver::LocalDeviceInfoProvider* |
| 463 ProfileSyncService::GetLocalDeviceInfoProvider() { | 465 ProfileSyncService::GetLocalDeviceInfoProvider() { |
| 464 return local_device_.get(); | 466 return local_device_.get(); |
| 465 } | 467 } |
| 466 | 468 |
| 467 void ProfileSyncService::GetDataTypeControllerStates( | 469 void ProfileSyncService::GetDataTypeControllerStates( |
| 468 DataTypeController::StateMap* state_map) const { | 470 DataTypeController::StateMap* state_map) const { |
| 469 for (DataTypeController::TypeMap::const_iterator iter = | 471 for (DataTypeController::TypeMap::const_iterator iter = |
| 470 directory_data_type_controllers_.begin(); | 472 directory_data_type_controllers_.begin(); |
| 471 iter != directory_data_type_controllers_.end(); | 473 iter != directory_data_type_controllers_.end(); |
| 472 ++iter) | 474 ++iter) |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 else | 1116 else |
| 1115 PostBackendInitialization(); | 1117 PostBackendInitialization(); |
| 1116 } | 1118 } |
| 1117 | 1119 |
| 1118 void ProfileSyncService::OnSyncCycleCompleted() { | 1120 void ProfileSyncService::OnSyncCycleCompleted() { |
| 1119 UpdateLastSyncedTime(); | 1121 UpdateLastSyncedTime(); |
| 1120 if (IsDataTypeControllerRunning(syncer::SESSIONS)) { | 1122 if (IsDataTypeControllerRunning(syncer::SESSIONS)) { |
| 1121 // Trigger garbage collection of old sessions now that we've downloaded | 1123 // Trigger garbage collection of old sessions now that we've downloaded |
| 1122 // any new session data. | 1124 // any new session data. |
| 1123 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( | 1125 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( |
| 1124 &browser_sync::SessionsSyncManager::DoGarbageCollection, | 1126 &SessionsSyncManager::DoGarbageCollection, |
| 1125 base::AsWeakPtr(sessions_sync_manager_.get()))); | 1127 base::AsWeakPtr(sessions_sync_manager_.get()))); |
| 1126 } | 1128 } |
| 1127 DVLOG(2) << "Notifying observers sync cycle completed"; | 1129 DVLOG(2) << "Notifying observers sync cycle completed"; |
| 1128 NotifySyncCycleCompleted(); | 1130 NotifySyncCycleCompleted(); |
| 1129 } | 1131 } |
| 1130 | 1132 |
| 1131 void ProfileSyncService::OnExperimentsChanged( | 1133 void ProfileSyncService::OnExperimentsChanged( |
| 1132 const syncer::Experiments& experiments) { | 1134 const syncer::Experiments& experiments) { |
| 1133 if (current_experiments_.Matches(experiments)) | 1135 if (current_experiments_.Matches(experiments)) |
| 1134 return; | 1136 return; |
| (...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2720 true)); | 2722 true)); |
| 2721 } | 2723 } |
| 2722 | 2724 |
| 2723 bool ProfileSyncService::NeedBackup() const { | 2725 bool ProfileSyncService::NeedBackup() const { |
| 2724 return need_backup_; | 2726 return need_backup_; |
| 2725 } | 2727 } |
| 2726 | 2728 |
| 2727 base::Time ProfileSyncService::GetDeviceBackupTimeForTesting() const { | 2729 base::Time ProfileSyncService::GetDeviceBackupTimeForTesting() const { |
| 2728 return device_info_sync_service_->GetLocalDeviceBackupTime(); | 2730 return device_info_sync_service_->GetLocalDeviceBackupTime(); |
| 2729 } | 2731 } |
| OLD | NEW |