| OLD | NEW |
| 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/app_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/app_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 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 base::UserMetricsAction("Signin_Impression_FromMenu")); | 873 base::UserMetricsAction("Signin_Impression_FromMenu")); |
| 874 } | 874 } |
| 875 } | 875 } |
| 876 } | 876 } |
| 877 return menu_items_added; | 877 return menu_items_added; |
| 878 } | 878 } |
| 879 | 879 |
| 880 void AppMenuModel::CreateActionToolbarOverflowMenu() { | 880 void AppMenuModel::CreateActionToolbarOverflowMenu() { |
| 881 // We only add the extensions overflow container if there are any icons that | 881 // We only add the extensions overflow container if there are any icons that |
| 882 // aren't shown in the main container. | 882 // aren't shown in the main container. |
| 883 // browser_->window() can return null during startup. | 883 // browser_->window() can return null during startup, and |
| 884 if (browser_->window() && | 884 // GetToolbarActionsBar() can be null in testing. |
| 885 if (browser_->window() && browser_->window()->GetToolbarActionsBar() && |
| 885 browser_->window()->GetToolbarActionsBar()->NeedsOverflow()) { | 886 browser_->window()->GetToolbarActionsBar()->NeedsOverflow()) { |
| 886 #if defined(OS_MACOSX) | 887 #if defined(OS_MACOSX) |
| 887 // There's a bug in AppKit menus, where if a menu item with a custom view | 888 // There's a bug in AppKit menus, where if a menu item with a custom view |
| 888 // (like the extensions overflow menu) is the first menu item, it is not | 889 // (like the extensions overflow menu) is the first menu item, it is not |
| 889 // highlightable or keyboard-selectable. | 890 // highlightable or keyboard-selectable. |
| 890 // Adding any menu item before it (even one which is never visible) prevents | 891 // Adding any menu item before it (even one which is never visible) prevents |
| 891 // it, so add a bogus item here that will always be hidden. | 892 // it, so add a bogus item here that will always be hidden. |
| 892 AddItem(kEmptyMenuItemCommand, base::string16()); | 893 AddItem(kEmptyMenuItemCommand, base::string16()); |
| 893 #endif | 894 #endif |
| 894 AddItem(IDC_EXTENSIONS_OVERFLOW_MENU, base::string16()); | 895 AddItem(IDC_EXTENSIONS_OVERFLOW_MENU, base::string16()); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 ->GetZoomPercent(); | 941 ->GetZoomPercent(); |
| 941 } | 942 } |
| 942 zoom_label_ = l10n_util::GetStringFUTF16( | 943 zoom_label_ = l10n_util::GetStringFUTF16( |
| 943 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 944 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
| 944 } | 945 } |
| 945 | 946 |
| 946 void AppMenuModel::OnZoomLevelChanged( | 947 void AppMenuModel::OnZoomLevelChanged( |
| 947 const content::HostZoomMap::ZoomLevelChange& change) { | 948 const content::HostZoomMap::ZoomLevelChange& change) { |
| 948 UpdateZoomControls(); | 949 UpdateZoomControls(); |
| 949 } | 950 } |
| OLD | NEW |