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

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

Issue 1330423003: [Extensions Toolbar] Protect against crazy bounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
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 18 matching lines...) Expand all
29 #include "chrome/browser/ui/browser_commands.h" 29 #include "chrome/browser/ui/browser_commands.h"
30 #include "chrome/browser/ui/browser_finder.h" 30 #include "chrome/browser/ui/browser_finder.h"
31 #include "chrome/browser/ui/browser_window.h" 31 #include "chrome/browser/ui/browser_window.h"
32 #include "chrome/browser/ui/global_error/global_error.h" 32 #include "chrome/browser/ui/global_error/global_error.h"
33 #include "chrome/browser/ui/global_error/global_error_service.h" 33 #include "chrome/browser/ui/global_error/global_error_service.h"
34 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 34 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
35 #include "chrome/browser/ui/tabs/tab_strip_model.h" 35 #include "chrome/browser/ui/tabs/tab_strip_model.h"
36 #include "chrome/browser/ui/toolbar/bookmark_sub_menu_model.h" 36 #include "chrome/browser/ui/toolbar/bookmark_sub_menu_model.h"
37 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" 37 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h"
38 #include "chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h" 38 #include "chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h"
39 #include "chrome/browser/ui/toolbar/toolbar_actions_model.h" 39 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
40 #include "chrome/browser/upgrade_detector.h" 40 #include "chrome/browser/upgrade_detector.h"
41 #include "chrome/common/chrome_paths.h" 41 #include "chrome/common/chrome_paths.h"
42 #include "chrome/common/chrome_switches.h" 42 #include "chrome/common/chrome_switches.h"
43 #include "chrome/common/pref_names.h" 43 #include "chrome/common/pref_names.h"
44 #include "chrome/common/profiling.h" 44 #include "chrome/common/profiling.h"
45 #include "chrome/grit/chromium_strings.h" 45 #include "chrome/grit/chromium_strings.h"
46 #include "chrome/grit/generated_resources.h" 46 #include "chrome/grit/generated_resources.h"
47 #include "components/dom_distiller/core/dom_distiller_switches.h" 47 #include "components/dom_distiller/core/dom_distiller_switches.h"
48 #include "components/signin/core/browser/signin_manager.h" 48 #include "components/signin/core/browser/signin_manager.h"
49 #include "components/signin/core/common/profile_management_switches.h" 49 #include "components/signin/core/common/profile_management_switches.h"
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 error->MenuItemIcon()); 959 error->MenuItemIcon());
960 menu_items_added = true; 960 menu_items_added = true;
961 } 961 }
962 } 962 }
963 return menu_items_added; 963 return menu_items_added;
964 } 964 }
965 965
966 void WrenchMenuModel::CreateActionToolbarOverflowMenu() { 966 void WrenchMenuModel::CreateActionToolbarOverflowMenu() {
967 // We only add the extensions overflow container if there are any icons that 967 // We only add the extensions overflow container if there are any icons that
968 // aren't shown in the main container. 968 // aren't shown in the main container.
969 if (!ToolbarActionsModel::Get(browser_->profile())->all_icons_visible()) { 969 // |browser_->window()| can be null during startup.
Peter Kasting 2015/09/15 00:13:38 Nit: No || around a function call
Devlin 2015/09/15 18:22:39 Wasn't sure about this one, because it was a simpl
970 if (browser_->window() &&
971 browser_->window()->GetToolbarActionsBar()->NeedsOverflow()) {
Peter Kasting 2015/09/15 00:13:38 We now have ToolbarActionsBar::NeedsOverflow() and
Devlin 2015/09/15 18:22:39 Documented in toolbar_actions_bar.h
970 #if defined(OS_MACOSX) 972 #if defined(OS_MACOSX)
971 // There's a bug in AppKit menus, where if a menu item with a custom view 973 // There's a bug in AppKit menus, where if a menu item with a custom view
972 // (like the extensions overflow menu) is the first menu item, it is not 974 // (like the extensions overflow menu) is the first menu item, it is not
973 // highlightable or keyboard-selectable. 975 // highlightable or keyboard-selectable.
974 // Adding any menu item before it (even one which is never visible) prevents 976 // Adding any menu item before it (even one which is never visible) prevents
975 // it, so add a bogus item here that will always be hidden. 977 // it, so add a bogus item here that will always be hidden.
976 AddItem(kEmptyMenuItemCommand, base::string16()); 978 AddItem(kEmptyMenuItemCommand, base::string16());
977 #endif 979 #endif
978 AddItem(IDC_EXTENSIONS_OVERFLOW_MENU, base::string16()); 980 AddItem(IDC_EXTENSIONS_OVERFLOW_MENU, base::string16());
979 AddSeparator(ui::UPPER_SEPARATOR); 981 AddSeparator(ui::UPPER_SEPARATOR);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 ->GetZoomPercent(); 1026 ->GetZoomPercent();
1025 } 1027 }
1026 zoom_label_ = l10n_util::GetStringFUTF16( 1028 zoom_label_ = l10n_util::GetStringFUTF16(
1027 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); 1029 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent));
1028 } 1030 }
1029 1031
1030 void WrenchMenuModel::OnZoomLevelChanged( 1032 void WrenchMenuModel::OnZoomLevelChanged(
1031 const content::HostZoomMap::ZoomLevelChange& change) { 1033 const content::HostZoomMap::ZoomLevelChange& change) {
1032 UpdateZoomControls(); 1034 UpdateZoomControls();
1033 } 1035 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698