| 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 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 virtual void SaveChanges() OVERRIDE; | 110 virtual void SaveChanges() OVERRIDE; |
| 111 virtual void ShutdownOnSyncThread() OVERRIDE; | 111 virtual void ShutdownOnSyncThread() OVERRIDE; |
| 112 virtual UserShare* GetUserShare() OVERRIDE; | 112 virtual UserShare* GetUserShare() OVERRIDE; |
| 113 virtual syncer::SyncCore* GetSyncCore() OVERRIDE; | 113 virtual syncer::SyncCore* GetSyncCore() OVERRIDE; |
| 114 virtual const std::string cache_guid() OVERRIDE; | 114 virtual const std::string cache_guid() OVERRIDE; |
| 115 virtual bool ReceivedExperiment(Experiments* experiments) OVERRIDE; | 115 virtual bool ReceivedExperiment(Experiments* experiments) OVERRIDE; |
| 116 virtual bool HasUnsyncedItems() OVERRIDE; | 116 virtual bool HasUnsyncedItems() OVERRIDE; |
| 117 virtual SyncEncryptionHandler* GetEncryptionHandler() OVERRIDE; | 117 virtual SyncEncryptionHandler* GetEncryptionHandler() OVERRIDE; |
| 118 virtual ScopedVector<syncer::ProtocolEvent> | 118 virtual ScopedVector<syncer::ProtocolEvent> |
| 119 GetBufferedProtocolEvents() OVERRIDE; | 119 GetBufferedProtocolEvents() OVERRIDE; |
| 120 virtual scoped_ptr<base::ListValue> GetAllNodesForType( |
| 121 syncer::ModelType type) OVERRIDE; |
| 120 | 122 |
| 121 // SyncEncryptionHandler::Observer implementation. | 123 // SyncEncryptionHandler::Observer implementation. |
| 122 virtual void OnPassphraseRequired( | 124 virtual void OnPassphraseRequired( |
| 123 PassphraseRequiredReason reason, | 125 PassphraseRequiredReason reason, |
| 124 const sync_pb::EncryptedData& pending_keys) OVERRIDE; | 126 const sync_pb::EncryptedData& pending_keys) OVERRIDE; |
| 125 virtual void OnPassphraseAccepted() OVERRIDE; | 127 virtual void OnPassphraseAccepted() OVERRIDE; |
| 126 virtual void OnBootstrapTokenUpdated( | 128 virtual void OnBootstrapTokenUpdated( |
| 127 const std::string& bootstrap_token, | 129 const std::string& bootstrap_token, |
| 128 BootstrapTokenType type) OVERRIDE; | 130 BootstrapTokenType type) OVERRIDE; |
| 129 virtual void OnEncryptedTypesChanged( | 131 virtual void OnEncryptedTypesChanged( |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 int total_count; | 212 int total_count; |
| 211 std::string payload; | 213 std::string payload; |
| 212 | 214 |
| 213 // Returned pointer owned by the caller. | 215 // Returned pointer owned by the caller. |
| 214 base::DictionaryValue* ToValue() const; | 216 base::DictionaryValue* ToValue() const; |
| 215 }; | 217 }; |
| 216 | 218 |
| 217 base::TimeDelta GetNudgeDelayTimeDelta(const ModelType& model_type); | 219 base::TimeDelta GetNudgeDelayTimeDelta(const ModelType& model_type); |
| 218 | 220 |
| 219 typedef std::map<ModelType, NotificationInfo> NotificationInfoMap; | 221 typedef std::map<ModelType, NotificationInfo> NotificationInfoMap; |
| 220 typedef JsArgList (SyncManagerImpl::*UnboundJsMessageHandler)( | |
| 221 const JsArgList&); | |
| 222 typedef base::Callback<JsArgList(const JsArgList&)> JsMessageHandler; | |
| 223 typedef std::map<std::string, JsMessageHandler> JsMessageHandlerMap; | |
| 224 | 222 |
| 225 // Determine if the parents or predecessors differ between the old and new | 223 // Determine if the parents or predecessors differ between the old and new |
| 226 // versions of an entry. Note that a node's index may change without its | 224 // versions of an entry. Note that a node's index may change without its |
| 227 // UNIQUE_POSITION changing if its sibling nodes were changed. To handle such | 225 // UNIQUE_POSITION changing if its sibling nodes were changed. To handle such |
| 228 // cases, we rely on the caller to treat a position update on any sibling as | 226 // cases, we rely on the caller to treat a position update on any sibling as |
| 229 // updating the positions of all siblings. | 227 // updating the positions of all siblings. |
| 230 bool VisiblePositionsDiffer( | 228 bool VisiblePositionsDiffer( |
| 231 const syncable::EntryKernelMutation& mutation) const; | 229 const syncable::EntryKernelMutation& mutation) const; |
| 232 | 230 |
| 233 // Determine if any of the fields made visible to clients of the Sync API | 231 // Determine if any of the fields made visible to clients of the Sync API |
| (...skipping 25 matching lines...) Expand all Loading... |
| 259 ModelType type, | 257 ModelType type, |
| 260 ChangeReorderBuffer* buffer, | 258 ChangeReorderBuffer* buffer, |
| 261 Cryptographer* cryptographer, | 259 Cryptographer* cryptographer, |
| 262 const syncable::EntryKernel& original, | 260 const syncable::EntryKernel& original, |
| 263 bool existed_before, | 261 bool existed_before, |
| 264 bool exists_now); | 262 bool exists_now); |
| 265 | 263 |
| 266 // Checks for server reachabilty and requests a nudge. | 264 // Checks for server reachabilty and requests a nudge. |
| 267 void OnNetworkConnectivityChangedImpl(); | 265 void OnNetworkConnectivityChangedImpl(); |
| 268 | 266 |
| 269 // Helper function used only by the constructor. | |
| 270 void BindJsMessageHandler( | |
| 271 const std::string& name, UnboundJsMessageHandler unbound_message_handler); | |
| 272 | |
| 273 // JS message handlers. | |
| 274 JsArgList GetAllNodes(const JsArgList& args); | |
| 275 JsArgList GetNodeSummariesById(const JsArgList& args); | |
| 276 JsArgList GetNodeDetailsById(const JsArgList& args); | |
| 277 JsArgList GetChildNodeIds(const JsArgList& args); | |
| 278 | |
| 279 syncable::Directory* directory(); | 267 syncable::Directory* directory(); |
| 280 | 268 |
| 281 base::FilePath database_path_; | 269 base::FilePath database_path_; |
| 282 | 270 |
| 283 const std::string name_; | 271 const std::string name_; |
| 284 | 272 |
| 285 base::ThreadChecker thread_checker_; | 273 base::ThreadChecker thread_checker_; |
| 286 | 274 |
| 287 // Thread-safe handle used by | 275 // Thread-safe handle used by |
| 288 // HandleCalculateChangesChangeEventFromSyncApi(), which can be | 276 // HandleCalculateChangesChangeEventFromSyncApi(), which can be |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 | 332 |
| 345 bool observing_network_connectivity_changes_; | 333 bool observing_network_connectivity_changes_; |
| 346 | 334 |
| 347 InvalidatorState invalidator_state_; | 335 InvalidatorState invalidator_state_; |
| 348 | 336 |
| 349 // Map used to store the notification info to be displayed in | 337 // Map used to store the notification info to be displayed in |
| 350 // about:sync page. | 338 // about:sync page. |
| 351 NotificationInfoMap notification_info_map_; | 339 NotificationInfoMap notification_info_map_; |
| 352 | 340 |
| 353 // These are for interacting with chrome://sync-internals. | 341 // These are for interacting with chrome://sync-internals. |
| 354 JsMessageHandlerMap js_message_handlers_; | |
| 355 JsSyncManagerObserver js_sync_manager_observer_; | 342 JsSyncManagerObserver js_sync_manager_observer_; |
| 356 JsMutationEventObserver js_mutation_event_observer_; | 343 JsMutationEventObserver js_mutation_event_observer_; |
| 357 JsSyncEncryptionHandlerObserver js_sync_encryption_handler_observer_; | 344 JsSyncEncryptionHandlerObserver js_sync_encryption_handler_observer_; |
| 358 | 345 |
| 359 // This is for keeping track of client events to send to the server. | 346 // This is for keeping track of client events to send to the server. |
| 360 DebugInfoEventListener debug_info_event_listener_; | 347 DebugInfoEventListener debug_info_event_listener_; |
| 361 | 348 |
| 362 ProtocolEventBuffer protocol_event_buffer_; | 349 ProtocolEventBuffer protocol_event_buffer_; |
| 363 | 350 |
| 364 Encryptor* encryptor_; | 351 Encryptor* encryptor_; |
| 365 scoped_ptr<UnrecoverableErrorHandler> unrecoverable_error_handler_; | 352 scoped_ptr<UnrecoverableErrorHandler> unrecoverable_error_handler_; |
| 366 ReportUnrecoverableErrorFunction report_unrecoverable_error_function_; | 353 ReportUnrecoverableErrorFunction report_unrecoverable_error_function_; |
| 367 | 354 |
| 368 // Sync's encryption handler. It tracks the set of encrypted types, manages | 355 // Sync's encryption handler. It tracks the set of encrypted types, manages |
| 369 // changing passphrases, and in general handles sync-specific interactions | 356 // changing passphrases, and in general handles sync-specific interactions |
| 370 // with the cryptographer. | 357 // with the cryptographer. |
| 371 scoped_ptr<SyncEncryptionHandlerImpl> sync_encryption_handler_; | 358 scoped_ptr<SyncEncryptionHandlerImpl> sync_encryption_handler_; |
| 372 | 359 |
| 373 base::WeakPtrFactory<SyncManagerImpl> weak_ptr_factory_; | 360 base::WeakPtrFactory<SyncManagerImpl> weak_ptr_factory_; |
| 374 | 361 |
| 375 DISALLOW_COPY_AND_ASSIGN(SyncManagerImpl); | 362 DISALLOW_COPY_AND_ASSIGN(SyncManagerImpl); |
| 376 }; | 363 }; |
| 377 | 364 |
| 378 } // namespace syncer | 365 } // namespace syncer |
| 379 | 366 |
| 380 #endif // SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 367 #endif // SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
| OLD | NEW |