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

Side by Side Diff: chrome/browser/extensions/settings/settings_sync_util.cc

Issue 9590002: JSONWriter cleanup: integrate pretty print into write options. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflict 7. Created 8 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/settings/settings_sync_util.h" 5 #include "chrome/browser/extensions/settings/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 "sync/protocol/app_setting_specifics.pb.h" 9 #include "sync/protocol/app_setting_specifics.pb.h"
10 #include "sync/protocol/extension_setting_specifics.pb.h" 10 #include "sync/protocol/extension_setting_specifics.pb.h"
11 #include "sync/protocol/sync.pb.h" 11 #include "sync/protocol/sync.pb.h"
12 12
13 namespace extensions { 13 namespace extensions {
14 14
15 namespace settings_sync_util { 15 namespace settings_sync_util {
16 16
17 namespace { 17 namespace {
18 18
19 void PopulateExtensionSettingSpecifics( 19 void PopulateExtensionSettingSpecifics(
20 const std::string& extension_id, 20 const std::string& extension_id,
21 const std::string& key, 21 const std::string& key,
22 const Value& value, 22 const Value& value,
23 sync_pb::ExtensionSettingSpecifics* specifics) { 23 sync_pb::ExtensionSettingSpecifics* specifics) {
24 specifics->set_extension_id(extension_id); 24 specifics->set_extension_id(extension_id);
25 specifics->set_key(key); 25 specifics->set_key(key);
26 { 26 {
27 std::string value_as_json; 27 std::string value_as_json;
28 base::JSONWriter::Write(&value, false, &value_as_json); 28 base::JSONWriter::Write(&value, &value_as_json);
29 specifics->set_value(value_as_json); 29 specifics->set_value(value_as_json);
30 } 30 }
31 } 31 }
32 32
33 void PopulateAppSettingSpecifics( 33 void PopulateAppSettingSpecifics(
34 const std::string& extension_id, 34 const std::string& extension_id,
35 const std::string& key, 35 const std::string& key,
36 const Value& value, 36 const Value& value,
37 sync_pb::AppSettingSpecifics* specifics) { 37 sync_pb::AppSettingSpecifics* specifics) {
38 PopulateExtensionSettingSpecifics( 38 PopulateExtensionSettingSpecifics(
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 const std::string& key, 94 const std::string& key,
95 syncable::ModelType type) { 95 syncable::ModelType type) {
96 DictionaryValue no_value; 96 DictionaryValue no_value;
97 return SyncChange( 97 return SyncChange(
98 SyncChange::ACTION_DELETE, CreateData(extension_id, key, no_value, type)); 98 SyncChange::ACTION_DELETE, CreateData(extension_id, key, no_value, type));
99 } 99 }
100 100
101 } // namespace settings_sync_util 101 } // namespace settings_sync_util
102 102
103 } // namespace extensions 103 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/settings/settings_sync_unittest.cc ('k') | chrome/browser/extensions/system/system_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698