diff options
author | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-06 16:36:39 +0000 |
---|---|---|
committer | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-06 16:36:39 +0000 |
commit | ad6ff1a4ac380756fb55da9a0dc7455f308fe1f9 (patch) | |
tree | 060efa56c070df860e16bc7ff3aef03ce1cd554a /chrome/browser/extensions | |
parent | 8ffc8520f1b7f469bcee1dfed2a8cfb9593941fe (diff) | |
download | chromium_src-ad6ff1a4ac380756fb55da9a0dc7455f308fe1f9.zip chromium_src-ad6ff1a4ac380756fb55da9a0dc7455f308fe1f9.tar.gz chromium_src-ad6ff1a4ac380756fb55da9a0dc7455f308fe1f9.tar.bz2 |
Don't show popup browser actions in the wrench menu.
BUG=23834
TEST=none
Review URL: http://codereview.chromium.org/257048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28119 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r-- | chrome/browser/extensions/browser_action_test.cc | 5 | ||||
-rw-r--r-- | chrome/browser/extensions/extensions_service.cc | 15 | ||||
-rw-r--r-- | chrome/browser/extensions/extensions_service.h | 8 |
3 files changed, 17 insertions, 11 deletions
diff --git a/chrome/browser/extensions/browser_action_test.cc b/chrome/browser/extensions/browser_action_test.cc index f597f07..acf0c94 100644 --- a/chrome/browser/extensions/browser_action_test.cc +++ b/chrome/browser/extensions/browser_action_test.cc @@ -18,9 +18,10 @@ static void TestAction(Browser* browser) { ui_test_utils::NavigateToURL(browser, GURL("http://localhost:1337/files/extensions/test_file.txt")); - // Send the command. + // Send the command. Note that this only works for non-popup actions, so + // we specify |false|. ExtensionsService* service = browser->profile()->GetExtensionsService(); - browser->ExecuteCommand(service->GetBrowserActions()[0]->command_id()); + browser->ExecuteCommand(service->GetBrowserActions(false)[0]->command_id()); // Verify the command worked. TabContents* tab = browser->GetSelectedTabContents(); diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc index 4f61ac4..f65e6ff 100644 --- a/chrome/browser/extensions/extensions_service.cc +++ b/chrome/browser/extensions/extensions_service.cc @@ -146,11 +146,12 @@ void ExtensionsService::Init() { } std::vector<ExtensionAction*> ExtensionsService::GetPageActions() const { - return GetExtensionActions(ExtensionAction::PAGE_ACTION); + return GetExtensionActions(ExtensionAction::PAGE_ACTION, true); } -std::vector<ExtensionAction*> ExtensionsService::GetBrowserActions() const { - return GetExtensionActions(ExtensionAction::BROWSER_ACTION); +std::vector<ExtensionAction*> ExtensionsService::GetBrowserActions( + bool include_popups) const { + return GetExtensionActions(ExtensionAction::BROWSER_ACTION, include_popups); } void ExtensionsService::InstallExtension(const FilePath& extension_path) { @@ -365,7 +366,8 @@ void ExtensionsService::NotifyExtensionUnloaded(Extension* extension) { } std::vector<ExtensionAction*> ExtensionsService::GetExtensionActions( - ExtensionAction::ExtensionActionType action_type) const { + ExtensionAction::ExtensionActionType action_type, + bool include_popups) const { std::vector<ExtensionAction*> result; // TODO(finnur): Sort the icons in some meaningful way. @@ -375,11 +377,12 @@ std::vector<ExtensionAction*> ExtensionsService::GetExtensionActions( const ExtensionActionMap* page_actions = &(*iter)->page_actions(); for (ExtensionActionMap::const_iterator i(page_actions->begin()); i != page_actions->end(); ++i) { - result.push_back(i->second); + if (include_popups || !i->second->is_popup()) + result.push_back(i->second); } } else { ExtensionAction* browser_action = (*iter)->browser_action(); - if (browser_action) + if (browser_action && (include_popups || !browser_action->is_popup())) result.push_back(browser_action); } } diff --git a/chrome/browser/extensions/extensions_service.h b/chrome/browser/extensions/extensions_service.h index d4a6805..e4fd701 100644 --- a/chrome/browser/extensions/extensions_service.h +++ b/chrome/browser/extensions/extensions_service.h @@ -108,7 +108,7 @@ class ExtensionsService // Retrieves a vector of all browser actions, irrespective of which extension // they belong to. - std::vector<ExtensionAction*> GetBrowserActions() const; + std::vector<ExtensionAction*> GetBrowserActions(bool include_popups) const; // Install the extension file at |extension_path|. Will install as an // update if an older version is already installed. @@ -243,9 +243,11 @@ class ExtensionsService void NotifyExtensionUnloaded(Extension* extension); // Retrieves a vector of all page actions or browser actions, irrespective of - // which extension they belong to. + // which extension they belong to. If |include_popups| is false, actions that + // are popups are excluded. std::vector<ExtensionAction*> GetExtensionActions( - ExtensionAction::ExtensionActionType action_type) const; + ExtensionAction::ExtensionActionType action_type, + bool include_popups) const; // The profile this ExtensionsService is part of. Profile* profile_; |