| 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 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/location.h" | 15 #include "base/location.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
| 20 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
| 21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
| 22 #include "base/timer/timer.h" | 22 #include "base/timer/timer.h" |
| 23 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 23 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 24 #include "chrome/browser/sync/backend_unrecoverable_error_handler.h" | 24 #include "chrome/browser/sync/backend_unrecoverable_error_handler.h" |
| 25 #include "chrome/browser/sync/backup_rollback_controller.h" | 25 #include "chrome/browser/sync/backup_rollback_controller.h" |
| 26 #include "chrome/browser/sync/glue/device_info_sync_service.h" |
| 26 #include "chrome/browser/sync/glue/local_device_info_provider.h" | 27 #include "chrome/browser/sync/glue/local_device_info_provider.h" |
| 27 #include "chrome/browser/sync/glue/sync_backend_host.h" | 28 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 28 #include "chrome/browser/sync/glue/synced_device_tracker.h" | |
| 29 #include "chrome/browser/sync/profile_sync_service_base.h" | 29 #include "chrome/browser/sync/profile_sync_service_base.h" |
| 30 #include "chrome/browser/sync/profile_sync_service_observer.h" | 30 #include "chrome/browser/sync/profile_sync_service_observer.h" |
| 31 #include "chrome/browser/sync/protocol_event_observer.h" | 31 #include "chrome/browser/sync/protocol_event_observer.h" |
| 32 #include "chrome/browser/sync/sessions/sessions_sync_manager.h" | 32 #include "chrome/browser/sync/sessions/sessions_sync_manager.h" |
| 33 #include "chrome/browser/sync/startup_controller.h" | 33 #include "chrome/browser/sync/startup_controller.h" |
| 34 #include "components/keyed_service/core/keyed_service.h" | 34 #include "components/keyed_service/core/keyed_service.h" |
| 35 #include "components/signin/core/browser/signin_manager_base.h" | 35 #include "components/signin/core/browser/signin_manager_base.h" |
| 36 #include "components/sync_driver/data_type_controller.h" | 36 #include "components/sync_driver/data_type_controller.h" |
| 37 #include "components/sync_driver/data_type_encryption_handler.h" | 37 #include "components/sync_driver/data_type_encryption_handler.h" |
| 38 #include "components/sync_driver/data_type_manager.h" | 38 #include "components/sync_driver/data_type_manager.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 59 class SupervisedUserSigninManagerWrapper; | 59 class SupervisedUserSigninManagerWrapper; |
| 60 class SyncErrorController; | 60 class SyncErrorController; |
| 61 class SyncTypePreferenceProvider; | 61 class SyncTypePreferenceProvider; |
| 62 | 62 |
| 63 namespace base { | 63 namespace base { |
| 64 class CommandLine; | 64 class CommandLine; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 namespace browser_sync { | 67 namespace browser_sync { |
| 68 class BackendMigrator; | 68 class BackendMigrator; |
| 69 class DeviceInfo; | |
| 70 class FaviconCache; | 69 class FaviconCache; |
| 71 class JsController; | 70 class JsController; |
| 72 class OpenTabsUIDelegate; | 71 class OpenTabsUIDelegate; |
| 73 | 72 |
| 74 namespace sessions { | 73 namespace sessions { |
| 75 class SyncSessionSnapshot; | 74 class SyncSessionSnapshot; |
| 76 } // namespace sessions | 75 } // namespace sessions |
| 77 } // namespace browser_sync | 76 } // namespace browser_sync |
| 78 | 77 |
| 79 namespace sync_driver { | 78 namespace sync_driver { |
| 80 class ChangeProcessor; | 79 class ChangeProcessor; |
| 81 class DataTypeManager; | 80 class DataTypeManager; |
| 82 } // namespace sync_driver | 81 } // namespace sync_driver |
| 83 | 82 |
| 84 namespace syncer { | 83 namespace syncer { |
| 85 class BaseTransaction; | 84 class BaseTransaction; |
| 86 class NetworkResources; | 85 class NetworkResources; |
| 87 struct CommitCounters; | 86 struct CommitCounters; |
| 88 struct StatusCounters; | 87 struct StatusCounters; |
| 89 struct SyncCredentials; | 88 struct SyncCredentials; |
| 90 struct UpdateCounters; | 89 struct UpdateCounters; |
| 91 struct UserShare; | 90 struct UserShare; |
| 92 } // namespace syncer | 91 } // namespace syncer |
| 93 | 92 |
| 94 namespace sync_pb { | 93 namespace sync_pb { |
| 95 class EncryptedData; | 94 class EncryptedData; |
| 96 } // namespace sync_pb | 95 } // namespace sync_pb |
| 97 | 96 |
| 97 using browser_sync::DeviceInfoSyncService; |
| 98 using browser_sync::LocalDeviceInfoProvider; | 98 using browser_sync::LocalDeviceInfoProvider; |
| 99 using browser_sync::SessionsSyncManager; | 99 using browser_sync::SessionsSyncManager; |
| 100 | 100 |
| 101 // ProfileSyncService is the layer between browser subsystems like bookmarks, | 101 // ProfileSyncService is the layer between browser subsystems like bookmarks, |
| 102 // and the sync backend. Each subsystem is logically thought of as being | 102 // and the sync backend. Each subsystem is logically thought of as being |
| 103 // a sync datatype. | 103 // a sync datatype. |
| 104 // | 104 // |
| 105 // Individual datatypes can, at any point, be in a variety of stages of being | 105 // Individual datatypes can, at any point, be in a variety of stages of being |
| 106 // "enabled". Here are some specific terms for concepts used in this class: | 106 // "enabled". Here are some specific terms for concepts used in this class: |
| 107 // | 107 // |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 // currently syncing, returns NULL. | 367 // currently syncing, returns NULL. |
| 368 virtual browser_sync::OpenTabsUIDelegate* GetOpenTabsUIDelegate(); | 368 virtual browser_sync::OpenTabsUIDelegate* GetOpenTabsUIDelegate(); |
| 369 | 369 |
| 370 // Returns the SyncedWindowDelegatesGetter from the embedded sessions manager. | 370 // Returns the SyncedWindowDelegatesGetter from the embedded sessions manager. |
| 371 virtual browser_sync::SyncedWindowDelegatesGetter* | 371 virtual browser_sync::SyncedWindowDelegatesGetter* |
| 372 GetSyncedWindowDelegatesGetter() const; | 372 GetSyncedWindowDelegatesGetter() const; |
| 373 | 373 |
| 374 // Returns the SyncableService for syncer::SESSIONS. | 374 // Returns the SyncableService for syncer::SESSIONS. |
| 375 virtual syncer::SyncableService* GetSessionsSyncableService(); | 375 virtual syncer::SyncableService* GetSessionsSyncableService(); |
| 376 | 376 |
| 377 // Returns the SyncableService for syncer::DEVICE_INFO. |
| 378 virtual syncer::SyncableService* GetDeviceInfoSyncableService(); |
| 379 |
| 377 // Returns DeviceInfo provider for the local device. | 380 // Returns DeviceInfo provider for the local device. |
| 378 virtual browser_sync::LocalDeviceInfoProvider* GetLocalDeviceInfoProvider(); | 381 virtual browser_sync::LocalDeviceInfoProvider* GetLocalDeviceInfoProvider(); |
| 379 | 382 |
| 380 // Returns sync's representation of the device info for a client identified | 383 // Returns synced devices tracker. If DEVICE_INFO model type isn't yet |
| 381 // by |client_id|. Return value is an empty scoped ptr if the device info | 384 // enabled or syncing, returns NULL. |
| 382 // is unavailable. | 385 virtual browser_sync::DeviceInfoTracker* GetDeviceInfoTracker() const; |
| 383 virtual scoped_ptr<browser_sync::DeviceInfo> GetDeviceInfo( | |
| 384 const std::string& client_id) const; | |
| 385 | |
| 386 // Gets the device info for all devices signed into the account associated | |
| 387 // with this profile. | |
| 388 virtual ScopedVector<browser_sync::DeviceInfo> GetAllSignedInDevices() const; | |
| 389 | |
| 390 // Notifies the observer of any device info changes. | |
| 391 virtual void AddObserverForDeviceInfoChange( | |
| 392 browser_sync::SyncedDeviceTracker::Observer* observer); | |
| 393 | |
| 394 // Removes the observer from device info notification. | |
| 395 virtual void RemoveObserverForDeviceInfoChange( | |
| 396 browser_sync::SyncedDeviceTracker::Observer* observer); | |
| 397 | 386 |
| 398 // Fills state_map with a map of current data types that are possible to | 387 // Fills state_map with a map of current data types that are possible to |
| 399 // sync, as well as their states. | 388 // sync, as well as their states. |
| 400 void GetDataTypeControllerStates( | 389 void GetDataTypeControllerStates( |
| 401 sync_driver::DataTypeController::StateMap* state_map) const; | 390 sync_driver::DataTypeController::StateMap* state_map) const; |
| 402 | 391 |
| 403 // Disables sync for user. Use ShowLoginDialog to enable. | 392 // Disables sync for user. Use ShowLoginDialog to enable. |
| 404 virtual void DisableForUser(); | 393 virtual void DisableForUser(); |
| 405 | 394 |
| 406 // Disables sync for the user and prevents it from starting on next restart. | 395 // Disables sync for the user and prevents it from starting on next restart. |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 // Return sync token status. | 758 // Return sync token status. |
| 770 SyncTokenStatus GetSyncTokenStatus() const; | 759 SyncTokenStatus GetSyncTokenStatus() const; |
| 771 | 760 |
| 772 browser_sync::FaviconCache* GetFaviconCache(); | 761 browser_sync::FaviconCache* GetFaviconCache(); |
| 773 | 762 |
| 774 // Overrides the NetworkResources used for Sync connections. | 763 // Overrides the NetworkResources used for Sync connections. |
| 775 // This function takes ownership of |network_resources|. | 764 // This function takes ownership of |network_resources|. |
| 776 void OverrideNetworkResourcesForTest( | 765 void OverrideNetworkResourcesForTest( |
| 777 scoped_ptr<syncer::NetworkResources> network_resources); | 766 scoped_ptr<syncer::NetworkResources> network_resources); |
| 778 | 767 |
| 779 virtual bool IsSessionsDataTypeControllerRunning() const; | 768 virtual bool IsDataTypeControllerRunning(syncer::ModelType type) const; |
| 780 | 769 |
| 781 BackendMode backend_mode() const { | 770 BackendMode backend_mode() const { |
| 782 return backend_mode_; | 771 return backend_mode_; |
| 783 } | 772 } |
| 784 | 773 |
| 785 // Helpers for testing rollback. | 774 // Helpers for testing rollback. |
| 786 void SetBrowsingDataRemoverObserverForTesting( | 775 void SetBrowsingDataRemoverObserverForTesting( |
| 787 BrowsingDataRemover::Observer* observer); | 776 BrowsingDataRemover::Observer* observer); |
| 788 void SetClearingBrowseringDataForTesting(base::Callback< | 777 void SetClearingBrowseringDataForTesting(base::Callback< |
| 789 void(BrowsingDataRemover::Observer*, Profile*, base::Time, base::Time)> | 778 void(BrowsingDataRemover::Observer*, Profile*, base::Time, base::Time)> |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1135 syncer::ConnectionStatus connection_status_; | 1124 syncer::ConnectionStatus connection_status_; |
| 1136 base::Time token_request_time_; | 1125 base::Time token_request_time_; |
| 1137 base::Time token_receive_time_; | 1126 base::Time token_receive_time_; |
| 1138 GoogleServiceAuthError last_get_token_error_; | 1127 GoogleServiceAuthError last_get_token_error_; |
| 1139 base::Time next_token_request_time_; | 1128 base::Time next_token_request_time_; |
| 1140 | 1129 |
| 1141 scoped_ptr<LocalDeviceInfoProvider> local_device_; | 1130 scoped_ptr<LocalDeviceInfoProvider> local_device_; |
| 1142 | 1131 |
| 1143 // Locally owned SyncableService implementations. | 1132 // Locally owned SyncableService implementations. |
| 1144 scoped_ptr<SessionsSyncManager> sessions_sync_manager_; | 1133 scoped_ptr<SessionsSyncManager> sessions_sync_manager_; |
| 1134 scoped_ptr<DeviceInfoSyncService> device_info_sync_service_; |
| 1145 | 1135 |
| 1146 scoped_ptr<syncer::NetworkResources> network_resources_; | 1136 scoped_ptr<syncer::NetworkResources> network_resources_; |
| 1147 | 1137 |
| 1148 browser_sync::StartupController startup_controller_; | 1138 browser_sync::StartupController startup_controller_; |
| 1149 | 1139 |
| 1150 browser_sync::BackupRollbackController backup_rollback_controller_; | 1140 browser_sync::BackupRollbackController backup_rollback_controller_; |
| 1151 | 1141 |
| 1152 // Mode of current backend. | 1142 // Mode of current backend. |
| 1153 BackendMode backend_mode_; | 1143 BackendMode backend_mode_; |
| 1154 | 1144 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1171 BrowsingDataRemover::Observer* browsing_data_remover_observer_; | 1161 BrowsingDataRemover::Observer* browsing_data_remover_observer_; |
| 1172 | 1162 |
| 1173 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 1163 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
| 1174 }; | 1164 }; |
| 1175 | 1165 |
| 1176 bool ShouldShowActionOnUI( | 1166 bool ShouldShowActionOnUI( |
| 1177 const syncer::SyncProtocolError& error); | 1167 const syncer::SyncProtocolError& error); |
| 1178 | 1168 |
| 1179 | 1169 |
| 1180 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 1170 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| OLD | NEW |