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

Side by Side Diff: extensions/common/value_builder.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "extensions/common/value_builder.h" 5 #include "extensions/common/value_builder.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 8
9 namespace extensions { 9 namespace extensions {
10 10
11 // DictionaryBuilder 11 // DictionaryBuilder
12 12
13 DictionaryBuilder::DictionaryBuilder() : dict_(new base::DictionaryValue) {} 13 DictionaryBuilder::DictionaryBuilder() : dict_(new base::DictionaryValue) {}
14 14
15 DictionaryBuilder::DictionaryBuilder(const base::DictionaryValue& init) 15 DictionaryBuilder::DictionaryBuilder(const base::DictionaryValue& init)
16 : dict_(init.DeepCopy()) {} 16 : dict_(init.DeepCopy()) {}
17 17
18 DictionaryBuilder::~DictionaryBuilder() {} 18 DictionaryBuilder::~DictionaryBuilder() {}
19 19
20 std::string DictionaryBuilder::ToJSON() const { 20 std::string DictionaryBuilder::ToJSON() const {
21 std::string json; 21 std::string json;
22 base::JSONWriter::WriteWithOptions( 22 base::JSONWriter::WriteWithOptions(
23 dict_.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &json); 23 *dict_, base::JSONWriter::OPTIONS_PRETTY_PRINT, &json);
24 return json; 24 return json;
25 } 25 }
26 26
27 DictionaryBuilder& DictionaryBuilder::Set(const std::string& path, 27 DictionaryBuilder& DictionaryBuilder::Set(const std::string& path,
28 int in_value) { 28 int in_value) {
29 dict_->SetWithoutPathExpansion(path, new base::FundamentalValue(in_value)); 29 dict_->SetWithoutPathExpansion(path, new base::FundamentalValue(in_value));
30 return *this; 30 return *this;
31 } 31 }
32 32
33 DictionaryBuilder& DictionaryBuilder::Set(const std::string& path, 33 DictionaryBuilder& DictionaryBuilder::Set(const std::string& path,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 list_->Append(in_value.Build().release()); 102 list_->Append(in_value.Build().release());
103 return *this; 103 return *this;
104 } 104 }
105 105
106 ListBuilder& ListBuilder::AppendBoolean(bool in_value) { 106 ListBuilder& ListBuilder::AppendBoolean(bool in_value) {
107 list_->Append(new base::FundamentalValue(in_value)); 107 list_->Append(new base::FundamentalValue(in_value));
108 return *this; 108 return *this;
109 } 109 }
110 110
111 } // namespace extensions 111 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/permissions/set_disjunction_permission.h ('k') | google_apis/drive/drive_api_requests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698