OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/views/toolbar/wrench_menu.h" | 5 #include "chrome/browser/ui/views/toolbar/wrench_menu.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 item->SetMargins(top_margin, bottom_margin); | 1130 item->SetMargins(top_margin, bottom_margin); |
1131 } | 1131 } |
1132 | 1132 |
1133 if (model->GetTypeAt(i) == MenuModel::TYPE_SUBMENU) | 1133 if (model->GetTypeAt(i) == MenuModel::TYPE_SUBMENU) |
1134 PopulateMenu(item, model->GetSubmenuModelAt(i)); | 1134 PopulateMenu(item, model->GetSubmenuModelAt(i)); |
1135 | 1135 |
1136 switch (model->GetCommandIdAt(i)) { | 1136 switch (model->GetCommandIdAt(i)) { |
1137 case IDC_EXTENSIONS_OVERFLOW_MENU: { | 1137 case IDC_EXTENSIONS_OVERFLOW_MENU: { |
1138 scoped_ptr<ExtensionToolbarMenuView> extension_toolbar( | 1138 scoped_ptr<ExtensionToolbarMenuView> extension_toolbar( |
1139 new ExtensionToolbarMenuView(browser_, this)); | 1139 new ExtensionToolbarMenuView(browser_, this)); |
1140 if (extension_toolbar->GetPreferredSize().height() > 0) | 1140 if (extension_toolbar->ShouldShow()) |
1141 item->AddChildView(extension_toolbar.release()); | 1141 item->AddChildView(extension_toolbar.release()); |
1142 else | 1142 else |
1143 item->SetVisible(false); | 1143 item->SetVisible(false); |
1144 break; | 1144 break; |
1145 } | 1145 } |
1146 | 1146 |
1147 case IDC_CUT: | 1147 case IDC_CUT: |
1148 DCHECK_EQ(MenuModel::TYPE_COMMAND, model->GetTypeAt(i)); | 1148 DCHECK_EQ(MenuModel::TYPE_COMMAND, model->GetTypeAt(i)); |
1149 DCHECK_LT(i + 2, max); | 1149 DCHECK_LT(i + 2, max); |
1150 DCHECK_EQ(IDC_COPY, model->GetCommandIdAt(i + 1)); | 1150 DCHECK_EQ(IDC_COPY, model->GetCommandIdAt(i + 1)); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 0, | 1261 0, |
1262 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, | 1262 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, |
1263 BOOKMARK_LAUNCH_LOCATION_WRENCH_MENU); | 1263 BOOKMARK_LAUNCH_LOCATION_WRENCH_MENU); |
1264 } | 1264 } |
1265 | 1265 |
1266 int WrenchMenu::ModelIndexFromCommandId(int command_id) const { | 1266 int WrenchMenu::ModelIndexFromCommandId(int command_id) const { |
1267 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); | 1267 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); |
1268 DCHECK(ix != command_id_to_entry_.end()); | 1268 DCHECK(ix != command_id_to_entry_.end()); |
1269 return ix->second.second; | 1269 return ix->second.second; |
1270 } | 1270 } |
OLD | NEW |