Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / sync / profile_sync_service_base.h
blob8f0b8f30c205baa9af07d082da7d6e522701f518
1 // Copyright (c) 2012 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 CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_BASE_H_
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_BASE_H_
8 #include "chrome/browser/sync/profile_sync_service_observer.h"
9 #include "sync/internal_api/public/base/model_type.h"
11 namespace content {
12 class BrowserContext;
15 // API for ProfileSyncService.
16 class ProfileSyncServiceBase {
17 public:
18 // Retrieve the sync service to use in the given context.
19 // Returns NULL if sync is not enabled for the context.
20 static ProfileSyncServiceBase* FromBrowserContext(
21 content::BrowserContext* context);
23 typedef ProfileSyncServiceObserver Observer;
25 virtual ~ProfileSyncServiceBase() {}
27 // Whether sync is enabled by user or not. This does not necessarily mean
28 // that sync is currently running (due to delayed startup, unrecoverable
29 // errors, or shutdown). See SyncActive below for checking whether sync
30 // is actually running.
31 virtual bool HasSyncSetupCompleted() const = 0;
33 // Returns true if sync is fully initialized and active. This implies that
34 // an initial configuration has successfully completed, although there may
35 // be datatype specific, auth, or other transient errors. To see which
36 // datetypes are actually syncing, see GetActiveTypes() below.
37 // Note that if sync is in backup or rollback mode, SyncActive() will be
38 // false.
39 virtual bool SyncActive() const = 0;
41 // Get the set of current active data types (those chosen or configured by
42 // the user which have not also encountered a runtime error).
43 // Note that if the Sync engine is in the middle of a configuration, this
44 // will the the empty set. Once the configuration completes the set will
45 // be updated.
46 virtual syncer::ModelTypeSet GetActiveDataTypes() const = 0;
48 // Adds/removes an observer. ProfileSyncServiceBase does not take
49 // ownership of the observer.
50 virtual void AddObserver(Observer* observer) = 0;
51 virtual void RemoveObserver(Observer* observer) = 0;
53 // Returns true if |observer| has already been added as an observer.
54 virtual bool HasObserver(const Observer* observer) const = 0;
57 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_BASE_H_