OLD | NEW |
---|---|
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" | |
9 #include "sync/protocol/app_setting_specifics.pb.h" | 11 #include "sync/protocol/app_setting_specifics.pb.h" |
10 #include "sync/protocol/extension_setting_specifics.pb.h" | 12 #include "sync/protocol/extension_setting_specifics.pb.h" |
11 #include "sync/protocol/sync.pb.h" | 13 #include "sync/protocol/sync.pb.h" |
12 | 14 |
13 namespace extensions { | 15 namespace extensions { |
14 | 16 |
15 namespace settings_sync_util { | 17 namespace settings_sync_util { |
16 | 18 |
17 namespace { | 19 namespace { |
18 | 20 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 const std::string& extension_id, | 100 const std::string& extension_id, |
99 const std::string& key, | 101 const std::string& key, |
100 syncer::ModelType type) { | 102 syncer::ModelType type) { |
101 base::DictionaryValue no_value; | 103 base::DictionaryValue no_value; |
102 return syncer::SyncChange( | 104 return syncer::SyncChange( |
103 FROM_HERE, | 105 FROM_HERE, |
104 syncer::SyncChange::ACTION_DELETE, | 106 syncer::SyncChange::ACTION_DELETE, |
105 CreateData(extension_id, key, no_value, type)); | 107 CreateData(extension_id, key, no_value, type)); |
106 } | 108 } |
107 | 109 |
110 syncer::SyncableService* GetSyncableService(content::BrowserContext* context, | |
111 syncer::ModelType type) { | |
Devlin
2014/03/05 19:02:55
There used to be a DCHECK(OnFileThread) here (back
James Cook
2014/03/05 23:14:28
Added back. (I was relying on the DCHECK in SyncV
| |
112 DCHECK(type == syncer::APP_SETTINGS || type == syncer::EXTENSION_SETTINGS); | |
113 SettingsFrontend* frontend = SettingsFrontend::Get(context); | |
114 SyncValueStoreCache* sync_cache = static_cast<SyncValueStoreCache*>( | |
115 frontend->GetValueStoreCache(settings_namespace::SYNC)); | |
116 return sync_cache->GetSyncableService(type); | |
117 } | |
118 | |
108 } // namespace settings_sync_util | 119 } // namespace settings_sync_util |
109 | 120 |
110 } // namespace extensions | 121 } // namespace extensions |
OLD | NEW |