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_runner.h" | 5 #include "ui/views/controls/menu/menu_runner.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "ui/views/controls/button/menu_button.h" | 9 #include "ui/views/controls/button/menu_button.h" |
10 #include "ui/views/controls/menu/menu_controller.h" | 10 #include "ui/views/controls/menu/menu_controller.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 if (!controller) { | 167 if (!controller) { |
168 // No menus are showing, show one. | 168 // No menus are showing, show one. |
169 controller = new MenuController(!for_drop_, this); | 169 controller = new MenuController(!for_drop_, this); |
170 owns_controller_ = true; | 170 owns_controller_ = true; |
171 } | 171 } |
172 controller_ = controller; | 172 controller_ = controller; |
173 menu_->set_controller(controller_); | 173 menu_->set_controller(controller_); |
174 | 174 |
175 // Run the loop. | 175 // Run the loop. |
176 MenuItemView* result = controller->Run(parent, button, menu_, bounds, anchor, | 176 MenuItemView* result = controller->Run(parent, button, menu_, bounds, anchor, |
| 177 (types & MenuRunner::CONTEXT_MENU) != 0, |
177 &mouse_event_flags); | 178 &mouse_event_flags); |
178 | 179 |
179 if (for_drop_) { | 180 if (for_drop_) { |
180 // Drop menus return immediately. We finish processing in DropMenuClosed. | 181 // Drop menus return immediately. We finish processing in DropMenuClosed. |
181 return MenuRunner::NORMAL_EXIT; | 182 return MenuRunner::NORMAL_EXIT; |
182 } | 183 } |
183 | 184 |
184 return MenuDone(result, mouse_event_flags); | 185 return MenuDone(result, mouse_event_flags); |
185 } | 186 } |
186 | 187 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 289 |
289 bool MenuRunner::IsRunning() const { | 290 bool MenuRunner::IsRunning() const { |
290 return holder_->running(); | 291 return holder_->running(); |
291 } | 292 } |
292 | 293 |
293 void MenuRunner::Cancel() { | 294 void MenuRunner::Cancel() { |
294 holder_->Cancel(); | 295 holder_->Cancel(); |
295 } | 296 } |
296 | 297 |
297 } // namespace views | 298 } // namespace views |
OLD | NEW |