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

Side by Side Diff: chrome/browser/extensions/api/storage/settings_sync_util.cc

Issue 2965153002: Migrate Extensions code to Task Scheduler API (Closed)
Patch Set: Self review Created 3 years, 5 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
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/sync_value_store_cache.h" 9 #include "chrome/browser/extensions/api/storage/sync_value_store_cache.h"
10 #include "components/sync/protocol/app_setting_specifics.pb.h" 10 #include "components/sync/protocol/app_setting_specifics.pb.h"
11 #include "components/sync/protocol/extension_setting_specifics.pb.h" 11 #include "components/sync/protocol/extension_setting_specifics.pb.h"
12 #include "components/sync/protocol/sync.pb.h" 12 #include "components/sync/protocol/sync.pb.h"
13 #include "content/public/browser/browser_thread.h" 13 #include "extensions/browser/api/storage/backend_task_runner.h"
14 #include "extensions/browser/api/storage/storage_frontend.h" 14 #include "extensions/browser/api/storage/storage_frontend.h"
15 15
16 using content::BrowserThread;
17
18 namespace extensions { 16 namespace extensions {
19 17
20 namespace settings_sync_util { 18 namespace settings_sync_util {
21 19
22 namespace { 20 namespace {
23 21
24 void PopulateExtensionSettingSpecifics( 22 void PopulateExtensionSettingSpecifics(
25 const std::string& extension_id, 23 const std::string& extension_id,
26 const std::string& key, 24 const std::string& key,
27 const base::Value& value, 25 const base::Value& value,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 syncer::ModelType type) { 103 syncer::ModelType type) {
106 base::DictionaryValue no_value; 104 base::DictionaryValue no_value;
107 return syncer::SyncChange( 105 return syncer::SyncChange(
108 FROM_HERE, 106 FROM_HERE,
109 syncer::SyncChange::ACTION_DELETE, 107 syncer::SyncChange::ACTION_DELETE,
110 CreateData(extension_id, key, no_value, type)); 108 CreateData(extension_id, key, no_value, type));
111 } 109 }
112 110
113 syncer::SyncableService* GetSyncableService(content::BrowserContext* context, 111 syncer::SyncableService* GetSyncableService(content::BrowserContext* context,
114 syncer::ModelType type) { 112 syncer::ModelType type) {
115 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 113 DCHECK(IsOnBackendSequence());
116 DCHECK(type == syncer::APP_SETTINGS || type == syncer::EXTENSION_SETTINGS); 114 DCHECK(type == syncer::APP_SETTINGS || type == syncer::EXTENSION_SETTINGS);
117 StorageFrontend* frontend = StorageFrontend::Get(context); 115 StorageFrontend* frontend = StorageFrontend::Get(context);
118 SyncValueStoreCache* sync_cache = static_cast<SyncValueStoreCache*>( 116 SyncValueStoreCache* sync_cache = static_cast<SyncValueStoreCache*>(
119 frontend->GetValueStoreCache(settings_namespace::SYNC)); 117 frontend->GetValueStoreCache(settings_namespace::SYNC));
120 return sync_cache->GetSyncableService(type); 118 return sync_cache->GetSyncableService(type);
121 } 119 }
122 120
123 } // namespace settings_sync_util 121 } // namespace settings_sync_util
124 122
125 } // namespace extensions 123 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698