| OLD | NEW |
| 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/values.h" | 10 #include "base/values.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 // ListBuilder | 67 // ListBuilder |
| 68 | 68 |
| 69 ListBuilder::ListBuilder() : list_(new base::ListValue) {} | 69 ListBuilder::ListBuilder() : list_(new base::ListValue) {} |
| 70 ListBuilder::ListBuilder(const base::ListValue& init) : list_(init.DeepCopy()) { | 70 ListBuilder::ListBuilder(const base::ListValue& init) : list_(init.DeepCopy()) { |
| 71 } | 71 } |
| 72 ListBuilder::~ListBuilder() {} | 72 ListBuilder::~ListBuilder() {} |
| 73 | 73 |
| 74 ListBuilder& ListBuilder::Append(int in_value) { | 74 ListBuilder& ListBuilder::Append(int in_value) { |
| 75 list_->Append(new base::FundamentalValue(in_value)); | 75 list_->AppendInteger(in_value); |
| 76 return *this; | 76 return *this; |
| 77 } | 77 } |
| 78 | 78 |
| 79 ListBuilder& ListBuilder::Append(double in_value) { | 79 ListBuilder& ListBuilder::Append(double in_value) { |
| 80 list_->Append(new base::FundamentalValue(in_value)); | 80 list_->AppendDouble(in_value); |
| 81 return *this; | 81 return *this; |
| 82 } | 82 } |
| 83 | 83 |
| 84 ListBuilder& ListBuilder::Append(const std::string& in_value) { | 84 ListBuilder& ListBuilder::Append(const std::string& in_value) { |
| 85 list_->Append(new base::StringValue(in_value)); | 85 list_->AppendString(in_value); |
| 86 return *this; | 86 return *this; |
| 87 } | 87 } |
| 88 | 88 |
| 89 ListBuilder& ListBuilder::Append(const base::string16& in_value) { | 89 ListBuilder& ListBuilder::Append(const base::string16& in_value) { |
| 90 list_->Append(new base::StringValue(in_value)); | 90 list_->AppendString(in_value); |
| 91 return *this; | 91 return *this; |
| 92 } | 92 } |
| 93 | 93 |
| 94 ListBuilder& ListBuilder::Append(std::unique_ptr<base::Value> in_value) { | 94 ListBuilder& ListBuilder::Append(std::unique_ptr<base::Value> in_value) { |
| 95 list_->Append(std::move(in_value)); | 95 list_->Append(std::move(in_value)); |
| 96 return *this; | 96 return *this; |
| 97 } | 97 } |
| 98 | 98 |
| 99 ListBuilder& ListBuilder::AppendBoolean(bool in_value) { | 99 ListBuilder& ListBuilder::AppendBoolean(bool in_value) { |
| 100 list_->Append(new base::FundamentalValue(in_value)); | 100 list_->AppendBoolean(in_value); |
| 101 return *this; | 101 return *this; |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace extensions | 104 } // namespace extensions |
| OLD | NEW |