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

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

Issue 2476493003: Remove FundamentalValue
Patch Set: Fix Created 4 years, 1 month 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 <utility> 7 #include <utility>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 12 matching lines...) Expand all
23 23
24 std::string DictionaryBuilder::ToJSON() const { 24 std::string DictionaryBuilder::ToJSON() const {
25 std::string json; 25 std::string json;
26 base::JSONWriter::WriteWithOptions( 26 base::JSONWriter::WriteWithOptions(
27 *dict_, base::JSONWriter::OPTIONS_PRETTY_PRINT, &json); 27 *dict_, base::JSONWriter::OPTIONS_PRETTY_PRINT, &json);
28 return json; 28 return json;
29 } 29 }
30 30
31 DictionaryBuilder& DictionaryBuilder::Set(const std::string& path, 31 DictionaryBuilder& DictionaryBuilder::Set(const std::string& path,
32 int in_value) { 32 int in_value) {
33 dict_->SetWithoutPathExpansion( 33 dict_->SetWithoutPathExpansion(path, base::MakeUnique<base::Value>(in_value));
34 path, base::MakeUnique<base::FundamentalValue>(in_value));
35 return *this; 34 return *this;
36 } 35 }
37 36
38 DictionaryBuilder& DictionaryBuilder::Set(const std::string& path, 37 DictionaryBuilder& DictionaryBuilder::Set(const std::string& path,
39 double in_value) { 38 double in_value) {
40 dict_->SetWithoutPathExpansion( 39 dict_->SetWithoutPathExpansion(path, base::MakeUnique<base::Value>(in_value));
41 path, base::MakeUnique<base::FundamentalValue>(in_value));
42 return *this; 40 return *this;
43 } 41 }
44 42
45 DictionaryBuilder& DictionaryBuilder::Set(const std::string& path, 43 DictionaryBuilder& DictionaryBuilder::Set(const std::string& path,
46 const std::string& in_value) { 44 const std::string& in_value) {
47 dict_->SetWithoutPathExpansion(path, 45 dict_->SetWithoutPathExpansion(path,
48 base::MakeUnique<base::StringValue>(in_value)); 46 base::MakeUnique<base::StringValue>(in_value));
49 return *this; 47 return *this;
50 } 48 }
51 49
52 DictionaryBuilder& DictionaryBuilder::Set(const std::string& path, 50 DictionaryBuilder& DictionaryBuilder::Set(const std::string& path,
53 const base::string16& in_value) { 51 const base::string16& in_value) {
54 dict_->SetWithoutPathExpansion(path, 52 dict_->SetWithoutPathExpansion(path,
55 base::MakeUnique<base::StringValue>(in_value)); 53 base::MakeUnique<base::StringValue>(in_value));
56 return *this; 54 return *this;
57 } 55 }
58 56
59 DictionaryBuilder& DictionaryBuilder::Set( 57 DictionaryBuilder& DictionaryBuilder::Set(
60 const std::string& path, 58 const std::string& path,
61 std::unique_ptr<base::Value> in_value) { 59 std::unique_ptr<base::Value> in_value) {
62 dict_->SetWithoutPathExpansion(path, std::move(in_value)); 60 dict_->SetWithoutPathExpansion(path, std::move(in_value));
63 return *this; 61 return *this;
64 } 62 }
65 63
66 DictionaryBuilder& DictionaryBuilder::SetBoolean( 64 DictionaryBuilder& DictionaryBuilder::SetBoolean(
67 const std::string& path, bool in_value) { 65 const std::string& path, bool in_value) {
68 dict_->SetWithoutPathExpansion( 66 dict_->SetWithoutPathExpansion(path, base::MakeUnique<base::Value>(in_value));
69 path, base::MakeUnique<base::FundamentalValue>(in_value));
70 return *this; 67 return *this;
71 } 68 }
72 69
73 // ListBuilder 70 // ListBuilder
74 71
75 ListBuilder::ListBuilder() : list_(new base::ListValue) {} 72 ListBuilder::ListBuilder() : list_(new base::ListValue) {}
76 ListBuilder::ListBuilder(const base::ListValue& init) : list_(init.DeepCopy()) { 73 ListBuilder::ListBuilder(const base::ListValue& init) : list_(init.DeepCopy()) {
77 } 74 }
78 ListBuilder::~ListBuilder() {} 75 ListBuilder::~ListBuilder() {}
79 76
(...skipping 21 matching lines...) Expand all
101 list_->Append(std::move(in_value)); 98 list_->Append(std::move(in_value));
102 return *this; 99 return *this;
103 } 100 }
104 101
105 ListBuilder& ListBuilder::AppendBoolean(bool in_value) { 102 ListBuilder& ListBuilder::AppendBoolean(bool in_value) {
106 list_->AppendBoolean(in_value); 103 list_->AppendBoolean(in_value);
107 return *this; 104 return *this;
108 } 105 }
109 106
110 } // namespace extensions 107 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/value_store/value_store_frontend_unittest.cc ('k') | extensions/renderer/argument_spec.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698