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_EXTENSIONS_API_STORAGE_SETTINGS_SYNC_UTIL_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_SYNC_UTIL_H_
8 #include "sync/api/sync_change.h"
9 #include "sync/api/sync_data.h"
20 class SyncableService
;
23 namespace extensions
{
25 namespace settings_sync_util
{
27 // Creates a syncer::SyncData object for an extension or app setting.
28 syncer::SyncData
CreateData(
29 const std::string
& extension_id
,
30 const std::string
& key
,
31 const base::Value
& value
,
32 syncer::ModelType type
);
34 // Creates an "add" sync change for an extension or app setting.
35 syncer::SyncChange
CreateAdd(
36 const std::string
& extension_id
,
37 const std::string
& key
,
38 const base::Value
& value
,
39 syncer::ModelType type
);
41 // Creates an "update" sync change for an extension or app setting.
42 syncer::SyncChange
CreateUpdate(
43 const std::string
& extension_id
,
44 const std::string
& key
,
45 const base::Value
& value
,
46 syncer::ModelType type
);
48 // Creates a "delete" sync change for an extension or app setting.
49 syncer::SyncChange
CreateDelete(
50 const std::string
& extension_id
,
51 const std::string
& key
,
52 syncer::ModelType type
);
54 // Returns the sync service for settings. Must be called on the FILE thread.
55 // |type| must be either APP_SETTINGS or EXTENSION_SETTINGS.
56 syncer::SyncableService
* GetSyncableService(content::BrowserContext
* context
,
57 syncer::ModelType type
);
59 } // namespace settings_sync_util
61 } // namespace extensions
63 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_SYNC_UTIL_H_