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

Unified Diff: chrome/browser/ui/views/action_box_menu.cc

Issue 10874040: Activated send-to-mobile and bookmark in action box for Windows. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/action_box_menu.cc
diff --git a/chrome/browser/ui/views/action_box_menu.cc b/chrome/browser/ui/views/action_box_menu.cc
index 776235c52abc9edcfcf4f049d46e6ad69bac66a9..36291ace953adc1bcdfd5ea2bc669e380e37038f 100644
--- a/chrome/browser/ui/views/action_box_menu.cc
+++ b/chrome/browser/ui/views/action_box_menu.cc
@@ -21,6 +21,21 @@
#include "ui/base/native_theme/native_theme_win.h"
#endif
+namespace {
+// Converts from the index of a menu item to the id of this item. Indices are
msw 2012/08/23 22:04:40 nit: add a blank line above.
beaudoin 2012/08/24 19:34:38 Done.
+// 0-based but IDs cannot be 0.
+inline int MenuIndexToItemId(int menu_index) {
+ return menu_index + 1;
+}
+
+// Converts from the id of a menu item to its index. Indices are 0-based but
+// IDs cannot be 0.
+inline int MenuItemIdToIndex(int menu_item_id) {
+ return menu_item_id - 1;
+}
+
+} // namespace
+
////////////////////////////////////////////////////////////////////////////////
// ActionBoxMenu
@@ -54,6 +69,7 @@ void ActionBoxMenu::RunMenu(views::MenuButton* menu_button) {
}
void ActionBoxMenu::ExecuteCommand(int id) {
+ model_->ActivatedAt(MenuItemIdToIndex(id));
}
views::Border* ActionBoxMenu::CreateMenuBorder() {
@@ -127,7 +143,7 @@ void ActionBoxMenu::PopulateMenu() {
for (int model_index = 0; model_index < model_->GetItemCount();
++model_index) {
views::MenuItemView* menu_item = root_->AppendMenuItemFromModel(
- model_, model_index, model_index + 1);
+ model_, model_index, MenuIndexToItemId(model_index));
if (model_->GetTypeAt(model_index) == ui::MenuModel::TYPE_COMMAND) {
menu_item->SetMargins(0, 0);
if (model_->IsItemExtension(model_index)) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698