Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: sync/internal_api/public/sync_manager.h

Issue 13197004: Draft: InvalidationService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Passes tests Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_PUBLIC_SYNC_MANAGER_H_ 5 #ifndef SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_
6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ 6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/task_runner.h" 15 #include "base/task_runner.h"
16 #include "base/threading/thread_checker.h" 16 #include "base/threading/thread_checker.h"
17 #include "sync/base/sync_export.h" 17 #include "sync/base/sync_export.h"
18 #include "sync/internal_api/public/base/model_type.h" 18 #include "sync/internal_api/public/base/model_type.h"
19 #include "sync/internal_api/public/change_record.h" 19 #include "sync/internal_api/public/change_record.h"
20 #include "sync/internal_api/public/configure_reason.h" 20 #include "sync/internal_api/public/configure_reason.h"
21 #include "sync/internal_api/public/engine/model_safe_worker.h" 21 #include "sync/internal_api/public/engine/model_safe_worker.h"
22 #include "sync/internal_api/public/engine/sync_status.h" 22 #include "sync/internal_api/public/engine/sync_status.h"
23 #include "sync/internal_api/public/sync_encryption_handler.h" 23 #include "sync/internal_api/public/sync_encryption_handler.h"
24 #include "sync/internal_api/public/util/report_unrecoverable_error_function.h" 24 #include "sync/internal_api/public/util/report_unrecoverable_error_function.h"
25 #include "sync/internal_api/public/util/weak_handle.h" 25 #include "sync/internal_api/public/util/weak_handle.h"
26 #include "sync/notifier/invalidation_util.h" 26 #include "sync/notifier/invalidation_handler.h"
27 #include "sync/protocol/sync_protocol_error.h" 27 #include "sync/protocol/sync_protocol_error.h"
28 28
29 namespace sync_pb { 29 namespace sync_pb {
30 class EncryptedData; 30 class EncryptedData;
31 } // namespace sync_pb 31 } // namespace sync_pb
32 32
33 namespace syncer { 33 namespace syncer {
34 34
35 class BaseTransaction; 35 class BaseTransaction;
36 class DataTypeDebugInfoListener; 36 class DataTypeDebugInfoListener;
37 class Encryptor; 37 class Encryptor;
38 struct Experiments; 38 struct Experiments;
39 class ExtensionsActivityMonitor; 39 class ExtensionsActivityMonitor;
40 class HttpPostProviderFactory; 40 class HttpPostProviderFactory;
41 class InternalComponentsFactory; 41 class InternalComponentsFactory;
42 class InvalidationHandler;
43 class Invalidator;
44 class JsBackend; 42 class JsBackend;
45 class JsEventHandler; 43 class JsEventHandler;
46 class SyncEncryptionHandler; 44 class SyncEncryptionHandler;
47 class SyncScheduler; 45 class SyncScheduler;
48 class UnrecoverableErrorHandler; 46 class UnrecoverableErrorHandler;
49 struct UserShare; 47 struct UserShare;
50 48
51 namespace sessions { 49 namespace sessions {
52 class SyncSessionSnapshot; 50 class SyncSessionSnapshot;
53 } // namespace sessions 51 } // namespace sessions
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 const base::FilePath& database_location, 304 const base::FilePath& database_location,
307 const WeakHandle<JsEventHandler>& event_handler, 305 const WeakHandle<JsEventHandler>& event_handler,
308 const std::string& sync_server_and_path, 306 const std::string& sync_server_and_path,
309 int sync_server_port, 307 int sync_server_port,
310 bool use_ssl, 308 bool use_ssl,
311 scoped_ptr<HttpPostProviderFactory> post_factory, 309 scoped_ptr<HttpPostProviderFactory> post_factory,
312 const std::vector<ModelSafeWorker*>& workers, 310 const std::vector<ModelSafeWorker*>& workers,
313 ExtensionsActivityMonitor* extensions_activity_monitor, 311 ExtensionsActivityMonitor* extensions_activity_monitor,
314 ChangeDelegate* change_delegate, 312 ChangeDelegate* change_delegate,
315 const SyncCredentials& credentials, 313 const SyncCredentials& credentials,
316 scoped_ptr<Invalidator> invalidator,
317 const std::string& invalidator_client_id, 314 const std::string& invalidator_client_id,
318 const std::string& restored_key_for_bootstrapping, 315 const std::string& restored_key_for_bootstrapping,
319 const std::string& restored_keystore_key_for_bootstrapping, 316 const std::string& restored_keystore_key_for_bootstrapping,
320 scoped_ptr<InternalComponentsFactory> internal_components_factory, 317 scoped_ptr<InternalComponentsFactory> internal_components_factory,
321 Encryptor* encryptor, 318 Encryptor* encryptor,
322 UnrecoverableErrorHandler* unrecoverable_error_handler, 319 UnrecoverableErrorHandler* unrecoverable_error_handler,
323 ReportUnrecoverableErrorFunction report_unrecoverable_error_function) = 0; 320 ReportUnrecoverableErrorFunction report_unrecoverable_error_function) = 0;
324 321
325 // Throw an unrecoverable error from a transaction (mostly used for 322 // Throw an unrecoverable error from a transaction (mostly used for
326 // testing). 323 // testing).
327 virtual void ThrowUnrecoverableError() = 0; 324 virtual void ThrowUnrecoverableError() = 0;
328 325
329 virtual ModelTypeSet InitialSyncEndedTypes() = 0; 326 virtual ModelTypeSet InitialSyncEndedTypes() = 0;
330 327
331 // Returns those types within |types| that have an empty progress marker 328 // Returns those types within |types| that have an empty progress marker
332 // token. 329 // token.
333 virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken( 330 virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken(
334 ModelTypeSet types) = 0; 331 ModelTypeSet types) = 0;
335 332
336 // Purge from the directory those types with non-empty progress markers 333 // Purge from the directory those types with non-empty progress markers
337 // but without initial synced ended set. 334 // but without initial synced ended set.
338 // Returns false if an error occurred, true otherwise. 335 // Returns false if an error occurred, true otherwise.
339 virtual bool PurgePartiallySyncedTypes() = 0; 336 virtual bool PurgePartiallySyncedTypes() = 0;
340 337
341 // Update tokens that we're using in Sync. Email must stay the same. 338 // Update tokens that we're using in Sync. Email must stay the same.
342 virtual void UpdateCredentials(const SyncCredentials& credentials) = 0; 339 virtual void UpdateCredentials(const SyncCredentials& credentials) = 0;
343 340
344 // Called when the user disables or enables a sync type.
345 virtual void UpdateEnabledTypes(ModelTypeSet enabled_types) = 0;
346
347 // Forwards to the underlying invalidator (see comments in invalidator.h).
348 virtual void RegisterInvalidationHandler(
349 InvalidationHandler* handler) = 0;
350
351 // Forwards to the underlying notifier (see comments in invalidator.h).
352 virtual void UpdateRegisteredInvalidationIds(
353 InvalidationHandler* handler,
354 const ObjectIdSet& ids) = 0;
355
356 // Forwards to the underlying notifier (see comments in invalidator.h).
357 virtual void UnregisterInvalidationHandler(
358 InvalidationHandler* handler) = 0;
359
360 // Forwards to the underlying notifier (see comments in invalidator.h).
361 virtual void AcknowledgeInvalidation(
362 const invalidation::ObjectId& id,
363 const syncer::AckHandle& ack_handle) = 0;
364
365 // Put the syncer in normal mode ready to perform nudges and polls. 341 // Put the syncer in normal mode ready to perform nudges and polls.
366 virtual void StartSyncingNormally( 342 virtual void StartSyncingNormally(
367 const ModelSafeRoutingInfo& routing_info) = 0; 343 const ModelSafeRoutingInfo& routing_info) = 0;
368 344
369 // Switches the mode of operation to CONFIGURATION_MODE and performs 345 // Switches the mode of operation to CONFIGURATION_MODE and performs
370 // any configuration tasks needed as determined by the params. Once complete, 346 // any configuration tasks needed as determined by the params. Once complete,
371 // syncer will remain in CONFIGURATION_MODE until StartSyncingNormally is 347 // syncer will remain in CONFIGURATION_MODE until StartSyncingNormally is
372 // called. 348 // called.
373 // Data whose types are not in |new_routing_info| are purged from sync 349 // Data whose types are not in |new_routing_info| are purged from sync
374 // directory. The purged data is backed up in delete journal for recovery in 350 // directory. The purged data is backed up in delete journal for recovery in
375 // next session if its type is in |failed_types|. 351 // next session if its type is in |failed_types|.
376 // |ready_task| is invoked when the configuration completes. 352 // |ready_task| is invoked when the configuration completes.
377 // |retry_task| is invoked if the configuration job could not immediately 353 // |retry_task| is invoked if the configuration job could not immediately
378 // execute. |ready_task| will still be called when it eventually 354 // execute. |ready_task| will still be called when it eventually
379 // does finish. 355 // does finish.
380 virtual void ConfigureSyncer( 356 virtual void ConfigureSyncer(
381 ConfigureReason reason, 357 ConfigureReason reason,
382 ModelTypeSet types_to_config, 358 ModelTypeSet types_to_config,
383 ModelTypeSet failed_types, 359 ModelTypeSet failed_types,
384 const ModelSafeRoutingInfo& new_routing_info, 360 const ModelSafeRoutingInfo& new_routing_info,
385 const base::Closure& ready_task, 361 const base::Closure& ready_task,
386 const base::Closure& retry_task) = 0; 362 const base::Closure& retry_task) = 0;
387 363
364 // Inform the syncer of a change in the invalidator's state.
365 virtual void UpdateInvalidatorState(InvalidatorState state) = 0;
366
367 // Inform the syncer that its cached information about a type is obsolete.
368 virtual void Invalidate(const ObjectIdInvalidationMap& invalidation_map) = 0;
369
388 // Adds a listener to be notified of sync events. 370 // Adds a listener to be notified of sync events.
389 // NOTE: It is OK (in fact, it's probably a good idea) to call this before 371 // NOTE: It is OK (in fact, it's probably a good idea) to call this before
390 // having received OnInitializationCompleted. 372 // having received OnInitializationCompleted.
391 virtual void AddObserver(Observer* observer) = 0; 373 virtual void AddObserver(Observer* observer) = 0;
392 374
393 // Remove the given observer. Make sure to call this if the 375 // Remove the given observer. Make sure to call this if the
394 // Observer is being destroyed so the SyncManager doesn't 376 // Observer is being destroyed so the SyncManager doesn't
395 // potentially dereference garbage. 377 // potentially dereference garbage.
396 virtual void RemoveObserver(Observer* observer) = 0; 378 virtual void RemoveObserver(Observer* observer) = 0;
397 379
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 // Returns the SyncManager's encryption handler. 417 // Returns the SyncManager's encryption handler.
436 virtual SyncEncryptionHandler* GetEncryptionHandler() = 0; 418 virtual SyncEncryptionHandler* GetEncryptionHandler() = 0;
437 419
438 // Ask the SyncManager to fetch updates for the given types. 420 // Ask the SyncManager to fetch updates for the given types.
439 virtual void RefreshTypes(ModelTypeSet types) = 0; 421 virtual void RefreshTypes(ModelTypeSet types) = 0;
440 }; 422 };
441 423
442 } // namespace syncer 424 } // namespace syncer
443 425
444 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ 426 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698