OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 5 #ifndef SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
6 #define SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 6 #define SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "net/base/network_change_notifier.h" | 11 #include "net/base/network_change_notifier.h" |
12 #include "sync/base/sync_export.h" | 12 #include "sync/base/sync_export.h" |
13 #include "sync/engine/all_status.h" | 13 #include "sync/engine/all_status.h" |
14 #include "sync/engine/net/server_connection_manager.h" | 14 #include "sync/engine/net/server_connection_manager.h" |
15 #include "sync/engine/sync_engine_event_listener.h" | 15 #include "sync/engine/sync_engine_event_listener.h" |
16 #include "sync/internal_api/change_reorder_buffer.h" | 16 #include "sync/internal_api/change_reorder_buffer.h" |
17 #include "sync/internal_api/debug_info_event_listener.h" | 17 #include "sync/internal_api/debug_info_event_listener.h" |
18 #include "sync/internal_api/js_mutation_event_observer.h" | 18 #include "sync/internal_api/js_mutation_event_observer.h" |
19 #include "sync/internal_api/js_sync_encryption_handler_observer.h" | 19 #include "sync/internal_api/js_sync_encryption_handler_observer.h" |
20 #include "sync/internal_api/js_sync_manager_observer.h" | 20 #include "sync/internal_api/js_sync_manager_observer.h" |
21 #include "sync/internal_api/protocol_event_buffer.h" | 21 #include "sync/internal_api/protocol_event_buffer.h" |
22 #include "sync/internal_api/public/base/invalidator_state.h" | 22 #include "sync/internal_api/public/base/invalidator_state.h" |
23 #include "sync/internal_api/public/sync_context_proxy.h" | 23 #include "sync/internal_api/public/sync_context_proxy.h" |
24 #include "sync/internal_api/public/sync_manager.h" | 24 #include "sync/internal_api/public/sync_manager.h" |
25 #include "sync/internal_api/public/user_share.h" | 25 #include "sync/internal_api/public/user_share.h" |
26 #include "sync/internal_api/sync_encryption_handler_impl.h" | 26 #include "sync/internal_api/sync_encryption_handler_impl.h" |
27 #include "sync/js/js_backend.h" | 27 #include "sync/js/js_backend.h" |
28 #include "sync/notifier/invalidation_handler.h" | |
29 #include "sync/syncable/directory_change_delegate.h" | 28 #include "sync/syncable/directory_change_delegate.h" |
30 #include "sync/util/cryptographer.h" | 29 #include "sync/util/cryptographer.h" |
31 #include "sync/util/time.h" | 30 #include "sync/util/time.h" |
32 | 31 |
33 namespace syncer { | 32 namespace syncer { |
34 | 33 |
35 class ModelTypeRegistry; | 34 class ModelTypeRegistry; |
36 class SyncAPIServerConnectionManager; | 35 class SyncAPIServerConnectionManager; |
37 class SyncContext; | 36 class SyncContext; |
38 class TypeDebugInfoObserver; | 37 class TypeDebugInfoObserver; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 const ModelSafeRoutingInfo& routing_info) OVERRIDE; | 94 const ModelSafeRoutingInfo& routing_info) OVERRIDE; |
96 virtual void ConfigureSyncer( | 95 virtual void ConfigureSyncer( |
97 ConfigureReason reason, | 96 ConfigureReason reason, |
98 ModelTypeSet to_download, | 97 ModelTypeSet to_download, |
99 ModelTypeSet to_purge, | 98 ModelTypeSet to_purge, |
100 ModelTypeSet to_journal, | 99 ModelTypeSet to_journal, |
101 ModelTypeSet to_unapply, | 100 ModelTypeSet to_unapply, |
102 const ModelSafeRoutingInfo& new_routing_info, | 101 const ModelSafeRoutingInfo& new_routing_info, |
103 const base::Closure& ready_task, | 102 const base::Closure& ready_task, |
104 const base::Closure& retry_task) OVERRIDE; | 103 const base::Closure& retry_task) OVERRIDE; |
105 virtual void OnInvalidatorStateChange(InvalidatorState state) OVERRIDE; | 104 virtual void SetInvalidatorEnabled(bool invalidator_enabled) OVERRIDE; |
106 virtual void OnIncomingInvalidation( | 105 virtual void OnIncomingInvalidation( |
107 syncer::ModelType type, | 106 syncer::ModelType type, |
108 scoped_ptr<InvalidationInterface> invalidation) OVERRIDE; | 107 scoped_ptr<InvalidationInterface> invalidation) OVERRIDE; |
109 virtual void AddObserver(SyncManager::Observer* observer) OVERRIDE; | 108 virtual void AddObserver(SyncManager::Observer* observer) OVERRIDE; |
110 virtual void RemoveObserver(SyncManager::Observer* observer) OVERRIDE; | 109 virtual void RemoveObserver(SyncManager::Observer* observer) OVERRIDE; |
111 virtual SyncStatus GetDetailedStatus() const OVERRIDE; | 110 virtual SyncStatus GetDetailedStatus() const OVERRIDE; |
112 virtual void SaveChanges() OVERRIDE; | 111 virtual void SaveChanges() OVERRIDE; |
113 virtual void ShutdownOnSyncThread() OVERRIDE; | 112 virtual void ShutdownOnSyncThread() OVERRIDE; |
114 virtual UserShare* GetUserShare() OVERRIDE; | 113 virtual UserShare* GetUserShare() OVERRIDE; |
115 virtual syncer::SyncContextProxy* GetSyncContextProxy() OVERRIDE; | 114 virtual syncer::SyncContextProxy* GetSyncContextProxy() OVERRIDE; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 bool GetHasInvalidAuthTokenForTest() const; | 198 bool GetHasInvalidAuthTokenForTest() const; |
200 | 199 |
201 protected: | 200 protected: |
202 // Helper functions. Virtual for testing. | 201 // Helper functions. Virtual for testing. |
203 virtual void NotifyInitializationSuccess(); | 202 virtual void NotifyInitializationSuccess(); |
204 virtual void NotifyInitializationFailure(); | 203 virtual void NotifyInitializationFailure(); |
205 | 204 |
206 private: | 205 private: |
207 friend class SyncManagerTest; | 206 friend class SyncManagerTest; |
208 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, NudgeDelayTest); | 207 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, NudgeDelayTest); |
209 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, OnNotificationStateChange); | |
210 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, OnIncomingNotification); | |
211 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, PurgeDisabledTypes); | 208 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, PurgeDisabledTypes); |
212 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, PurgeUnappliedTypes); | 209 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, PurgeUnappliedTypes); |
213 | 210 |
214 struct NotificationInfo { | 211 struct NotificationInfo { |
215 NotificationInfo(); | 212 NotificationInfo(); |
216 ~NotificationInfo(); | 213 ~NotificationInfo(); |
217 | 214 |
218 int total_count; | 215 int total_count; |
219 std::string payload; | 216 std::string payload; |
220 | 217 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 typedef std::map<int, ImmutableChangeRecordList> ChangeRecordMap; | 329 typedef std::map<int, ImmutableChangeRecordList> ChangeRecordMap; |
333 ChangeRecordMap change_records_; | 330 ChangeRecordMap change_records_; |
334 | 331 |
335 SyncManager::ChangeDelegate* change_delegate_; | 332 SyncManager::ChangeDelegate* change_delegate_; |
336 | 333 |
337 // Set to true once Init has been called. | 334 // Set to true once Init has been called. |
338 bool initialized_; | 335 bool initialized_; |
339 | 336 |
340 bool observing_network_connectivity_changes_; | 337 bool observing_network_connectivity_changes_; |
341 | 338 |
342 InvalidatorState invalidator_state_; | |
343 | |
344 // Map used to store the notification info to be displayed in | 339 // Map used to store the notification info to be displayed in |
345 // about:sync page. | 340 // about:sync page. |
346 NotificationInfoMap notification_info_map_; | 341 NotificationInfoMap notification_info_map_; |
347 | 342 |
348 // These are for interacting with chrome://sync-internals. | 343 // These are for interacting with chrome://sync-internals. |
349 JsSyncManagerObserver js_sync_manager_observer_; | 344 JsSyncManagerObserver js_sync_manager_observer_; |
350 JsMutationEventObserver js_mutation_event_observer_; | 345 JsMutationEventObserver js_mutation_event_observer_; |
351 JsSyncEncryptionHandlerObserver js_sync_encryption_handler_observer_; | 346 JsSyncEncryptionHandlerObserver js_sync_encryption_handler_observer_; |
352 | 347 |
353 // This is for keeping track of client events to send to the server. | 348 // This is for keeping track of client events to send to the server. |
(...skipping 10 matching lines...) Expand all Loading... |
364 scoped_ptr<SyncEncryptionHandlerImpl> sync_encryption_handler_; | 359 scoped_ptr<SyncEncryptionHandlerImpl> sync_encryption_handler_; |
365 | 360 |
366 base::WeakPtrFactory<SyncManagerImpl> weak_ptr_factory_; | 361 base::WeakPtrFactory<SyncManagerImpl> weak_ptr_factory_; |
367 | 362 |
368 DISALLOW_COPY_AND_ASSIGN(SyncManagerImpl); | 363 DISALLOW_COPY_AND_ASSIGN(SyncManagerImpl); |
369 }; | 364 }; |
370 | 365 |
371 } // namespace syncer | 366 } // namespace syncer |
372 | 367 |
373 #endif // SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 368 #endif // SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
OLD | NEW |