OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/controls/menu/menu_model_adapter.h" | 5 #include "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 "views/controls/menu/submenu_view.h" | 10 #include "views/controls/menu/submenu_view.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 NOTREACHED(); | 74 NOTREACHED(); |
75 } | 75 } |
76 | 76 |
77 bool MenuModelAdapter::IsTriggerableEvent(MenuItemView* source, | 77 bool MenuModelAdapter::IsTriggerableEvent(MenuItemView* source, |
78 const MouseEvent& e) { | 78 const MouseEvent& e) { |
79 return (triggerable_event_flags_ & e.flags()) != 0; | 79 return (triggerable_event_flags_ & e.flags()) != 0; |
80 } | 80 } |
81 | 81 |
82 bool MenuModelAdapter::GetAccelerator(int id, | 82 bool MenuModelAdapter::GetAccelerator(int id, |
83 views::Accelerator* accelerator) { | 83 ui::Accelerator* accelerator) { |
84 ui::MenuModel* model = menu_model_; | 84 ui::MenuModel* model = menu_model_; |
85 int index = 0; | 85 int index = 0; |
86 if (ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index)) | 86 if (ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index)) |
87 return model->GetAcceleratorAt(index, accelerator); | 87 return model->GetAcceleratorAt(index, accelerator); |
88 | 88 |
89 NOTREACHED(); | 89 NOTREACHED(); |
90 return false; | 90 return false; |
91 } | 91 } |
92 | 92 |
93 string16 MenuModelAdapter::GetLabel(int id) const { | 93 string16 MenuModelAdapter::GetLabel(int id) const { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 BuildMenuImpl(item, submodel); | 191 BuildMenuImpl(item, submodel); |
192 | 192 |
193 menu_map_[item] = submodel; | 193 menu_map_[item] = submodel; |
194 } | 194 } |
195 } | 195 } |
196 | 196 |
197 menu->set_has_icons(model->HasIcons()); | 197 menu->set_has_icons(model->HasIcons()); |
198 } | 198 } |
199 | 199 |
200 } // namespace views | 200 } // namespace views |
OLD | NEW |