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

Side by Side Diff: ui/views/controls/menu/menu_controller.h

Issue 547303003: Keep reference view pressed while extension actions have a popup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: MenuButton::PressedLock Created 6 years, 3 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 unified diff | Download patch
OLDNEW
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 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_
6 #define UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ 6 #define UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #include <list> 10 #include <list>
11 #include <set> 11 #include <set>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/timer/timer.h" 16 #include "base/timer/timer.h"
17 #include "ui/events/event.h" 17 #include "ui/events/event.h"
18 #include "ui/events/event_constants.h" 18 #include "ui/events/event_constants.h"
19 #include "ui/events/platform/platform_event_dispatcher.h" 19 #include "ui/events/platform/platform_event_dispatcher.h"
20 #include "ui/views/controls/button/menu_button.h"
20 #include "ui/views/controls/menu/menu_config.h" 21 #include "ui/views/controls/menu/menu_config.h"
21 #include "ui/views/controls/menu/menu_delegate.h" 22 #include "ui/views/controls/menu/menu_delegate.h"
22 #include "ui/views/widget/widget_observer.h" 23 #include "ui/views/widget/widget_observer.h"
23 24
24 namespace base { 25 namespace base {
25 class MessagePumpDispatcher; 26 class MessagePumpDispatcher;
26 } 27 }
27 namespace gfx { 28 namespace gfx {
28 class Screen; 29 class Screen;
29 } 30 }
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 ACCELERATOR_NOT_PROCESSED, 206 ACCELERATOR_NOT_PROCESSED,
206 207
207 // Accelerator is sent to the hot tracked views. 208 // Accelerator is sent to the hot tracked views.
208 ACCELERATOR_PROCESSED, 209 ACCELERATOR_PROCESSED,
209 210
210 // Same as above and the accelerator causes the exit of the menu. 211 // Same as above and the accelerator causes the exit of the menu.
211 ACCELERATOR_PROCESSED_EXIT 212 ACCELERATOR_PROCESSED_EXIT
212 }; 213 };
213 214
214 // Tracks selection information. 215 // Tracks selection information.
215 struct State { 216 struct State {
sky 2014/09/19 21:21:59 Can you add the lock to this class? It may not be
Devlin 2014/09/19 22:37:49 Since we copy States around every now and then, ad
216 State(); 217 State();
217 ~State(); 218 ~State();
218 219
219 // The selected menu item. 220 // The selected menu item.
220 MenuItemView* item; 221 MenuItemView* item;
221 222
222 // If item has a submenu this indicates if the submenu is showing. 223 // If item has a submenu this indicates if the submenu is showing.
223 bool submenu_open; 224 bool submenu_open;
224 225
225 // Bounds passed to the run menu. Used for positioning the first menu. 226 // Bounds passed to the run menu. Used for positioning the first menu.
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 gfx::Point drop_pt_; 590 gfx::Point drop_pt_;
590 int last_drop_operation_; 591 int last_drop_operation_;
591 592
592 // If true, we're in the middle of invoking ShowAt on a submenu. 593 // If true, we're in the middle of invoking ShowAt on a submenu.
593 bool showing_submenu_; 594 bool showing_submenu_;
594 595
595 // Task for scrolling the menu. If non-null indicates a scroll is currently 596 // Task for scrolling the menu. If non-null indicates a scroll is currently
596 // underway. 597 // underway.
597 scoped_ptr<MenuScrollTask> scroll_task_; 598 scoped_ptr<MenuScrollTask> scroll_task_;
598 599
599 MenuButton* menu_button_; 600 MenuButton* menu_button_;
sky 2014/09/19 21:21:59 Is this needed anymore?
Devlin 2014/09/19 22:37:49 Actually, no. Nifty.
600 601
602 // Locks to keep the menu button pressed while a menu is visible.
603 scoped_ptr<MenuButton::PressedLock> pressed_lock_;
604 scoped_ptr<MenuButton::PressedLock> nested_pressed_lock_;
605
601 // ViewStorage id used to store the view mouse drag events are forwarded to. 606 // ViewStorage id used to store the view mouse drag events are forwarded to.
602 // See UpdateActiveMouseView() for details. 607 // See UpdateActiveMouseView() for details.
603 const int active_mouse_view_id_; 608 const int active_mouse_view_id_;
604 609
605 internal::MenuControllerDelegate* delegate_; 610 internal::MenuControllerDelegate* delegate_;
606 611
607 // How deep we are in nested message loops. This should be at most 2 (when 612 // How deep we are in nested message loops. This should be at most 2 (when
608 // showing a context menu from a menu). 613 // showing a context menu from a menu).
609 int message_loop_depth_; 614 int message_loop_depth_;
610 615
(...skipping 17 matching lines...) Expand all
628 bool item_selected_by_touch_; 633 bool item_selected_by_touch_;
629 634
630 scoped_ptr<MenuMessageLoop> message_loop_; 635 scoped_ptr<MenuMessageLoop> message_loop_;
631 636
632 DISALLOW_COPY_AND_ASSIGN(MenuController); 637 DISALLOW_COPY_AND_ASSIGN(MenuController);
633 }; 638 };
634 639
635 } // namespace views 640 } // namespace views
636 641
637 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ 642 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698