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_context_menu_api.cc | |
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_context_menu_api.cc')
-rw-r--r-- | chrome/browser/extensions/extension_context_menu_api.cc | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/chrome/browser/extensions/extension_context_menu_api.cc b/chrome/browser/extensions/extension_context_menu_api.cc index 08afa51..ab748f0 100644 --- a/chrome/browser/extensions/extension_context_menu_api.cc +++ b/chrome/browser/extensions/extension_context_menu_api.cc @@ -135,8 +135,8 @@ bool ExtensionContextMenuFunction::GetParent( } bool CreateContextMenuFunction::RunImpl() { - EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY)); - const DictionaryValue* properties = args_as_dictionary(); + DictionaryValue* properties; + EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &properties)); EXTENSION_FUNCTION_VALIDATE(properties != NULL); std::string title; @@ -201,10 +201,8 @@ bool CreateContextMenuFunction::RunImpl() { } bool UpdateContextMenuFunction::RunImpl() { - EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_LIST)); - const ListValue* args = args_as_list(); int item_id = 0; - EXTENSION_FUNCTION_VALIDATE(args->GetInteger(0, &item_id)); + EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &item_id)); ExtensionsService* service = profile()->GetExtensionsService(); ExtensionMenuManager* manager = service->menu_manager(); @@ -215,7 +213,7 @@ bool UpdateContextMenuFunction::RunImpl() { } DictionaryValue *properties = NULL; - EXTENSION_FUNCTION_VALIDATE(args->GetDictionary(1, &properties)); + EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &properties)); EXTENSION_FUNCTION_VALIDATE(properties != NULL); ExtensionMenuManager* menu_manager = @@ -273,9 +271,8 @@ bool UpdateContextMenuFunction::RunImpl() { } bool RemoveContextMenuFunction::RunImpl() { - EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_INTEGER)); int id = 0; - EXTENSION_FUNCTION_VALIDATE(args_->GetAsInteger(&id)); + EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &id)); ExtensionsService* service = profile()->GetExtensionsService(); ExtensionMenuManager* manager = service->menu_manager(); |