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/profiles/profile_keyed_service.h" | 21 #include "chrome/browser/profiles/profile_keyed_service.h" |
22 #include "chrome/browser/sync/backend_unrecoverable_error_handler.h" | 22 #include "chrome/browser/sync/backend_unrecoverable_error_handler.h" |
23 #include "chrome/browser/sync/failed_datatypes_handler.h" | 23 #include "chrome/browser/sync/failed_datatypes_handler.h" |
24 #include "chrome/browser/sync/glue/data_type_controller.h" | 24 #include "chrome/browser/sync/glue/data_type_controller.h" |
25 #include "chrome/browser/sync/glue/data_type_manager.h" | 25 #include "chrome/browser/sync/glue/data_type_manager.h" |
26 #include "chrome/browser/sync/glue/sync_backend_host.h" | 26 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 27 #include "chrome/browser/sync/invalidation_service.h" |
27 #include "chrome/browser/sync/invalidations/invalidator_storage.h" | 28 #include "chrome/browser/sync/invalidations/invalidator_storage.h" |
28 #include "chrome/browser/sync/profile_sync_service_observer.h" | 29 #include "chrome/browser/sync/profile_sync_service_observer.h" |
29 #include "chrome/browser/sync/sync_prefs.h" | 30 #include "chrome/browser/sync/sync_prefs.h" |
30 #include "chrome/common/net/gaia/google_service_auth_error.h" | 31 #include "chrome/common/net/gaia/google_service_auth_error.h" |
31 #include "content/public/browser/notification_observer.h" | 32 #include "content/public/browser/notification_observer.h" |
32 #include "content/public/browser/notification_registrar.h" | 33 #include "content/public/browser/notification_registrar.h" |
33 #include "content/public/browser/notification_types.h" | 34 #include "content/public/browser/notification_types.h" |
34 #include "googleurl/src/gurl.h" | 35 #include "googleurl/src/gurl.h" |
35 #include "sync/internal_api/public/base/model_type.h" | 36 #include "sync/internal_api/public/base/model_type.h" |
36 #include "sync/internal_api/public/engine/model_safe_worker.h" | 37 #include "sync/internal_api/public/engine/model_safe_worker.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // | 145 // |
145 // When initial sync is complete, the UI code should call | 146 // When initial sync is complete, the UI code should call |
146 // SetSyncSetupCompleted() followed by SetSetupInProgress(false) - this will | 147 // SetSyncSetupCompleted() followed by SetSetupInProgress(false) - this will |
147 // tell the sync engine that setup is completed and it can begin downloading | 148 // tell the sync engine that setup is completed and it can begin downloading |
148 // data from the sync server. | 149 // data from the sync server. |
149 // | 150 // |
150 class ProfileSyncService : public browser_sync::SyncFrontend, | 151 class ProfileSyncService : public browser_sync::SyncFrontend, |
151 public browser_sync::SyncPrefObserver, | 152 public browser_sync::SyncPrefObserver, |
152 public syncer::UnrecoverableErrorHandler, | 153 public syncer::UnrecoverableErrorHandler, |
153 public content::NotificationObserver, | 154 public content::NotificationObserver, |
154 public ProfileKeyedService { | 155 public ProfileKeyedService, |
| 156 public InvalidationService { |
155 public: | 157 public: |
156 typedef ProfileSyncServiceObserver Observer; | 158 typedef ProfileSyncServiceObserver Observer; |
157 typedef browser_sync::SyncBackendHost::Status Status; | 159 typedef browser_sync::SyncBackendHost::Status Status; |
158 | 160 |
159 enum SyncEventCodes { | 161 enum SyncEventCodes { |
160 MIN_SYNC_EVENT_CODE = 0, | 162 MIN_SYNC_EVENT_CODE = 0, |
161 | 163 |
162 // Events starting the sync service. | 164 // Events starting the sync service. |
163 START_FROM_NTP = 1, // Sync was started from the ad in NTP | 165 START_FROM_NTP = 1, // Sync was started from the ad in NTP |
164 START_FROM_WRENCH = 2, // Sync was started from the Wrench menu. | 166 START_FROM_WRENCH = 2, // Sync was started from the Wrench menu. |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 // the initialization process) and a pre-existing auth error that just hasn't | 553 // the initialization process) and a pre-existing auth error that just hasn't |
552 // been cleared yet. Virtual for testing purposes. | 554 // been cleared yet. Virtual for testing purposes. |
553 virtual bool waiting_for_auth() const; | 555 virtual bool waiting_for_auth() const; |
554 | 556 |
555 // Updates the set of ObjectIds associated with a given |handler|. | 557 // Updates the set of ObjectIds associated with a given |handler|. |
556 // Passing an empty ObjectIdSet will unregister |handler|. | 558 // Passing an empty ObjectIdSet will unregister |handler|. |
557 // There should be at most one handler registered per object id. | 559 // There should be at most one handler registered per object id. |
558 // | 560 // |
559 // The handler -> registered ids map is persisted across restarts of | 561 // The handler -> registered ids map is persisted across restarts of |
560 // sync. | 562 // sync. |
561 void UpdateRegisteredInvalidationIds(syncer::SyncNotifierObserver* handler, | 563 virtual void UpdateRegisteredInvalidationIds( |
562 const syncer::ObjectIdSet& ids); | 564 syncer::SyncNotifierObserver* handler, |
| 565 const syncer::ObjectIdSet& ids) OVERRIDE; |
563 | 566 |
564 // ProfileKeyedService implementation. | 567 // ProfileKeyedService implementation. |
565 virtual void Shutdown() OVERRIDE; | 568 virtual void Shutdown() OVERRIDE; |
566 | 569 |
567 protected: | 570 protected: |
568 // Used by test classes that derive from ProfileSyncService. | 571 // Used by test classes that derive from ProfileSyncService. |
569 virtual browser_sync::SyncBackendHost* GetBackendForTest(); | 572 virtual browser_sync::SyncBackendHost* GetBackendForTest(); |
570 | 573 |
571 // Helper to install and configure a data type manager. | 574 // Helper to install and configure a data type manager. |
572 void ConfigureDataTypeManager(); | 575 void ConfigureDataTypeManager(); |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 syncer::SyncNotifierHelper notifier_helper_; | 845 syncer::SyncNotifierHelper notifier_helper_; |
843 | 846 |
844 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 847 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
845 }; | 848 }; |
846 | 849 |
847 bool ShouldShowActionOnUI( | 850 bool ShouldShowActionOnUI( |
848 const syncer::SyncProtocolError& error); | 851 const syncer::SyncProtocolError& error); |
849 | 852 |
850 | 853 |
851 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 854 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |