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