| 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/sync_value_store_cache.h" | 9 #include "chrome/browser/extensions/api/storage/sync_value_store_cache.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 void PopulateExtensionSettingSpecifics( | 24 void PopulateExtensionSettingSpecifics( |
| 25 const std::string& extension_id, | 25 const std::string& extension_id, |
| 26 const std::string& key, | 26 const std::string& key, |
| 27 const base::Value& value, | 27 const base::Value& value, |
| 28 sync_pb::ExtensionSettingSpecifics* specifics) { | 28 sync_pb::ExtensionSettingSpecifics* specifics) { |
| 29 specifics->set_extension_id(extension_id); | 29 specifics->set_extension_id(extension_id); |
| 30 specifics->set_key(key); | 30 specifics->set_key(key); |
| 31 { | 31 { |
| 32 std::string value_as_json; | 32 std::string value_as_json; |
| 33 base::JSONWriter::Write(&value, &value_as_json); | 33 base::JSONWriter::Write(value, &value_as_json); |
| 34 specifics->set_value(value_as_json); | 34 specifics->set_value(value_as_json); |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 | 37 |
| 38 void PopulateAppSettingSpecifics( | 38 void PopulateAppSettingSpecifics( |
| 39 const std::string& extension_id, | 39 const std::string& extension_id, |
| 40 const std::string& key, | 40 const std::string& key, |
| 41 const base::Value& value, | 41 const base::Value& value, |
| 42 sync_pb::AppSettingSpecifics* specifics) { | 42 sync_pb::AppSettingSpecifics* specifics) { |
| 43 PopulateExtensionSettingSpecifics( | 43 PopulateExtensionSettingSpecifics( |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 DCHECK(type == syncer::APP_SETTINGS || type == syncer::EXTENSION_SETTINGS); | 116 DCHECK(type == syncer::APP_SETTINGS || type == syncer::EXTENSION_SETTINGS); |
| 117 StorageFrontend* frontend = StorageFrontend::Get(context); | 117 StorageFrontend* frontend = StorageFrontend::Get(context); |
| 118 SyncValueStoreCache* sync_cache = static_cast<SyncValueStoreCache*>( | 118 SyncValueStoreCache* sync_cache = static_cast<SyncValueStoreCache*>( |
| 119 frontend->GetValueStoreCache(settings_namespace::SYNC)); | 119 frontend->GetValueStoreCache(settings_namespace::SYNC)); |
| 120 return sync_cache->GetSyncableService(type); | 120 return sync_cache->GetSyncableService(type); |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace settings_sync_util | 123 } // namespace settings_sync_util |
| 124 | 124 |
| 125 } // namespace extensions | 125 } // namespace extensions |
| OLD | NEW |