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

Side by Side Diff: chrome/browser/ui/toolbar/wrench_menu_model.cc

Issue 324393002: Extension Toolbar redesign, part 1 (overflow) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Missing gypi change Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" 5 #include "chrome/browser/ui/toolbar/wrench_menu_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 29 matching lines...) Expand all
40 #include "chrome/common/profiling.h" 40 #include "chrome/common/profiling.h"
41 #include "components/signin/core/browser/signin_manager.h" 41 #include "components/signin/core/browser/signin_manager.h"
42 #include "components/signin/core/common/profile_management_switches.h" 42 #include "components/signin/core/common/profile_management_switches.h"
43 #include "content/public/browser/host_zoom_map.h" 43 #include "content/public/browser/host_zoom_map.h"
44 #include "content/public/browser/navigation_entry.h" 44 #include "content/public/browser/navigation_entry.h"
45 #include "content/public/browser/notification_service.h" 45 #include "content/public/browser/notification_service.h"
46 #include "content/public/browser/notification_source.h" 46 #include "content/public/browser/notification_source.h"
47 #include "content/public/browser/notification_types.h" 47 #include "content/public/browser/notification_types.h"
48 #include "content/public/browser/user_metrics.h" 48 #include "content/public/browser/user_metrics.h"
49 #include "content/public/browser/web_contents.h" 49 #include "content/public/browser/web_contents.h"
50 #include "extensions/common/feature_switch.h"
50 #include "grit/chromium_strings.h" 51 #include "grit/chromium_strings.h"
51 #include "grit/generated_resources.h" 52 #include "grit/generated_resources.h"
52 #include "grit/theme_resources.h" 53 #include "grit/theme_resources.h"
53 #include "ui/base/l10n/l10n_util.h" 54 #include "ui/base/l10n/l10n_util.h"
54 #include "ui/base/layout.h" 55 #include "ui/base/layout.h"
55 #include "ui/base/models/button_menu_item_model.h" 56 #include "ui/base/models/button_menu_item_model.h"
56 #include "ui/base/resource/resource_bundle.h" 57 #include "ui/base/resource/resource_bundle.h"
57 #include "ui/gfx/image/image.h" 58 #include "ui/gfx/image/image.h"
58 #include "ui/gfx/image/image_skia.h" 59 #include "ui/gfx/image/image_skia.h"
59 60
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 #if defined(OS_WIN) 523 #if defined(OS_WIN)
523 AddItem(IDC_VIEW_INCOMPATIBILITIES, 524 AddItem(IDC_VIEW_INCOMPATIBILITIES,
524 l10n_util::GetStringUTF16(IDS_VIEW_INCOMPATIBILITIES)); 525 l10n_util::GetStringUTF16(IDS_VIEW_INCOMPATIBILITIES));
525 EnumerateModulesModel* model = 526 EnumerateModulesModel* model =
526 EnumerateModulesModel::GetInstance(); 527 EnumerateModulesModel::GetInstance();
527 if (model->modules_to_notify_about() > 0 || 528 if (model->modules_to_notify_about() > 0 ||
528 model->confirmed_bad_modules_detected() > 0) 529 model->confirmed_bad_modules_detected() > 0)
529 AddSeparator(ui::NORMAL_SEPARATOR); 530 AddSeparator(ui::NORMAL_SEPARATOR);
530 #endif 531 #endif
531 532
533 if (extensions::FeatureSwitch::extension_action_redesign()->IsEnabled())
534 CreateExtensionToolbarOverflowMenu();
535
532 AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB); 536 AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB);
533 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); 537 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW);
534 538
535 if (ShouldShowNewIncognitoWindowMenuItem()) 539 if (ShouldShowNewIncognitoWindowMenuItem())
536 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); 540 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW);
537 541
538 #if defined(OS_WIN) && !defined(NDEBUG) && defined(USE_ASH) 542 #if defined(OS_WIN) && !defined(NDEBUG) && defined(USE_ASH)
539 if (base::win::GetVersion() < base::win::VERSION_WIN8 && 543 if (base::win::GetVersion() < base::win::VERSION_WIN8 &&
540 chrome::HOST_DESKTOP_TYPE_NATIVE != chrome::HOST_DESKTOP_TYPE_ASH) { 544 chrome::HOST_DESKTOP_TYPE_NATIVE != chrome::HOST_DESKTOP_TYPE_ASH) {
541 AddItemWithStringId(IDC_TOGGLE_ASH_DESKTOP, 545 AddItemWithStringId(IDC_TOGGLE_ASH_DESKTOP,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 int icon_id = error->MenuItemIconResourceID(); 724 int icon_id = error->MenuItemIconResourceID();
721 if (icon_id) { 725 if (icon_id) {
722 const gfx::Image& image = rb.GetNativeImageNamed(icon_id); 726 const gfx::Image& image = rb.GetNativeImageNamed(icon_id);
723 SetIcon(GetIndexOfCommandId(error->MenuItemCommandID()), 727 SetIcon(GetIndexOfCommandId(error->MenuItemCommandID()),
724 image); 728 image);
725 } 729 }
726 } 730 }
727 } 731 }
728 } 732 }
729 733
734 void WrenchMenuModel::CreateExtensionToolbarOverflowMenu() {
735 #if defined(TOOLKIT_VIEWS)
736 AddItem(IDC_EXTENSIONS_OVERFLOW_MENU, base::string16());
737 // TODO(devlin): Add the separator only if there are > 0 icons to show.
738 AddSeparator(ui::UPPER_SEPARATOR);
739 #endif // defined(TOOLKIT_VIEWS)
740 }
741
730 void WrenchMenuModel::CreateCutCopyPasteMenu(bool new_menu) { 742 void WrenchMenuModel::CreateCutCopyPasteMenu(bool new_menu) {
731 AddSeparator(new_menu ? ui::LOWER_SEPARATOR : ui::NORMAL_SEPARATOR); 743 AddSeparator(new_menu ? ui::LOWER_SEPARATOR : ui::NORMAL_SEPARATOR);
732 744
733 #if defined(OS_POSIX) && !defined(TOOLKIT_VIEWS) 745 #if defined(OS_POSIX) && !defined(TOOLKIT_VIEWS)
734 // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the 746 // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the
735 // layout for this menu item in Toolbar.xib. It does, however, use the 747 // layout for this menu item in Toolbar.xib. It does, however, use the
736 // command_id value from AddButtonItem() to identify this special item. 748 // command_id value from AddButtonItem() to identify this special item.
737 edit_menu_item_model_.reset(new ui::ButtonMenuItemModel(IDS_EDIT, this)); 749 edit_menu_item_model_.reset(new ui::ButtonMenuItemModel(IDS_EDIT, this));
738 edit_menu_item_model_->AddGroupItemWithStringId(IDC_CUT, IDS_CUT); 750 edit_menu_item_model_->AddGroupItemWithStringId(IDC_CUT, IDS_CUT);
739 edit_menu_item_model_->AddGroupItemWithStringId(IDC_COPY, IDS_COPY); 751 edit_menu_item_model_->AddGroupItemWithStringId(IDC_COPY, IDS_COPY);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 &enable_increment, &enable_decrement); 804 &enable_increment, &enable_decrement);
793 } 805 }
794 zoom_label_ = l10n_util::GetStringFUTF16( 806 zoom_label_ = l10n_util::GetStringFUTF16(
795 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); 807 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent));
796 } 808 }
797 809
798 void WrenchMenuModel::OnZoomLevelChanged( 810 void WrenchMenuModel::OnZoomLevelChanged(
799 const content::HostZoomMap::ZoomLevelChange& change) { 811 const content::HostZoomMap::ZoomLevelChange& change) {
800 UpdateZoomControls(); 812 UpdateZoomControls();
801 } 813 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/wrench_menu_model.h ('k') | chrome/browser/ui/views/toolbar/browser_action_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698