OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/renderer/api_signature.h" | 5 #include "extensions/renderer/api_signature.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 const APITypeReferenceMap& type_refs, | 125 const APITypeReferenceMap& type_refs, |
126 std::string* error, | 126 std::string* error, |
127 base::ListValue* list_value) | 127 base::ListValue* list_value) |
128 : ArgumentParser(context, signature, arguments, type_refs, error), | 128 : ArgumentParser(context, signature, arguments, type_refs, error), |
129 list_value_(list_value) {} | 129 list_value_(list_value) {} |
130 | 130 |
131 v8::Local<v8::Function> callback() { return callback_; } | 131 v8::Local<v8::Function> callback() { return callback_; } |
132 | 132 |
133 private: | 133 private: |
134 void AddNull() override { | 134 void AddNull() override { |
135 list_value_->Append(base::Value::CreateNullValue()); | 135 list_value_->Append(base::MakeUnique<base::Value>()); |
136 } | 136 } |
137 void AddNullCallback() override { | 137 void AddNullCallback() override { |
138 // The base::Value conversion doesn't include the callback directly, so we | 138 // The base::Value conversion doesn't include the callback directly, so we |
139 // don't add a null parameter here. | 139 // don't add a null parameter here. |
140 } | 140 } |
141 std::unique_ptr<base::Value>* GetBuffer() override { return &last_arg_; } | 141 std::unique_ptr<base::Value>* GetBuffer() override { return &last_arg_; } |
142 void AddParsedArgument(v8::Local<v8::Value> value) override { | 142 void AddParsedArgument(v8::Local<v8::Value> value) override { |
143 // The corresponding base::Value is expected to have been stored in | 143 // The corresponding base::Value is expected to have been stored in |
144 // |last_arg_| already. | 144 // |last_arg_| already. |
145 DCHECK(last_arg_); | 145 DCHECK(last_arg_); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 return false; | 312 return false; |
313 json->Append(std::move(converted)); | 313 json->Append(std::move(converted)); |
314 } | 314 } |
315 | 315 |
316 *json_out = std::move(json); | 316 *json_out = std::move(json); |
317 *callback_out = callback; | 317 *callback_out = callback; |
318 return true; | 318 return true; |
319 } | 319 } |
320 | 320 |
321 } // namespace extensions | 321 } // namespace extensions |
OLD | NEW |