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 "ui/views/controls/menu/menu_model_adapter.h" | 5 #include "ui/views/controls/menu/menu_model_adapter.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/base/l10n/l10n_util.h" | 8 #include "ui/base/l10n/l10n_util.h" |
9 #include "ui/base/models/menu_model.h" | 9 #include "ui/base/models/menu_model.h" |
10 #include "ui/views/controls/menu/submenu_view.h" | 10 #include "ui/views/controls/menu/submenu_view.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 int index = 0; | 68 int index = 0; |
69 if (ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index)) { | 69 if (ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index)) { |
70 model->ActivatedAt(index, mouse_event_flags); | 70 model->ActivatedAt(index, mouse_event_flags); |
71 return; | 71 return; |
72 } | 72 } |
73 | 73 |
74 NOTREACHED(); | 74 NOTREACHED(); |
75 } | 75 } |
76 | 76 |
77 bool MenuModelAdapter::IsTriggerableEvent(MenuItemView* source, | 77 bool MenuModelAdapter::IsTriggerableEvent(MenuItemView* source, |
78 const Event& e) { | 78 const ui::Event& e) { |
79 return e.type() == ui::ET_GESTURE_TAP || | 79 return e.type() == ui::ET_GESTURE_TAP || |
80 e.type() == ui::ET_GESTURE_TAP_DOWN || | 80 e.type() == ui::ET_GESTURE_TAP_DOWN || |
81 (e.IsMouseEvent() && (triggerable_event_flags_ & e.flags()) != 0); | 81 (e.IsMouseEvent() && (triggerable_event_flags_ & e.flags()) != 0); |
82 } | 82 } |
83 | 83 |
84 bool MenuModelAdapter::GetAccelerator(int id, | 84 bool MenuModelAdapter::GetAccelerator(int id, |
85 ui::Accelerator* accelerator) { | 85 ui::Accelerator* accelerator) { |
86 ui::MenuModel* model = menu_model_; | 86 ui::MenuModel* model = menu_model_; |
87 int index = 0; | 87 int index = 0; |
88 if (ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index)) | 88 if (ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index)) |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 BuildMenuImpl(item, submodel); | 197 BuildMenuImpl(item, submodel); |
198 | 198 |
199 menu_map_[item] = submodel; | 199 menu_map_[item] = submodel; |
200 } | 200 } |
201 } | 201 } |
202 | 202 |
203 menu->set_has_icons(model->HasIcons()); | 203 menu->set_has_icons(model->HasIcons()); |
204 } | 204 } |
205 | 205 |
206 } // namespace views | 206 } // namespace views |
OLD | NEW |