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 <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
16 #include "base/location.h" | 16 #include "base/location.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.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/string16.h" | 20 #include "base/string16.h" |
21 #include "base/time.h" | 21 #include "base/time.h" |
22 #include "base/timer.h" | 22 #include "base/timer.h" |
| 23 #include "chrome/browser/invalidation/invalidation_frontend.h" |
| 24 #include "chrome/browser/invalidation/invalidator_storage.h" |
23 #include "chrome/browser/profiles/profile_keyed_service.h" | 25 #include "chrome/browser/profiles/profile_keyed_service.h" |
24 #include "chrome/browser/signin/signin_global_error.h" | 26 #include "chrome/browser/signin/signin_global_error.h" |
25 #include "chrome/browser/sync/backend_unrecoverable_error_handler.h" | 27 #include "chrome/browser/sync/backend_unrecoverable_error_handler.h" |
26 #include "chrome/browser/sync/failed_datatypes_handler.h" | 28 #include "chrome/browser/sync/failed_datatypes_handler.h" |
27 #include "chrome/browser/sync/glue/data_type_controller.h" | 29 #include "chrome/browser/sync/glue/data_type_controller.h" |
28 #include "chrome/browser/sync/glue/data_type_manager.h" | 30 #include "chrome/browser/sync/glue/data_type_manager.h" |
29 #include "chrome/browser/sync/glue/data_type_manager_observer.h" | 31 #include "chrome/browser/sync/glue/data_type_manager_observer.h" |
30 #include "chrome/browser/sync/glue/sync_backend_host.h" | 32 #include "chrome/browser/sync/glue/sync_backend_host.h" |
31 #include "chrome/browser/sync/invalidation_frontend.h" | |
32 #include "chrome/browser/sync/invalidations/invalidator_storage.h" | |
33 #include "chrome/browser/sync/profile_sync_service_base.h" | 33 #include "chrome/browser/sync/profile_sync_service_base.h" |
34 #include "chrome/browser/sync/profile_sync_service_observer.h" | 34 #include "chrome/browser/sync/profile_sync_service_observer.h" |
35 #include "chrome/browser/sync/sync_prefs.h" | 35 #include "chrome/browser/sync/sync_prefs.h" |
36 #include "content/public/browser/notification_observer.h" | 36 #include "content/public/browser/notification_observer.h" |
37 #include "content/public/browser/notification_registrar.h" | 37 #include "content/public/browser/notification_registrar.h" |
38 #include "content/public/browser/notification_types.h" | 38 #include "content/public/browser/notification_types.h" |
39 #include "google_apis/gaia/google_service_auth_error.h" | 39 #include "google_apis/gaia/google_service_auth_error.h" |
40 #include "googleurl/src/gurl.h" | 40 #include "googleurl/src/gurl.h" |
41 #include "sync/internal_api/public/base/model_type.h" | 41 #include "sync/internal_api/public/base/model_type.h" |
42 #include "sync/internal_api/public/engine/model_safe_worker.h" | 42 #include "sync/internal_api/public/engine/model_safe_worker.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // data from the sync server. | 155 // data from the sync server. |
156 // | 156 // |
157 class ProfileSyncService : public ProfileSyncServiceBase, | 157 class ProfileSyncService : public ProfileSyncServiceBase, |
158 public browser_sync::SyncFrontend, | 158 public browser_sync::SyncFrontend, |
159 public browser_sync::SyncPrefObserver, | 159 public browser_sync::SyncPrefObserver, |
160 public browser_sync::DataTypeManagerObserver, | 160 public browser_sync::DataTypeManagerObserver, |
161 public SigninGlobalError::AuthStatusProvider, | 161 public SigninGlobalError::AuthStatusProvider, |
162 public syncer::UnrecoverableErrorHandler, | 162 public syncer::UnrecoverableErrorHandler, |
163 public content::NotificationObserver, | 163 public content::NotificationObserver, |
164 public ProfileKeyedService, | 164 public ProfileKeyedService, |
165 public InvalidationFrontend { | 165 public invalidation::InvalidationFrontend { |
166 public: | 166 public: |
167 typedef browser_sync::SyncBackendHost::Status Status; | 167 typedef browser_sync::SyncBackendHost::Status Status; |
168 | 168 |
169 enum SyncEventCodes { | 169 enum SyncEventCodes { |
170 MIN_SYNC_EVENT_CODE = 0, | 170 MIN_SYNC_EVENT_CODE = 0, |
171 | 171 |
172 // Events starting the sync service. | 172 // Events starting the sync service. |
173 START_FROM_NTP = 1, // Sync was started from the ad in NTP | 173 START_FROM_NTP = 1, // Sync was started from the ad in NTP |
174 START_FROM_WRENCH = 2, // Sync was started from the Wrench menu. | 174 START_FROM_WRENCH = 2, // Sync was started from the Wrench menu. |
175 START_FROM_OPTIONS = 3, // Sync was started from Wrench->Options. | 175 START_FROM_OPTIONS = 3, // Sync was started from Wrench->Options. |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 scoped_ptr<ProfileSyncComponentsFactory> factory_; | 807 scoped_ptr<ProfileSyncComponentsFactory> factory_; |
808 | 808 |
809 // The profile whose data we are synchronizing. | 809 // The profile whose data we are synchronizing. |
810 Profile* profile_; | 810 Profile* profile_; |
811 | 811 |
812 // The class that handles getting, setting, and persisting sync | 812 // The class that handles getting, setting, and persisting sync |
813 // preferences. | 813 // preferences. |
814 browser_sync::SyncPrefs sync_prefs_; | 814 browser_sync::SyncPrefs sync_prefs_; |
815 | 815 |
816 // TODO(tim): Move this to InvalidationService, once it exists. Bug 124137. | 816 // TODO(tim): Move this to InvalidationService, once it exists. Bug 124137. |
817 browser_sync::InvalidatorStorage invalidator_storage_; | 817 invalidation::InvalidatorStorage invalidator_storage_; |
818 | 818 |
819 // TODO(ncarter): Put this in a profile, once there is UI for it. | 819 // TODO(ncarter): Put this in a profile, once there is UI for it. |
820 // This specifies where to find the sync server. | 820 // This specifies where to find the sync server. |
821 GURL sync_service_url_; | 821 GURL sync_service_url_; |
822 | 822 |
823 // The last time we detected a successful transition from SYNCING state. | 823 // The last time we detected a successful transition from SYNCING state. |
824 // Our backend notifies us whenever we should take a new snapshot. | 824 // Our backend notifies us whenever we should take a new snapshot. |
825 base::Time last_synced_time_; | 825 base::Time last_synced_time_; |
826 | 826 |
827 // The time that StartUp() is called. This member is zero if StartUp() has | 827 // The time that StartUp() is called. This member is zero if StartUp() has |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_; | 947 syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_; |
948 | 948 |
949 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 949 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
950 }; | 950 }; |
951 | 951 |
952 bool ShouldShowActionOnUI( | 952 bool ShouldShowActionOnUI( |
953 const syncer::SyncProtocolError& error); | 953 const syncer::SyncProtocolError& error); |
954 | 954 |
955 | 955 |
956 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 956 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |