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"
15 // API for ProfileSyncService.
16 class ProfileSyncServiceBase
{
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.
28 virtual bool HasSyncSetupCompleted() const = 0;
30 // Returns whether processing changes is allowed. Check this before doing
31 // any model-modifying operations.
32 virtual bool ShouldPushChanges() = 0;
34 // Get the set of current active data types (those chosen or configured by
35 // the user which have not also encountered a runtime error).
36 virtual syncer::ModelTypeSet
GetActiveDataTypes() const = 0;
38 // Adds/removes an observer. ProfileSyncServiceBase does not take
39 // ownership of the observer.
40 virtual void AddObserver(Observer
* observer
) = 0;
41 virtual void RemoveObserver(Observer
* observer
) = 0;
43 // Returns true if |observer| has already been added as an observer.
44 virtual bool HasObserver(Observer
* observer
) const = 0;
47 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_BASE_H_