| 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 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 18 #include "base/string16.h" | 18 #include "base/string16.h" |
| 19 #include "base/time.h" | 19 #include "base/time.h" |
| 20 #include "base/timer.h" | 20 #include "base/timer.h" |
| 21 #include "chrome/browser/api/sync/profile_sync_service_base.h" | 21 #include "chrome/browser/api/sync/profile_sync_service_base.h" |
| 22 #include "chrome/browser/api/sync/profile_sync_service_observer.h" | 22 #include "chrome/browser/api/sync/profile_sync_service_observer.h" |
| 23 #include "chrome/browser/profiles/profile_keyed_service.h" | 23 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 24 #include "chrome/browser/signin/signin_global_error.h" |
| 24 #include "chrome/browser/sync/backend_unrecoverable_error_handler.h" | 25 #include "chrome/browser/sync/backend_unrecoverable_error_handler.h" |
| 25 #include "chrome/browser/sync/failed_datatypes_handler.h" | 26 #include "chrome/browser/sync/failed_datatypes_handler.h" |
| 26 #include "chrome/browser/sync/glue/data_type_controller.h" | 27 #include "chrome/browser/sync/glue/data_type_controller.h" |
| 27 #include "chrome/browser/sync/glue/data_type_manager.h" | 28 #include "chrome/browser/sync/glue/data_type_manager.h" |
| 28 #include "chrome/browser/sync/glue/data_type_manager_observer.h" | 29 #include "chrome/browser/sync/glue/data_type_manager_observer.h" |
| 29 #include "chrome/browser/sync/glue/sync_backend_host.h" | 30 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 30 #include "chrome/browser/sync/invalidation_frontend.h" | 31 #include "chrome/browser/sync/invalidation_frontend.h" |
| 31 #include "chrome/browser/sync/invalidations/invalidator_storage.h" | 32 #include "chrome/browser/sync/invalidations/invalidator_storage.h" |
| 32 #include "chrome/browser/sync/sync_prefs.h" | 33 #include "chrome/browser/sync/sync_prefs.h" |
| 33 #include "content/public/browser/notification_observer.h" | 34 #include "content/public/browser/notification_observer.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 // | 149 // |
| 149 // When initial sync is complete, the UI code should call | 150 // When initial sync is complete, the UI code should call |
| 150 // SetSyncSetupCompleted() followed by SetSetupInProgress(false) - this will | 151 // SetSyncSetupCompleted() followed by SetSetupInProgress(false) - this will |
| 151 // tell the sync engine that setup is completed and it can begin downloading | 152 // tell the sync engine that setup is completed and it can begin downloading |
| 152 // data from the sync server. | 153 // data from the sync server. |
| 153 // | 154 // |
| 154 class ProfileSyncService : public ProfileSyncServiceBase, | 155 class ProfileSyncService : public ProfileSyncServiceBase, |
| 155 public browser_sync::SyncFrontend, | 156 public browser_sync::SyncFrontend, |
| 156 public browser_sync::SyncPrefObserver, | 157 public browser_sync::SyncPrefObserver, |
| 157 public browser_sync::DataTypeManagerObserver, | 158 public browser_sync::DataTypeManagerObserver, |
| 159 public SigninGlobalError::AuthStatusProvider, |
| 158 public syncer::UnrecoverableErrorHandler, | 160 public syncer::UnrecoverableErrorHandler, |
| 159 public content::NotificationObserver, | 161 public content::NotificationObserver, |
| 160 public ProfileKeyedService, | 162 public ProfileKeyedService, |
| 161 public InvalidationFrontend { | 163 public InvalidationFrontend { |
| 162 public: | 164 public: |
| 163 typedef browser_sync::SyncBackendHost::Status Status; | 165 typedef browser_sync::SyncBackendHost::Status Status; |
| 164 | 166 |
| 165 enum SyncEventCodes { | 167 enum SyncEventCodes { |
| 166 MIN_SYNC_EVENT_CODE = 0, | 168 MIN_SYNC_EVENT_CODE = 0, |
| 167 | 169 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 // command-line switches). | 400 // command-line switches). |
| 399 // Profile::IsSyncAccessible() is probably a better signal than this function. | 401 // Profile::IsSyncAccessible() is probably a better signal than this function. |
| 400 // This function can be called from any thread, and the implementation doesn't | 402 // This function can be called from any thread, and the implementation doesn't |
| 401 // assume it's running on the UI thread. | 403 // assume it's running on the UI thread. |
| 402 static bool IsSyncEnabled(); | 404 static bool IsSyncEnabled(); |
| 403 | 405 |
| 404 // Returns whether sync is managed, i.e. controlled by configuration | 406 // Returns whether sync is managed, i.e. controlled by configuration |
| 405 // management. If so, the user is not allowed to configure sync. | 407 // management. If so, the user is not allowed to configure sync. |
| 406 bool IsManaged() const; | 408 bool IsManaged() const; |
| 407 | 409 |
| 410 // SigninGlobalError::AuthStatusProvider implementation. |
| 411 virtual GoogleServiceAuthError GetAuthStatus() const OVERRIDE; |
| 412 |
| 408 // syncer::UnrecoverableErrorHandler implementation. | 413 // syncer::UnrecoverableErrorHandler implementation. |
| 409 virtual void OnUnrecoverableError( | 414 virtual void OnUnrecoverableError( |
| 410 const tracked_objects::Location& from_here, | 415 const tracked_objects::Location& from_here, |
| 411 const std::string& message) OVERRIDE; | 416 const std::string& message) OVERRIDE; |
| 412 | 417 |
| 413 // Called when a datatype wishes to disable itself due to having hit an | 418 // Called when a datatype wishes to disable itself due to having hit an |
| 414 // unrecoverable error. | 419 // unrecoverable error. |
| 415 virtual void DisableBrokenDatatype( | 420 virtual void DisableBrokenDatatype( |
| 416 syncer::ModelType type, | 421 syncer::ModelType type, |
| 417 const tracked_objects::Location& from_here, | 422 const tracked_objects::Location& from_here, |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_; | 896 syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_; |
| 892 | 897 |
| 893 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 898 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
| 894 }; | 899 }; |
| 895 | 900 |
| 896 bool ShouldShowActionOnUI( | 901 bool ShouldShowActionOnUI( |
| 897 const syncer::SyncProtocolError& error); | 902 const syncer::SyncProtocolError& error); |
| 898 | 903 |
| 899 | 904 |
| 900 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 905 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| OLD | NEW |