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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/api/storage/settings_sync_util.h" 5 #include "chrome/browser/extensions/api/storage/settings_sync_util.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/extensions/api/storage/settings_frontend.h"
10 #include "chrome/browser/extensions/api/storage/sync_value_store_cache.h"
11 #include "content/public/browser/browser_thread.h"
9 #include "sync/protocol/app_setting_specifics.pb.h" 12 #include "sync/protocol/app_setting_specifics.pb.h"
10 #include "sync/protocol/extension_setting_specifics.pb.h" 13 #include "sync/protocol/extension_setting_specifics.pb.h"
11 #include "sync/protocol/sync.pb.h" 14 #include "sync/protocol/sync.pb.h"
12 15
16 using content::BrowserThread;
17
13 namespace extensions { 18 namespace extensions {
14 19
15 namespace settings_sync_util { 20 namespace settings_sync_util {
16 21
17 namespace { 22 namespace {
18 23
19 void PopulateExtensionSettingSpecifics( 24 void PopulateExtensionSettingSpecifics(
20 const std::string& extension_id, 25 const std::string& extension_id,
21 const std::string& key, 26 const std::string& key,
22 const base::Value& value, 27 const base::Value& value,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 const std::string& extension_id, 103 const std::string& extension_id,
99 const std::string& key, 104 const std::string& key,
100 syncer::ModelType type) { 105 syncer::ModelType type) {
101 base::DictionaryValue no_value; 106 base::DictionaryValue no_value;
102 return syncer::SyncChange( 107 return syncer::SyncChange(
103 FROM_HERE, 108 FROM_HERE,
104 syncer::SyncChange::ACTION_DELETE, 109 syncer::SyncChange::ACTION_DELETE,
105 CreateData(extension_id, key, no_value, type)); 110 CreateData(extension_id, key, no_value, type));
106 } 111 }
107 112
113 syncer::SyncableService* GetSyncableService(content::BrowserContext* context,
114 syncer::ModelType type) {
115 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
116 DCHECK(type == syncer::APP_SETTINGS || type == syncer::EXTENSION_SETTINGS);
117 SettingsFrontend* frontend = SettingsFrontend::Get(context);
118 SyncValueStoreCache* sync_cache = static_cast<SyncValueStoreCache*>(
119 frontend->GetValueStoreCache(settings_namespace::SYNC));
120 return sync_cache->GetSyncableService(type);
121 }
122
108 } // namespace settings_sync_util 123 } // namespace settings_sync_util
109 124
110 } // namespace extensions 125 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698