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_page_actions_module.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_page_actions_module.cc')
-rw-r--r-- | chrome/browser/extensions/extension_page_actions_module.cc | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/chrome/browser/extensions/extension_page_actions_module.cc b/chrome/browser/extensions/extension_page_actions_module.cc index a169450..f91c5ef 100644 --- a/chrome/browser/extensions/extension_page_actions_module.cc +++ b/chrome/browser/extensions/extension_page_actions_module.cc @@ -32,13 +32,10 @@ const char kNoIconSpecified[] = "Page action has no icons to show."; // TODO(EXTENSIONS_DEPRECATED): obsolete API. bool PageActionFunction::SetPageActionEnabled(bool enable) { - EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_LIST)); - const ListValue* args = args_as_list(); - std::string page_action_id; - EXTENSION_FUNCTION_VALIDATE(args->GetString(0, &page_action_id)); + EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &page_action_id)); DictionaryValue* action; - EXTENSION_FUNCTION_VALIDATE(args->GetDictionary(1, &action)); + EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &action)); int tab_id; EXTENSION_FUNCTION_VALIDATE(action->GetInteger(keys::kTabIdKey, &tab_id)); @@ -117,7 +114,7 @@ bool PageActionFunction::InitCommon(int tab_id) { bool PageActionFunction::SetVisible(bool visible) { int tab_id; - EXTENSION_FUNCTION_VALIDATE(args_->GetAsInteger(&tab_id)); + EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &tab_id)); if (!InitCommon(tab_id)) return false; @@ -143,8 +140,8 @@ bool PageActionHideFunction::RunImpl() { } bool PageActionSetIconFunction::RunImpl() { - EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY)); - const DictionaryValue* args = args_as_dictionary(); + DictionaryValue* args; + EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &args)); int tab_id; EXTENSION_FUNCTION_VALIDATE(args->GetInteger(L"tabId", &tab_id)); @@ -179,8 +176,8 @@ bool PageActionSetIconFunction::RunImpl() { } bool PageActionSetTitleFunction::RunImpl() { - EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY)); - const DictionaryValue* args = args_as_dictionary(); + DictionaryValue* args; + EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &args)); int tab_id; EXTENSION_FUNCTION_VALIDATE(args->GetInteger(L"tabId", &tab_id)); @@ -196,8 +193,8 @@ bool PageActionSetTitleFunction::RunImpl() { } bool PageActionSetPopupFunction::RunImpl() { - EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY)); - const DictionaryValue* args = args_as_dictionary(); + DictionaryValue* args; + EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &args)); int tab_id; EXTENSION_FUNCTION_VALIDATE(args->GetInteger(L"tabId", &tab_id)); @@ -221,8 +218,8 @@ bool PageActionSetPopupFunction::RunImpl() { // Not currently exposed to extensions. To re-enable, add mapping in // extension_function_dispatcher. bool PageActionSetBadgeBackgroundColorFunction::RunImpl() { - EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY)); - const DictionaryValue* args = args_as_dictionary(); + DictionaryValue* args; + EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &args)); int tab_id; EXTENSION_FUNCTION_VALIDATE(args->GetInteger(L"tabId", &tab_id)); @@ -247,8 +244,8 @@ bool PageActionSetBadgeBackgroundColorFunction::RunImpl() { // Not currently exposed to extensions. To re-enable, add mapping in // extension_function_dispatcher. bool PageActionSetBadgeTextColorFunction::RunImpl() { - EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY)); - const DictionaryValue* args = args_as_dictionary(); + DictionaryValue* args; + EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &args)); int tab_id; EXTENSION_FUNCTION_VALIDATE(args->GetInteger(L"tabId", &tab_id)); @@ -273,8 +270,8 @@ bool PageActionSetBadgeTextColorFunction::RunImpl() { // Not currently exposed to extensions. To re-enable, add mapping in // extension_function_dispatcher. bool PageActionSetBadgeTextFunction::RunImpl() { - EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY)); - const DictionaryValue* args = args_as_dictionary(); + DictionaryValue* args; + EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &args)); int tab_id; EXTENSION_FUNCTION_VALIDATE(args->GetInteger(L"tabId", &tab_id)); |