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 syncer::ModelType type, | 323 ModelType type, |
324 std::unique_ptr<syncer::InvalidationInterface> invalidation) = 0; | 324 std::unique_ptr<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<syncer_v2::ModelTypeConnector> | 350 virtual std::unique_ptr<ModelTypeConnector> GetModelTypeConnectorProxy() = 0; |
351 GetModelTypeConnectorProxy() = 0; | |
352 | 351 |
353 // Returns the cache_guid of the currently open database. | 352 // Returns the cache_guid of the currently open database. |
354 // Requires that the SyncManager be initialized. | 353 // Requires that the SyncManager be initialized. |
355 virtual const std::string cache_guid() = 0; | 354 virtual const std::string cache_guid() = 0; |
356 | 355 |
357 // Reads the nigori node to determine if any experimental features should | 356 // Reads the nigori node to determine if any experimental features should |
358 // be enabled. | 357 // be enabled. |
359 // Note: opens a transaction. May be called on any thread. | 358 // Note: opens a transaction. May be called on any thread. |
360 virtual bool ReceivedExperiment(Experiments* experiments) = 0; | 359 virtual bool ReceivedExperiment(Experiments* experiments) = 0; |
361 | 360 |
362 // Uses a read-only transaction to determine if the directory being synced has | 361 // Uses a read-only transaction to determine if the directory being synced has |
363 // any remaining unsynced items. May be called on any thread. | 362 // any remaining unsynced items. May be called on any thread. |
364 virtual bool HasUnsyncedItems() = 0; | 363 virtual bool HasUnsyncedItems() = 0; |
365 | 364 |
366 // Returns the SyncManager's encryption handler. | 365 // Returns the SyncManager's encryption handler. |
367 virtual SyncEncryptionHandler* GetEncryptionHandler() = 0; | 366 virtual SyncEncryptionHandler* GetEncryptionHandler() = 0; |
368 | 367 |
369 // Ask the SyncManager to fetch updates for the given types. | 368 // Ask the SyncManager to fetch updates for the given types. |
370 virtual void RefreshTypes(ModelTypeSet types) = 0; | 369 virtual void RefreshTypes(ModelTypeSet types) = 0; |
371 | 370 |
372 // Returns any buffered protocol events. Does not clear the buffer. | 371 // Returns any buffered protocol events. Does not clear the buffer. |
373 virtual std::vector<std::unique_ptr<ProtocolEvent>> | 372 virtual std::vector<std::unique_ptr<ProtocolEvent>> |
374 GetBufferedProtocolEvents() = 0; | 373 GetBufferedProtocolEvents() = 0; |
375 | 374 |
376 // Functions to manage registrations of DebugInfoObservers. | 375 // Functions to manage registrations of DebugInfoObservers. |
377 virtual void RegisterDirectoryTypeDebugInfoObserver( | 376 virtual void RegisterDirectoryTypeDebugInfoObserver( |
378 syncer::TypeDebugInfoObserver* observer) = 0; | 377 TypeDebugInfoObserver* observer) = 0; |
379 virtual void UnregisterDirectoryTypeDebugInfoObserver( | 378 virtual void UnregisterDirectoryTypeDebugInfoObserver( |
380 syncer::TypeDebugInfoObserver* observer) = 0; | 379 TypeDebugInfoObserver* observer) = 0; |
381 virtual bool HasDirectoryTypeDebugInfoObserver( | 380 virtual bool HasDirectoryTypeDebugInfoObserver( |
382 syncer::TypeDebugInfoObserver* observer) = 0; | 381 TypeDebugInfoObserver* observer) = 0; |
383 | 382 |
384 // Request that all current counter values be emitted as though they had just | 383 // Request that all current counter values be emitted as though they had just |
385 // been updated. Useful for initializing new observers' state. | 384 // been updated. Useful for initializing new observers' state. |
386 virtual void RequestEmitDebugInfo() = 0; | 385 virtual void RequestEmitDebugInfo() = 0; |
387 | 386 |
388 // Clears server data and invokes |callback| when complete. | 387 // Clears server data and invokes |callback| when complete. |
389 // | 388 // |
390 // This is an asynchronous operation that requires interaction with the sync | 389 // This is an asynchronous operation that requires interaction with the sync |
391 // server. The operation will automatically be retried with backoff until it | 390 // server. The operation will automatically be retried with backoff until it |
392 // completes successfully or sync is shutdown. | 391 // completes successfully or sync is shutdown. |
393 virtual void ClearServerData(const ClearServerDataCallback& callback) = 0; | 392 virtual void ClearServerData(const ClearServerDataCallback& callback) = 0; |
394 | 393 |
395 // Updates Sync's tracking of whether the cookie jar has a mismatch with the | 394 // Updates Sync's tracking of whether the cookie jar has a mismatch with the |
396 // chrome account. See ClientConfigParams proto message for more info. | 395 // chrome account. See ClientConfigParams proto message for more info. |
397 // Note: this does not trigger a sync cycle. It just updates the sync context. | 396 // Note: this does not trigger a sync cycle. It just updates the sync context. |
398 virtual void OnCookieJarChanged(bool account_mismatch, bool empty_jar) = 0; | 397 virtual void OnCookieJarChanged(bool account_mismatch, bool empty_jar) = 0; |
399 }; | 398 }; |
400 | 399 |
401 } // namespace syncer | 400 } // namespace syncer |
402 | 401 |
403 #endif // COMPONENTS_SYNC_CORE_SYNC_MANAGER_H_ | 402 #endif // COMPONENTS_SYNC_CORE_SYNC_MANAGER_H_ |
OLD | NEW |