diff options
author | arv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-21 23:30:15 +0000 |
---|---|---|
committer | arv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-21 23:30:15 +0000 |
commit | 438c97d23785f28465304e1cb521b5125e9ea469 (patch) | |
tree | 5bc5c6ae6c72b9c8567c13a0b32d491b25e81f88 /chrome/browser/extensions/extension_function.h | |
parent | 69e297f187425f2b31db37bfe51af86f28c38275 (diff) | |
download | chromium_src-438c97d23785f28465304e1cb521b5125e9ea469.zip chromium_src-438c97d23785f28465304e1cb521b5125e9ea469.tar.gz chromium_src-438c97d23785f28465304e1cb521b5125e9ea469.tar.bz2 |
Update extension functions to always pass a list of arguments, even when one argument was passed.
BUG=36301
TEST=Updated tests and ran all the existing tests.
Review URL: http://codereview.chromium.org/2137012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47972 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_function.h')
-rw-r--r-- | chrome/browser/extensions/extension_function.h | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/chrome/browser/extensions/extension_function.h b/chrome/browser/extensions/extension_function.h index c715c28..d0e1d74 100644 --- a/chrome/browser/extensions/extension_function.h +++ b/chrome/browser/extensions/extension_function.h @@ -58,7 +58,7 @@ class ExtensionFunction : public base::RefCounted<ExtensionFunction> { std::string extension_id() const { return extension_id_; } // Specifies the raw arguments to the function, as a JSON value. - virtual void SetArgs(const Value* args) = 0; + virtual void SetArgs(const ListValue* args) = 0; // Retrieves the results of the function as a JSON-encoded string (may // be empty). @@ -165,7 +165,7 @@ class AsyncExtensionFunction : public ExtensionFunction { public: AsyncExtensionFunction() : args_(NULL), bad_message_(false) {} - virtual void SetArgs(const Value* args); + virtual void SetArgs(const ListValue* args); virtual const std::string GetResult(); virtual const std::string GetError() { return error_; } virtual void Run() { @@ -182,19 +182,12 @@ class AsyncExtensionFunction : public ExtensionFunction { void SendResponse(bool success); - const ListValue* args_as_list() { - return static_cast<ListValue*>(args_.get()); - } - const DictionaryValue* args_as_dictionary() { - return static_cast<DictionaryValue*>(args_.get()); - } - // Return true if the argument to this function at |index| was provided and // is non-null. bool HasOptionalArgument(size_t index); // The arguments to the API. Only non-null if argument were specified. - scoped_ptr<Value> args_; + scoped_ptr<ListValue> args_; // The result of the API. This should be populated by the derived class before // SendResponse() is called. |