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

Unified Diff: chrome/browser/extensions/api/storage/settings_sync_util.cc

Issue 184043031: Split up extensions storage API implementations for sync and local storage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase (split_sync) Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/storage/settings_sync_util.cc
diff --git a/chrome/browser/extensions/api/storage/settings_sync_util.cc b/chrome/browser/extensions/api/storage/settings_sync_util.cc
index b974aa3f619ed30642362b13f163d86e2edf8479..1f490ec79d31f06cf0631a259638fdcb0e7b5744 100644
--- a/chrome/browser/extensions/api/storage/settings_sync_util.cc
+++ b/chrome/browser/extensions/api/storage/settings_sync_util.cc
@@ -6,10 +6,15 @@
#include "base/json/json_writer.h"
#include "base/values.h"
+#include "chrome/browser/extensions/api/storage/settings_frontend.h"
+#include "chrome/browser/extensions/api/storage/sync_value_store_cache.h"
+#include "content/public/browser/browser_thread.h"
#include "sync/protocol/app_setting_specifics.pb.h"
#include "sync/protocol/extension_setting_specifics.pb.h"
#include "sync/protocol/sync.pb.h"
+using content::BrowserThread;
+
namespace extensions {
namespace settings_sync_util {
@@ -105,6 +110,16 @@ syncer::SyncChange CreateDelete(
CreateData(extension_id, key, no_value, type));
}
+syncer::SyncableService* GetSyncableService(content::BrowserContext* context,
+ syncer::ModelType type) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK(type == syncer::APP_SETTINGS || type == syncer::EXTENSION_SETTINGS);
+ SettingsFrontend* frontend = SettingsFrontend::Get(context);
+ SyncValueStoreCache* sync_cache = static_cast<SyncValueStoreCache*>(
+ frontend->GetValueStoreCache(settings_namespace::SYNC));
+ return sync_cache->GetSyncableService(type);
+}
+
} // namespace settings_sync_util
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698