| 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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 scoped_ptr<ProfileSyncComponentsFactory> factory_; | 803 scoped_ptr<ProfileSyncComponentsFactory> factory_; |
| 804 | 804 |
| 805 // The profile whose data we are synchronizing. | 805 // The profile whose data we are synchronizing. |
| 806 Profile* profile_; | 806 Profile* profile_; |
| 807 | 807 |
| 808 // The class that handles getting, setting, and persisting sync | 808 // The class that handles getting, setting, and persisting sync |
| 809 // preferences. | 809 // preferences. |
| 810 browser_sync::SyncPrefs sync_prefs_; | 810 browser_sync::SyncPrefs sync_prefs_; |
| 811 | 811 |
| 812 // TODO(tim): Move this to InvalidationService, once it exists. Bug 124137. | 812 // TODO(tim): Move this to InvalidationService, once it exists. Bug 124137. |
| 813 browser_sync::InvalidatorStorage invalidator_storage_; | 813 invalidation::InvalidatorStorage invalidator_storage_; |
| 814 | 814 |
| 815 // TODO(ncarter): Put this in a profile, once there is UI for it. | 815 // TODO(ncarter): Put this in a profile, once there is UI for it. |
| 816 // This specifies where to find the sync server. | 816 // This specifies where to find the sync server. |
| 817 GURL sync_service_url_; | 817 GURL sync_service_url_; |
| 818 | 818 |
| 819 // The last time we detected a successful transition from SYNCING state. | 819 // The last time we detected a successful transition from SYNCING state. |
| 820 // Our backend notifies us whenever we should take a new snapshot. | 820 // Our backend notifies us whenever we should take a new snapshot. |
| 821 base::Time last_synced_time_; | 821 base::Time last_synced_time_; |
| 822 | 822 |
| 823 // The time that StartUp() is called. This member is zero if StartUp() has | 823 // The time that StartUp() is called. This member is zero if StartUp() has |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_; | 937 syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_; |
| 938 | 938 |
| 939 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 939 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
| 940 }; | 940 }; |
| 941 | 941 |
| 942 bool ShouldShowActionOnUI( | 942 bool ShouldShowActionOnUI( |
| 943 const syncer::SyncProtocolError& error); | 943 const syncer::SyncProtocolError& error); |
| 944 | 944 |
| 945 | 945 |
| 946 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 946 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| OLD | NEW |