Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4123)

Unified Diff: chrome/browser/views/toolbar_view.cc

Issue 276010: Remove the implicit wrench menu items for browser actions. (Closed)
Patch Set: Rebase Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/views/toolbar_view.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/toolbar_view.cc
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc
index ed8912a99da73aefdb4f7d6904509f3212f27502..072e6c82d70d9ab5b998cd551798e2b1f27b5d79 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();
« no previous file with comments | « chrome/browser/views/toolbar_view.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698