| 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 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 FOR_EACH_OBSERVER(WrenchMenuObserver, observer_list_, WrenchMenuDestroyed()); | 809 FOR_EACH_OBSERVER(WrenchMenuObserver, observer_list_, WrenchMenuDestroyed()); |
| 810 } | 810 } |
| 811 | 811 |
| 812 void WrenchMenu::Init(ui::MenuModel* model) { | 812 void WrenchMenu::Init(ui::MenuModel* model) { |
| 813 DCHECK(!root_); | 813 DCHECK(!root_); |
| 814 root_ = new MenuItemView(this); | 814 root_ = new MenuItemView(this); |
| 815 root_->set_has_icons(true); // We have checks, radios and icons, set this | 815 root_->set_has_icons(true); // We have checks, radios and icons, set this |
| 816 // so we get the taller menu style. | 816 // so we get the taller menu style. |
| 817 PopulateMenu(root_, model); | 817 PopulateMenu(root_, model); |
| 818 | 818 |
| 819 #if defined(DEBUG) | 819 #if !defined(NDEBUG) |
| 820 // Verify that the reserved command ID's for bookmarks menu are not used. | 820 // Verify that the reserved command ID's for bookmarks menu are not used. |
| 821 for (int i = WrenchMenuModel:kMinBookmarkCommandId; | 821 for (int i = WrenchMenuModel::kMinBookmarkCommandId; |
| 822 i <= WrenchMenuModel::kMaxBookmarkCommandId; ++i) | 822 i <= WrenchMenuModel::kMaxBookmarkCommandId; ++i) |
| 823 DCHECK(command_id_to_entry_.find(i) == command_id_to_entry_.end()); | 823 DCHECK(command_id_to_entry_.find(i) == command_id_to_entry_.end()); |
| 824 #endif // defined(DEBUG) | 824 #endif // !defined(NDEBUG) |
| 825 | 825 |
| 826 int32 types = views::MenuRunner::HAS_MNEMONICS; | 826 int32 types = views::MenuRunner::HAS_MNEMONICS; |
| 827 if (for_drop()) { | 827 if (for_drop()) { |
| 828 // We add NESTED_DRAG since currently the only operation to open the wrench | 828 // We add NESTED_DRAG since currently the only operation to open the wrench |
| 829 // menu for is an extension action drag, which is controlled by the child | 829 // menu for is an extension action drag, which is controlled by the child |
| 830 // BrowserActionsContainer view. | 830 // BrowserActionsContainer view. |
| 831 types |= views::MenuRunner::FOR_DROP | views::MenuRunner::NESTED_DRAG; | 831 types |= views::MenuRunner::FOR_DROP | views::MenuRunner::NESTED_DRAG; |
| 832 } | 832 } |
| 833 menu_runner_.reset(new views::MenuRunner(root_, types)); | 833 menu_runner_.reset(new views::MenuRunner(root_, types)); |
| 834 } | 834 } |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1243 0, | 1243 0, |
| 1244 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, | 1244 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, |
| 1245 BOOKMARK_LAUNCH_LOCATION_WRENCH_MENU); | 1245 BOOKMARK_LAUNCH_LOCATION_WRENCH_MENU); |
| 1246 } | 1246 } |
| 1247 | 1247 |
| 1248 int WrenchMenu::ModelIndexFromCommandId(int command_id) const { | 1248 int WrenchMenu::ModelIndexFromCommandId(int command_id) const { |
| 1249 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); | 1249 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); |
| 1250 DCHECK(ix != command_id_to_entry_.end()); | 1250 DCHECK(ix != command_id_to_entry_.end()); |
| 1251 return ix->second.second; | 1251 return ix->second.second; |
| 1252 } | 1252 } |
| OLD | NEW |