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

Unified Diff: extensions/browser/extension_function.h

Issue 291453002: Make ExtensionFunction::ArgumentList (PKA MultipleArguments) take a scoped_ptr (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reabse Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/api/storage/storage_api.cc ('k') | extensions/browser/extension_function.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/extension_function.h
diff --git a/extensions/browser/extension_function.h b/extensions/browser/extension_function.h
index 12ba0ae26e8c6afdcde9a4be156cc44d29e955b0..dca24a403409f2028a2d91aea8ef540cc5053f7b 100644
--- a/extensions/browser/extension_function.h
+++ b/extensions/browser/extension_function.h
@@ -115,7 +115,7 @@ class ExtensionFunction
// The result of a function call.
//
- // Use NoArguments(), SingleArgument(), MultipleArguments(), or Error()
+ // Use NoArguments(), OneArgument(), ArgumentList(), or Error()
// rather than this class directly.
class ResponseValueObject {
public:
@@ -142,8 +142,8 @@ class ExtensionFunction
//
// Typical return values might be:
// * RespondNow(NoArguments())
- // * RespondNow(SingleArgument(42))
- // * RespondNow(MultipleArguments(my_result.ToValue()))
+ // * RespondNow(OneArgument(42))
+ // * RespondNow(ArgumentList(my_result.ToValue()))
// * RespondNow(Error("Warp core breach"))
// * RespondLater(), then later,
// * Respond(NoArguments())
@@ -248,10 +248,20 @@ class ExtensionFunction
//
// Success, no arguments to pass to caller
ResponseValue NoArguments();
- // Success, a single argument |result| to pass to caller. TAKES OWNERSHIP.
- ResponseValue SingleArgument(base::Value* result);
- // Success, a list of arguments |results| to pass to caller. TAKES OWNERSHIP.
- ResponseValue MultipleArguments(base::ListValue* results);
+ // Success, a single argument |arg| to pass to caller. TAKES OWNERSHIP -- a
+ // raw pointer for convenience, since callers usually construct the argument
+ // to this by hand.
+ ResponseValue OneArgument(base::Value* arg);
+ // Success, two arguments |arg1| and |arg2| to pass to caller. TAKES
+ // OWNERSHIP -- raw pointers for convenience, since callers usually construct
+ // the argument to this by hand. Note that use of this function may imply you
+ // should be using the generated Result struct and ArgumentList.
+ ResponseValue TwoArguments(base::Value* arg1, base::Value* arg2);
+ // Success, a list of arguments |results| to pass to caller. TAKES OWNERSHIP
+ // --
+ // a scoped_ptr<> for convenience, since callers usually get this from the
+ // result of a ToValue() call on the generated Result struct.
+ ResponseValue ArgumentList(scoped_ptr<base::ListValue> results);
// Error. chrome.runtime.lastError.message will be set to |error|.
ResponseValue Error(const std::string& error);
// Bad message. A ResponseValue equivalent to EXTENSION_FUNCTION_VALIDATE().
« no previous file with comments | « extensions/browser/api/storage/storage_api.cc ('k') | extensions/browser/extension_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698