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

Side by Side Diff: extensions/browser/extension_function.cc

Issue 2038613003: Revert of ExtensionFunction: don't pass ownership of base::Value by raw pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/browser/extension_function.h" 5 #include "extensions/browser/extension_function.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 bool ExtensionFunction::user_gesture() const { 284 bool ExtensionFunction::user_gesture() const {
285 return user_gesture_ || UserGestureForTests::GetInstance()->HaveGesture(); 285 return user_gesture_ || UserGestureForTests::GetInstance()->HaveGesture();
286 } 286 }
287 287
288 ExtensionFunction::ResponseValue ExtensionFunction::NoArguments() { 288 ExtensionFunction::ResponseValue ExtensionFunction::NoArguments() {
289 return ResponseValue(new ArgumentListResponseValue( 289 return ResponseValue(new ArgumentListResponseValue(
290 name(), "NoArguments", this, base::WrapUnique(new base::ListValue()))); 290 name(), "NoArguments", this, base::WrapUnique(new base::ListValue())));
291 } 291 }
292 292
293 ExtensionFunction::ResponseValue ExtensionFunction::OneArgument( 293 ExtensionFunction::ResponseValue ExtensionFunction::OneArgument(
294 base::Value* arg) {
295 std::unique_ptr<base::ListValue> args(new base::ListValue());
296 args->Append(arg);
297 return ResponseValue(new ArgumentListResponseValue(name(), "OneArgument",
298 this, std::move(args)));
299 }
300
301 ExtensionFunction::ResponseValue ExtensionFunction::OneArgument(
294 std::unique_ptr<base::Value> arg) { 302 std::unique_ptr<base::Value> arg) {
295 std::unique_ptr<base::ListValue> args(new base::ListValue()); 303 return OneArgument(arg.release());
296 args->Append(std::move(arg));
297 return ResponseValue(new ArgumentListResponseValue(name(), "OneArgument",
298 this, std::move(args)));
299 } 304 }
300 305
301 ExtensionFunction::ResponseValue ExtensionFunction::TwoArguments( 306 ExtensionFunction::ResponseValue ExtensionFunction::TwoArguments(
302 std::unique_ptr<base::Value> arg1, 307 base::Value* arg1,
303 std::unique_ptr<base::Value> arg2) { 308 base::Value* arg2) {
304 std::unique_ptr<base::ListValue> args(new base::ListValue()); 309 std::unique_ptr<base::ListValue> args(new base::ListValue());
305 args->Append(std::move(arg1)); 310 args->Append(arg1);
306 args->Append(std::move(arg2)); 311 args->Append(arg2);
307 return ResponseValue(new ArgumentListResponseValue(name(), "TwoArguments", 312 return ResponseValue(new ArgumentListResponseValue(name(), "TwoArguments",
308 this, std::move(args))); 313 this, std::move(args)));
309 } 314 }
310 315
311 ExtensionFunction::ResponseValue ExtensionFunction::ArgumentList( 316 ExtensionFunction::ResponseValue ExtensionFunction::ArgumentList(
312 std::unique_ptr<base::ListValue> args) { 317 std::unique_ptr<base::ListValue> args) {
313 return ResponseValue(new ArgumentListResponseValue(name(), "ArgumentList", 318 return ResponseValue(new ArgumentListResponseValue(name(), "ArgumentList",
314 this, std::move(args))); 319 this, std::move(args)));
315 } 320 }
316 321
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { 572 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() {
568 return RespondNow(RunSync() ? ArgumentList(std::move(results_)) 573 return RespondNow(RunSync() ? ArgumentList(std::move(results_))
569 : Error(error_)); 574 : Error(error_));
570 } 575 }
571 576
572 // static 577 // static
573 bool SyncIOThreadExtensionFunction::ValidationFailure( 578 bool SyncIOThreadExtensionFunction::ValidationFailure(
574 SyncIOThreadExtensionFunction* function) { 579 SyncIOThreadExtensionFunction* function) {
575 return false; 580 return false;
576 } 581 }
OLDNEW
« no previous file with comments | « extensions/browser/extension_function.h ('k') | extensions/shell/browser/api/identity/identity_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698