summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/toolbar_view.cc
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-15 06:59:22 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-15 06:59:22 +0000
commit80d6a44253e9e28bbb06a384d6249f1623e8b1e4 (patch)
treea581b4528f323ea84b5c8b5b6a92bc767096efa1 /chrome/browser/views/toolbar_view.cc
parent83fe23a3ff26c5dea371ce94f6a909c4d081b145 (diff)
downloadchromium_src-80d6a44253e9e28bbb06a384d6249f1623e8b1e4.zip
chromium_src-80d6a44253e9e28bbb06a384d6249f1623e8b1e4.tar.gz
chromium_src-80d6a44253e9e28bbb06a384d6249f1623e8b1e4.tar.bz2
Reland r29095 (removes wrench integration for
browser actions). Test failure was a fluke. I forgot that changing resources always makes the first bot run fail. TBR=mpcomplete@chromium.org BUG=24379,24671 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29098 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/toolbar_view.cc')
-rw-r--r--chrome/browser/views/toolbar_view.cc45
1 files changed, 5 insertions, 40 deletions
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc
index ed8912a..072e6c8 100644
--- a/chrome/browser/views/toolbar_view.cc
+++ b/chrome/browser/views/toolbar_view.cc
@@ -1081,8 +1081,8 @@ void ToolbarView::CreateDevToolsMenuContents() {
#endif
void ToolbarView::CreateAppMenu() {
- // We always rebuild the app menu so that we can get the current state of the
- // extension system.
+ if (app_menu_contents_.get())
+ return;
app_menu_contents_.reset(new views::SimpleMenuModel(this));
app_menu_contents_->AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB);
@@ -1112,47 +1112,12 @@ void ToolbarView::CreateAppMenu() {
app_menu_contents_->AddItemWithStringId(IDC_SHOW_DOWNLOADS,
IDS_SHOW_DOWNLOADS);
- // Create the extensions item or submenu.
- // If there are any browser actions, we create an "Extensions" submenu, of
- // which "Manage extensions" is the first entry. If there are no browser
- // actions, we just create an "Extensions" menu item which does the same thing
- // as "Manage extensions".
+ // Create the manage extensions menu item.
ExtensionsService* extensions_service =
browser_->profile()->GetExtensionsService();
if (extensions_service && extensions_service->extensions_enabled()) {
- // Get a count of all non-popup browser actions to decide how to layout
- // the Extensions menu.
- std::vector<ExtensionAction*> browser_actions =
- browser_->profile()->GetExtensionsService()->GetBrowserActions(false);
- if (browser_actions.size() == 0) {
- app_menu_contents_->AddItemWithStringId(IDC_MANAGE_EXTENSIONS,
- IDS_SHOW_EXTENSIONS);
- } else {
- extension_menu_contents_.reset(new views::SimpleMenuModel(this));
- app_menu_contents_->AddSubMenuWithStringId(
- IDS_SHOW_EXTENSIONS, extension_menu_contents_.get());
-
- extension_menu_contents_->AddItemWithStringId(IDC_MANAGE_EXTENSIONS,
- IDS_MANAGE_EXTENSIONS);
-
- // TODO(erikkay) Even though we just got the list of all browser actions,
- // we have to enumerate the list of extensions in order to get the action
- // state. It seems like we should find a way to combine these.
- const ExtensionList* extensions = extensions_service->extensions();
- for (size_t i = 0; i < extensions->size(); ++i) {
- Extension* extension = extensions->at(i);
- if (!extension->browser_action()) {
- continue;
- } else if (extension->browser_action()->command_id() >
- IDC_BROWSER_ACTION_LAST) {
- NOTREACHED() << "Too many browser actions.";
- } else if (!extension->browser_action()->is_popup()) {
- extension_menu_contents_->AddItem(
- extension->browser_action()->command_id(),
- UTF8ToUTF16(extension->browser_action_state()->title()));
- }
- }
- }
+ app_menu_contents_->AddItemWithStringId(IDC_MANAGE_EXTENSIONS,
+ IDS_SHOW_EXTENSIONS);
}
app_menu_contents_->AddSeparator();