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 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 #endif | 975 #endif |
976 AddItem(IDC_EXTENSIONS_OVERFLOW_MENU, base::string16()); | 976 AddItem(IDC_EXTENSIONS_OVERFLOW_MENU, base::string16()); |
977 AddSeparator(ui::UPPER_SEPARATOR); | 977 AddSeparator(ui::UPPER_SEPARATOR); |
978 } | 978 } |
979 } | 979 } |
980 | 980 |
981 void AppMenuModel::CreateCutCopyPasteMenu() { | 981 void AppMenuModel::CreateCutCopyPasteMenu() { |
982 AddSeparator(ui::LOWER_SEPARATOR); | 982 AddSeparator(ui::LOWER_SEPARATOR); |
983 | 983 |
984 // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the | 984 // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the |
985 // layout for this menu item in WrenchMenu.xib. It does, however, use the | 985 // layout for this menu item in AppMenu.xib. It does, however, use the |
986 // command_id value from AddButtonItem() to identify this special item. | 986 // command_id value from AddButtonItem() to identify this special item. |
987 edit_menu_item_model_.reset(new ui::ButtonMenuItemModel(IDS_EDIT, this)); | 987 edit_menu_item_model_.reset(new ui::ButtonMenuItemModel(IDS_EDIT, this)); |
988 edit_menu_item_model_->AddGroupItemWithStringId(IDC_CUT, IDS_CUT); | 988 edit_menu_item_model_->AddGroupItemWithStringId(IDC_CUT, IDS_CUT); |
989 edit_menu_item_model_->AddGroupItemWithStringId(IDC_COPY, IDS_COPY); | 989 edit_menu_item_model_->AddGroupItemWithStringId(IDC_COPY, IDS_COPY); |
990 edit_menu_item_model_->AddGroupItemWithStringId(IDC_PASTE, IDS_PASTE); | 990 edit_menu_item_model_->AddGroupItemWithStringId(IDC_PASTE, IDS_PASTE); |
991 AddButtonItem(IDC_EDIT_MENU, edit_menu_item_model_.get()); | 991 AddButtonItem(IDC_EDIT_MENU, edit_menu_item_model_.get()); |
992 | 992 |
993 AddSeparator(ui::UPPER_SEPARATOR); | 993 AddSeparator(ui::UPPER_SEPARATOR); |
994 } | 994 } |
995 | 995 |
996 void AppMenuModel::CreateZoomMenu() { | 996 void AppMenuModel::CreateZoomMenu() { |
997 // This menu needs to be enclosed by separators. | 997 // This menu needs to be enclosed by separators. |
998 AddSeparator(ui::LOWER_SEPARATOR); | 998 AddSeparator(ui::LOWER_SEPARATOR); |
999 | 999 |
1000 // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the | 1000 // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the |
1001 // layout for this menu item in WrenchMenu.xib. It does, however, use the | 1001 // layout for this menu item in AppMenu.xib. It does, however, use the |
1002 // command_id value from AddButtonItem() to identify this special item. | 1002 // command_id value from AddButtonItem() to identify this special item. |
1003 zoom_menu_item_model_.reset( | 1003 zoom_menu_item_model_.reset( |
1004 new ui::ButtonMenuItemModel(IDS_ZOOM_MENU, this)); | 1004 new ui::ButtonMenuItemModel(IDS_ZOOM_MENU, this)); |
1005 zoom_menu_item_model_->AddGroupItemWithStringId(IDC_ZOOM_MINUS, | 1005 zoom_menu_item_model_->AddGroupItemWithStringId(IDC_ZOOM_MINUS, |
1006 IDS_ZOOM_MINUS2); | 1006 IDS_ZOOM_MINUS2); |
1007 zoom_menu_item_model_->AddGroupItemWithStringId(IDC_ZOOM_PLUS, | 1007 zoom_menu_item_model_->AddGroupItemWithStringId(IDC_ZOOM_PLUS, |
1008 IDS_ZOOM_PLUS2); | 1008 IDS_ZOOM_PLUS2); |
1009 zoom_menu_item_model_->AddItemWithImage(IDC_FULLSCREEN, | 1009 zoom_menu_item_model_->AddItemWithImage(IDC_FULLSCREEN, |
1010 IDR_FULLSCREEN_MENU_BUTTON); | 1010 IDR_FULLSCREEN_MENU_BUTTON); |
1011 AddButtonItem(IDC_ZOOM_MENU, zoom_menu_item_model_.get()); | 1011 AddButtonItem(IDC_ZOOM_MENU, zoom_menu_item_model_.get()); |
(...skipping 10 matching lines...) Expand all Loading... |
1022 ->GetZoomPercent(); | 1022 ->GetZoomPercent(); |
1023 } | 1023 } |
1024 zoom_label_ = l10n_util::GetStringFUTF16( | 1024 zoom_label_ = l10n_util::GetStringFUTF16( |
1025 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 1025 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
1026 } | 1026 } |
1027 | 1027 |
1028 void AppMenuModel::OnZoomLevelChanged( | 1028 void AppMenuModel::OnZoomLevelChanged( |
1029 const content::HostZoomMap::ZoomLevelChange& change) { | 1029 const content::HostZoomMap::ZoomLevelChange& change) { |
1030 UpdateZoomControls(); | 1030 UpdateZoomControls(); |
1031 } | 1031 } |
OLD | NEW |