diff options
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)); |