Chromium Code Reviews| Index: chrome/browser/extensions/api/extension_action/extension_page_actions_api.cc |
| diff --git a/chrome/browser/extensions/api/extension_action/extension_page_actions_api.cc b/chrome/browser/extensions/api/extension_action/extension_page_actions_api.cc |
| index 81a9c2d6effb0587ffc90e5275428d0f22d7d751..79a2acdfb3aa6b94493cfb238409acc318b35fe8 100644 |
| --- a/chrome/browser/extensions/api/extension_action/extension_page_actions_api.cc |
| +++ b/chrome/browser/extensions/api/extension_action/extension_page_actions_api.cc |
| @@ -67,12 +67,14 @@ bool PageActionFunction::RunImpl() { |
| return true; |
| } |
| -bool PageActionFunction::SetPageActionEnabled(bool enable) { |
| +bool PageActionsFunction::SetPageActionEnabled(bool enable) { |
| std::string extension_action_id; |
| EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_action_id)); |
| DictionaryValue* action = NULL; |
| EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &action)); |
| + int tab_id; |
| + EXTENSION_FUNCTION_VALIDATE(action->GetInteger(keys::kTabIdKey, &tab_id)); |
| std::string url; |
| EXTENSION_FUNCTION_VALIDATE(action->GetString(keys::kUrlKey, &url)); |
| @@ -103,10 +105,10 @@ bool PageActionFunction::SetPageActionEnabled(bool enable) { |
| // Find the TabContents that contains this tab id. |
| TabContentsWrapper* contents = NULL; |
| bool result = ExtensionTabUtil::GetTabById( |
| - tab_id_, profile(), include_incognito(), NULL, NULL, &contents, NULL); |
| + tab_id, profile(), include_incognito(), NULL, NULL, &contents, NULL); |
| if (!result || !contents) { |
| error_ = ExtensionErrorUtils::FormatErrorMessage( |
| - kNoTabError, base::IntToString(tab_id_)); |
| + kNoTabError, base::IntToString(tab_id)); |
| return false; |
| } |
| @@ -119,9 +121,9 @@ bool PageActionFunction::SetPageActionEnabled(bool enable) { |
| } |
| // Set visibility and broadcast notifications that the UI should be updated. |
| - page_action->SetIsVisible(tab_id_, enable); |
| - page_action->SetTitle(tab_id_, title); |
| - page_action->SetIconIndex(tab_id_, icon_id); |
| + page_action->SetIsVisible(tab_id, enable); |
| + page_action->SetTitle(tab_id, title); |
| + page_action->SetIconIndex(tab_id, icon_id); |
| contents->extension_tab_helper()->PageActionStateChanged(); |
| return true; |
| @@ -133,11 +135,17 @@ bool PageActionFunction::SetVisible(bool visible) { |
| return true; |
| } |
| -bool EnablePageActionFunction::RunExtensionAction() { |
| +PageActionsFunction::PageActionsFunction() { |
|
Aaron Boodman
2012/04/13 22:52:52
can you move the constructor and destructor impls
cduvall
2012/04/13 22:59:19
Done.
|
| +} |
| + |
| +PageActionsFunction::~PageActionsFunction() { |
| +} |
| + |
| +bool EnablePageActionsFunction::RunImpl() { |
| return SetPageActionEnabled(true); |
| } |
| -bool DisablePageActionFunction::RunExtensionAction() { |
| +bool DisablePageActionsFunction::RunImpl() { |
| return SetPageActionEnabled(false); |
| } |