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 COMPONENTS_SYNC_CORE_SYNC_MANAGER_H_ | 5 #ifndef COMPONENTS_SYNC_CORE_SYNC_MANAGER_H_ |
6 #define COMPONENTS_SYNC_CORE_SYNC_MANAGER_H_ | 6 #define COMPONENTS_SYNC_CORE_SYNC_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 ModelTypeSet to_unapply, | 313 ModelTypeSet to_unapply, |
314 const ModelSafeRoutingInfo& new_routing_info, | 314 const ModelSafeRoutingInfo& new_routing_info, |
315 const base::Closure& ready_task, | 315 const base::Closure& ready_task, |
316 const base::Closure& retry_task) = 0; | 316 const base::Closure& retry_task) = 0; |
317 | 317 |
318 // Inform the syncer of a change in the invalidator's state. | 318 // Inform the syncer of a change in the invalidator's state. |
319 virtual void SetInvalidatorEnabled(bool invalidator_enabled) = 0; | 319 virtual void SetInvalidatorEnabled(bool invalidator_enabled) = 0; |
320 | 320 |
321 // Inform the syncer that its cached information about a type is obsolete. | 321 // Inform the syncer that its cached information about a type is obsolete. |
322 virtual void OnIncomingInvalidation( | 322 virtual void OnIncomingInvalidation( |
323 ModelType type, | 323 syncer::ModelType type, |
324 std::unique_ptr<InvalidationInterface> invalidation) = 0; | 324 std::unique_ptr<syncer::InvalidationInterface> invalidation) = 0; |
325 | 325 |
326 // Adds a listener to be notified of sync events. | 326 // Adds a listener to be notified of sync events. |
327 // NOTE: It is OK (in fact, it's probably a good idea) to call this before | 327 // NOTE: It is OK (in fact, it's probably a good idea) to call this before |
328 // having received OnInitializationCompleted. | 328 // having received OnInitializationCompleted. |
329 virtual void AddObserver(Observer* observer) = 0; | 329 virtual void AddObserver(Observer* observer) = 0; |
330 | 330 |
331 // Remove the given observer. Make sure to call this if the | 331 // Remove the given observer. Make sure to call this if the |
332 // Observer is being destroyed so the SyncManager doesn't | 332 // Observer is being destroyed so the SyncManager doesn't |
333 // potentially dereference garbage. | 333 // potentially dereference garbage. |
334 virtual void RemoveObserver(Observer* observer) = 0; | 334 virtual void RemoveObserver(Observer* observer) = 0; |
335 | 335 |
336 // Status-related getter. May be called on any thread. | 336 // Status-related getter. May be called on any thread. |
337 virtual SyncStatus GetDetailedStatus() const = 0; | 337 virtual SyncStatus GetDetailedStatus() const = 0; |
338 | 338 |
339 // Call periodically from a database-safe thread to persist recent changes | 339 // Call periodically from a database-safe thread to persist recent changes |
340 // to the syncapi model. | 340 // to the syncapi model. |
341 virtual void SaveChanges() = 0; | 341 virtual void SaveChanges() = 0; |
342 | 342 |
343 // Issue a final SaveChanges, and close sqlite handles. | 343 // Issue a final SaveChanges, and close sqlite handles. |
344 virtual void ShutdownOnSyncThread(ShutdownReason reason) = 0; | 344 virtual void ShutdownOnSyncThread(ShutdownReason reason) = 0; |
345 | 345 |
346 // May be called from any thread. | 346 // May be called from any thread. |
347 virtual UserShare* GetUserShare() = 0; | 347 virtual UserShare* GetUserShare() = 0; |
348 | 348 |
349 // Returns an instance of the main interface for non-blocking sync types. | 349 // Returns an instance of the main interface for non-blocking sync types. |
350 virtual std::unique_ptr<ModelTypeConnector> GetModelTypeConnectorProxy() = 0; | 350 virtual std::unique_ptr<syncer_v2::ModelTypeConnector> |
| 351 GetModelTypeConnectorProxy() = 0; |
351 | 352 |
352 // Returns the cache_guid of the currently open database. | 353 // Returns the cache_guid of the currently open database. |
353 // Requires that the SyncManager be initialized. | 354 // Requires that the SyncManager be initialized. |
354 virtual const std::string cache_guid() = 0; | 355 virtual const std::string cache_guid() = 0; |
355 | 356 |
356 // Reads the nigori node to determine if any experimental features should | 357 // Reads the nigori node to determine if any experimental features should |
357 // be enabled. | 358 // be enabled. |
358 // Note: opens a transaction. May be called on any thread. | 359 // Note: opens a transaction. May be called on any thread. |
359 virtual bool ReceivedExperiment(Experiments* experiments) = 0; | 360 virtual bool ReceivedExperiment(Experiments* experiments) = 0; |
360 | 361 |
361 // Uses a read-only transaction to determine if the directory being synced has | 362 // Uses a read-only transaction to determine if the directory being synced has |
362 // any remaining unsynced items. May be called on any thread. | 363 // any remaining unsynced items. May be called on any thread. |
363 virtual bool HasUnsyncedItems() = 0; | 364 virtual bool HasUnsyncedItems() = 0; |
364 | 365 |
365 // Returns the SyncManager's encryption handler. | 366 // Returns the SyncManager's encryption handler. |
366 virtual SyncEncryptionHandler* GetEncryptionHandler() = 0; | 367 virtual SyncEncryptionHandler* GetEncryptionHandler() = 0; |
367 | 368 |
368 // Ask the SyncManager to fetch updates for the given types. | 369 // Ask the SyncManager to fetch updates for the given types. |
369 virtual void RefreshTypes(ModelTypeSet types) = 0; | 370 virtual void RefreshTypes(ModelTypeSet types) = 0; |
370 | 371 |
371 // Returns any buffered protocol events. Does not clear the buffer. | 372 // Returns any buffered protocol events. Does not clear the buffer. |
372 virtual std::vector<std::unique_ptr<ProtocolEvent>> | 373 virtual std::vector<std::unique_ptr<ProtocolEvent>> |
373 GetBufferedProtocolEvents() = 0; | 374 GetBufferedProtocolEvents() = 0; |
374 | 375 |
375 // Functions to manage registrations of DebugInfoObservers. | 376 // Functions to manage registrations of DebugInfoObservers. |
376 virtual void RegisterDirectoryTypeDebugInfoObserver( | 377 virtual void RegisterDirectoryTypeDebugInfoObserver( |
377 TypeDebugInfoObserver* observer) = 0; | 378 syncer::TypeDebugInfoObserver* observer) = 0; |
378 virtual void UnregisterDirectoryTypeDebugInfoObserver( | 379 virtual void UnregisterDirectoryTypeDebugInfoObserver( |
379 TypeDebugInfoObserver* observer) = 0; | 380 syncer::TypeDebugInfoObserver* observer) = 0; |
380 virtual bool HasDirectoryTypeDebugInfoObserver( | 381 virtual bool HasDirectoryTypeDebugInfoObserver( |
381 TypeDebugInfoObserver* observer) = 0; | 382 syncer::TypeDebugInfoObserver* observer) = 0; |
382 | 383 |
383 // Request that all current counter values be emitted as though they had just | 384 // Request that all current counter values be emitted as though they had just |
384 // been updated. Useful for initializing new observers' state. | 385 // been updated. Useful for initializing new observers' state. |
385 virtual void RequestEmitDebugInfo() = 0; | 386 virtual void RequestEmitDebugInfo() = 0; |
386 | 387 |
387 // Clears server data and invokes |callback| when complete. | 388 // Clears server data and invokes |callback| when complete. |
388 // | 389 // |
389 // This is an asynchronous operation that requires interaction with the sync | 390 // This is an asynchronous operation that requires interaction with the sync |
390 // server. The operation will automatically be retried with backoff until it | 391 // server. The operation will automatically be retried with backoff until it |
391 // completes successfully or sync is shutdown. | 392 // completes successfully or sync is shutdown. |
392 virtual void ClearServerData(const ClearServerDataCallback& callback) = 0; | 393 virtual void ClearServerData(const ClearServerDataCallback& callback) = 0; |
393 | 394 |
394 // Updates Sync's tracking of whether the cookie jar has a mismatch with the | 395 // Updates Sync's tracking of whether the cookie jar has a mismatch with the |
395 // chrome account. See ClientConfigParams proto message for more info. | 396 // chrome account. See ClientConfigParams proto message for more info. |
396 // Note: this does not trigger a sync cycle. It just updates the sync context. | 397 // Note: this does not trigger a sync cycle. It just updates the sync context. |
397 virtual void OnCookieJarChanged(bool account_mismatch, bool empty_jar) = 0; | 398 virtual void OnCookieJarChanged(bool account_mismatch, bool empty_jar) = 0; |
398 }; | 399 }; |
399 | 400 |
400 } // namespace syncer | 401 } // namespace syncer |
401 | 402 |
402 #endif // COMPONENTS_SYNC_CORE_SYNC_MANAGER_H_ | 403 #endif // COMPONENTS_SYNC_CORE_SYNC_MANAGER_H_ |
OLD | NEW |