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" | |
27 #include "chrome/browser/sync/glue/local_device_info_provider.h" | |
28 #include "chrome/browser/sync/glue/sync_backend_host.h" | 26 #include "chrome/browser/sync/glue/sync_backend_host.h" |
29 #include "chrome/browser/sync/profile_sync_service_base.h" | 27 #include "chrome/browser/sync/profile_sync_service_base.h" |
30 #include "chrome/browser/sync/profile_sync_service_observer.h" | 28 #include "chrome/browser/sync/profile_sync_service_observer.h" |
31 #include "chrome/browser/sync/protocol_event_observer.h" | 29 #include "chrome/browser/sync/protocol_event_observer.h" |
32 #include "chrome/browser/sync/sessions/sessions_sync_manager.h" | 30 #include "chrome/browser/sync/sessions/sessions_sync_manager.h" |
33 #include "chrome/browser/sync/startup_controller.h" | 31 #include "chrome/browser/sync/startup_controller.h" |
34 #include "components/keyed_service/core/keyed_service.h" | 32 #include "components/keyed_service/core/keyed_service.h" |
35 #include "components/signin/core/browser/signin_manager_base.h" | 33 #include "components/signin/core/browser/signin_manager_base.h" |
36 #include "components/sync_driver/data_type_controller.h" | 34 #include "components/sync_driver/data_type_controller.h" |
37 #include "components/sync_driver/data_type_encryption_handler.h" | 35 #include "components/sync_driver/data_type_encryption_handler.h" |
38 #include "components/sync_driver/data_type_manager.h" | 36 #include "components/sync_driver/data_type_manager.h" |
39 #include "components/sync_driver/data_type_manager_observer.h" | 37 #include "components/sync_driver/data_type_manager_observer.h" |
40 #include "components/sync_driver/data_type_status_table.h" | 38 #include "components/sync_driver/data_type_status_table.h" |
| 39 #include "components/sync_driver/device_info_sync_service.h" |
| 40 #include "components/sync_driver/local_device_info_provider.h" |
41 #include "components/sync_driver/non_blocking_data_type_manager.h" | 41 #include "components/sync_driver/non_blocking_data_type_manager.h" |
42 #include "components/sync_driver/sync_frontend.h" | 42 #include "components/sync_driver/sync_frontend.h" |
43 #include "components/sync_driver/sync_prefs.h" | 43 #include "components/sync_driver/sync_prefs.h" |
44 #include "google_apis/gaia/google_service_auth_error.h" | 44 #include "google_apis/gaia/google_service_auth_error.h" |
45 #include "google_apis/gaia/oauth2_token_service.h" | 45 #include "google_apis/gaia/oauth2_token_service.h" |
46 #include "net/base/backoff_entry.h" | 46 #include "net/base/backoff_entry.h" |
47 #include "sync/internal_api/public/base/model_type.h" | 47 #include "sync/internal_api/public/base/model_type.h" |
48 #include "sync/internal_api/public/engine/model_safe_worker.h" | 48 #include "sync/internal_api/public/engine/model_safe_worker.h" |
49 #include "sync/internal_api/public/shutdown_reason.h" | 49 #include "sync/internal_api/public/shutdown_reason.h" |
50 #include "sync/internal_api/public/sync_manager_factory.h" | 50 #include "sync/internal_api/public/sync_manager_factory.h" |
(...skipping 20 matching lines...) Expand all Loading... |
71 class OpenTabsUIDelegate; | 71 class OpenTabsUIDelegate; |
72 | 72 |
73 namespace sessions { | 73 namespace sessions { |
74 class SyncSessionSnapshot; | 74 class SyncSessionSnapshot; |
75 } // namespace sessions | 75 } // namespace sessions |
76 } // namespace browser_sync | 76 } // namespace browser_sync |
77 | 77 |
78 namespace sync_driver { | 78 namespace sync_driver { |
79 class ChangeProcessor; | 79 class ChangeProcessor; |
80 class DataTypeManager; | 80 class DataTypeManager; |
| 81 class DeviceInfoSyncService; |
| 82 class LocalDeviceInfoProvider; |
81 } // namespace sync_driver | 83 } // namespace sync_driver |
82 | 84 |
83 namespace syncer { | 85 namespace syncer { |
84 class BaseTransaction; | 86 class BaseTransaction; |
85 class NetworkResources; | 87 class NetworkResources; |
86 struct CommitCounters; | 88 struct CommitCounters; |
87 struct StatusCounters; | 89 struct StatusCounters; |
88 struct SyncCredentials; | 90 struct SyncCredentials; |
89 struct UpdateCounters; | 91 struct UpdateCounters; |
90 struct UserShare; | 92 struct UserShare; |
91 } // namespace syncer | 93 } // namespace syncer |
92 | 94 |
93 namespace sync_pb { | 95 namespace sync_pb { |
94 class EncryptedData; | 96 class EncryptedData; |
95 } // namespace sync_pb | 97 } // namespace sync_pb |
96 | 98 |
97 using browser_sync::DeviceInfoSyncService; | |
98 using browser_sync::LocalDeviceInfoProvider; | |
99 using browser_sync::SessionsSyncManager; | |
100 | |
101 // ProfileSyncService is the layer between browser subsystems like bookmarks, | 99 // ProfileSyncService is the layer between browser subsystems like bookmarks, |
102 // and the sync backend. Each subsystem is logically thought of as being | 100 // and the sync backend. Each subsystem is logically thought of as being |
103 // a sync datatype. | 101 // a sync datatype. |
104 // | 102 // |
105 // Individual datatypes can, at any point, be in a variety of stages of being | 103 // 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: | 104 // "enabled". Here are some specific terms for concepts used in this class: |
107 // | 105 // |
108 // 'Registered' (feature suppression for a datatype) | 106 // 'Registered' (feature suppression for a datatype) |
109 // | 107 // |
110 // When a datatype is registered, the user has the option of syncing it. | 108 // When a datatype is registered, the user has the option of syncing it. |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 virtual browser_sync::SyncedWindowDelegatesGetter* | 369 virtual browser_sync::SyncedWindowDelegatesGetter* |
372 GetSyncedWindowDelegatesGetter() const; | 370 GetSyncedWindowDelegatesGetter() const; |
373 | 371 |
374 // Returns the SyncableService for syncer::SESSIONS. | 372 // Returns the SyncableService for syncer::SESSIONS. |
375 virtual syncer::SyncableService* GetSessionsSyncableService(); | 373 virtual syncer::SyncableService* GetSessionsSyncableService(); |
376 | 374 |
377 // Returns the SyncableService for syncer::DEVICE_INFO. | 375 // Returns the SyncableService for syncer::DEVICE_INFO. |
378 virtual syncer::SyncableService* GetDeviceInfoSyncableService(); | 376 virtual syncer::SyncableService* GetDeviceInfoSyncableService(); |
379 | 377 |
380 // Returns DeviceInfo provider for the local device. | 378 // Returns DeviceInfo provider for the local device. |
381 virtual browser_sync::LocalDeviceInfoProvider* GetLocalDeviceInfoProvider(); | 379 virtual sync_driver::LocalDeviceInfoProvider* GetLocalDeviceInfoProvider(); |
382 | 380 |
383 // Returns synced devices tracker. If DEVICE_INFO model type isn't yet | 381 // Returns synced devices tracker. If DEVICE_INFO model type isn't yet |
384 // enabled or syncing, returns NULL. | 382 // enabled or syncing, returns NULL. |
385 virtual browser_sync::DeviceInfoTracker* GetDeviceInfoTracker() const; | 383 virtual sync_driver::DeviceInfoTracker* GetDeviceInfoTracker() const; |
386 | 384 |
387 // Fills state_map with a map of current data types that are possible to | 385 // Fills state_map with a map of current data types that are possible to |
388 // sync, as well as their states. | 386 // sync, as well as their states. |
389 void GetDataTypeControllerStates( | 387 void GetDataTypeControllerStates( |
390 sync_driver::DataTypeController::StateMap* state_map) const; | 388 sync_driver::DataTypeController::StateMap* state_map) const; |
391 | 389 |
392 // Disables sync for user. Use ShowLoginDialog to enable. | 390 // Disables sync for user. Use ShowLoginDialog to enable. |
393 virtual void DisableForUser(); | 391 virtual void DisableForUser(); |
394 | 392 |
395 // Disables sync for the user and prevents it from starting on next restart. | 393 // Disables sync for the user and prevents it from starting on next restart. |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 base::WeakPtrFactory<ProfileSyncService> startup_controller_weak_factory_; | 1118 base::WeakPtrFactory<ProfileSyncService> startup_controller_weak_factory_; |
1121 | 1119 |
1122 // States related to sync token and connection. | 1120 // States related to sync token and connection. |
1123 base::Time connection_status_update_time_; | 1121 base::Time connection_status_update_time_; |
1124 syncer::ConnectionStatus connection_status_; | 1122 syncer::ConnectionStatus connection_status_; |
1125 base::Time token_request_time_; | 1123 base::Time token_request_time_; |
1126 base::Time token_receive_time_; | 1124 base::Time token_receive_time_; |
1127 GoogleServiceAuthError last_get_token_error_; | 1125 GoogleServiceAuthError last_get_token_error_; |
1128 base::Time next_token_request_time_; | 1126 base::Time next_token_request_time_; |
1129 | 1127 |
1130 scoped_ptr<LocalDeviceInfoProvider> local_device_; | 1128 scoped_ptr<sync_driver::LocalDeviceInfoProvider> local_device_; |
1131 | 1129 |
1132 // Locally owned SyncableService implementations. | 1130 // Locally owned SyncableService implementations. |
1133 scoped_ptr<SessionsSyncManager> sessions_sync_manager_; | 1131 scoped_ptr<browser_sync::SessionsSyncManager> sessions_sync_manager_; |
1134 scoped_ptr<DeviceInfoSyncService> device_info_sync_service_; | 1132 scoped_ptr<sync_driver::DeviceInfoSyncService> device_info_sync_service_; |
1135 | 1133 |
1136 scoped_ptr<syncer::NetworkResources> network_resources_; | 1134 scoped_ptr<syncer::NetworkResources> network_resources_; |
1137 | 1135 |
1138 browser_sync::StartupController startup_controller_; | 1136 browser_sync::StartupController startup_controller_; |
1139 | 1137 |
1140 browser_sync::BackupRollbackController backup_rollback_controller_; | 1138 browser_sync::BackupRollbackController backup_rollback_controller_; |
1141 | 1139 |
1142 // Mode of current backend. | 1140 // Mode of current backend. |
1143 BackendMode backend_mode_; | 1141 BackendMode backend_mode_; |
1144 | 1142 |
(...skipping 16 matching lines...) Expand all Loading... |
1161 BrowsingDataRemover::Observer* browsing_data_remover_observer_; | 1159 BrowsingDataRemover::Observer* browsing_data_remover_observer_; |
1162 | 1160 |
1163 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 1161 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
1164 }; | 1162 }; |
1165 | 1163 |
1166 bool ShouldShowActionOnUI( | 1164 bool ShouldShowActionOnUI( |
1167 const syncer::SyncProtocolError& error); | 1165 const syncer::SyncProtocolError& error); |
1168 | 1166 |
1169 | 1167 |
1170 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 1168 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |