diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-01 21:57:00 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-01 21:57:00 +0000 |
commit | d7eaf5753249cbb6e95441b07e00a6349c7afe89 (patch) | |
tree | 7d03c6ce6a182a52465ad4d8f410117c2430a6bf /chrome/browser/extensions/extension_page_actions_module.cc | |
parent | 92ac30171a8334bc1691096abccf004ed02d0d42 (diff) | |
download | chromium_src-d7eaf5753249cbb6e95441b07e00a6349c7afe89.zip chromium_src-d7eaf5753249cbb6e95441b07e00a6349c7afe89.tar.gz chromium_src-d7eaf5753249cbb6e95441b07e00a6349c7afe89.tar.bz2 |
PageActions can now specify multiple icons and switch between them
using optional parameters to enableForTab.
BUG=http://crbug.com/11906
TEST=None
Review URL: http://codereview.chromium.org/149046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19772 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 | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/chrome/browser/extensions/extension_page_actions_module.cc b/chrome/browser/extensions/extension_page_actions_module.cc index 66bd9e3..d3ba09a 100644 --- a/chrome/browser/extensions/extension_page_actions_module.cc +++ b/chrome/browser/extensions/extension_page_actions_module.cc @@ -31,6 +31,18 @@ bool PageActionFunction::SetPageActionEnabled(bool enable) { std::string url; EXTENSION_FUNCTION_VALIDATE(action->GetString(keys::kUrlKey, &url)); + std::string title; + int icon_id = 0; + if (enable) { + // Both of those are optional. + if (action->HasKey(keys::kTitleKey)) + EXTENSION_FUNCTION_VALIDATE(action->GetString(keys::kTitleKey, &title)); + if (action->HasKey(keys::kIconIdKey)) { + EXTENSION_FUNCTION_VALIDATE(action->GetInteger(keys::kIconIdKey, + &icon_id)); + } + } + // Find the TabContents that contains this tab id. TabContents* contents = NULL; ExtensionTabUtil::GetTabById(tab_id, profile(), NULL, NULL, &contents, NULL); @@ -66,7 +78,7 @@ bool PageActionFunction::SetPageActionEnabled(bool enable) { } // Set visibility and broadcast notifications that the UI should be updated. - contents->SetPageActionEnabled(page_action, enable); + contents->SetPageActionEnabled(page_action, enable, title, icon_id); contents->NotifyNavigationStateChanged(TabContents::INVALIDATE_PAGE_ACTIONS); return true; |