1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_H_
6 #define COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_H_
8 #include "base/macros.h"
9 #include "components/sync_driver/sync_service_observer.h"
10 #include "sync/internal_api/public/base/model_type.h"
12 namespace sync_driver
{
16 virtual ~SyncService() {}
18 // Whether sync is enabled by user or not. This does not necessarily mean
19 // that sync is currently running (due to delayed startup, unrecoverable
20 // errors, or shutdown). See SyncActive below for checking whether sync
21 // is actually running.
22 virtual bool HasSyncSetupCompleted() const = 0;
24 // Returns true if sync is fully initialized and active. This implies that
25 // an initial configuration has successfully completed, although there may
26 // be datatype specific, auth, or other transient errors. To see which
27 // datetypes are actually syncing, see GetActiveTypes() below.
28 // Note that if sync is in backup or rollback mode, SyncActive() will be
30 virtual bool SyncActive() const = 0;
32 // Get the set of current active data types (those chosen or configured by
33 // the user which have not also encountered a runtime error).
34 // Note that if the Sync engine is in the middle of a configuration, this
35 // will the the empty set. Once the configuration completes the set will
37 virtual syncer::ModelTypeSet
GetActiveDataTypes() const = 0;
39 // Adds/removes an observer. SyncService does not take ownership of the
41 virtual void AddObserver(SyncServiceObserver
* observer
) = 0;
42 virtual void RemoveObserver(SyncServiceObserver
* observer
) = 0;
44 // Returns true if |observer| has already been added as an observer.
45 virtual bool HasObserver(const SyncServiceObserver
* observer
) const = 0;
51 DISALLOW_COPY_AND_ASSIGN(SyncService
);
54 } // namespace sync_driver
56 #endif // COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_H_