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 #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_constants.h" | 17 #include "ui/events/event_constants.h" |
| 18 #include "ui/events/platform/platform_event_dispatcher.h" |
18 #include "ui/views/controls/menu/menu_delegate.h" | 19 #include "ui/views/controls/menu/menu_delegate.h" |
19 #include "ui/views/controls/menu/menu_item_view.h" | 20 #include "ui/views/controls/menu/menu_item_view.h" |
20 #include "ui/views/widget/widget_observer.h" | 21 #include "ui/views/widget/widget_observer.h" |
21 | 22 |
22 namespace base { | 23 namespace base { |
23 class MessagePumpDispatcher; | 24 class MessagePumpDispatcher; |
24 } | 25 } |
25 namespace gfx { | 26 namespace gfx { |
26 class Screen; | 27 class Screen; |
27 } | 28 } |
28 namespace ui { | 29 namespace ui { |
29 class NativeTheme; | 30 class NativeTheme; |
30 class OSExchangeData; | 31 class OSExchangeData; |
| 32 class ScopedEventDispatcher; |
31 } | 33 } |
32 namespace views { | 34 namespace views { |
33 | 35 |
34 class MenuButton; | 36 class MenuButton; |
35 class MenuHostRootView; | 37 class MenuHostRootView; |
36 class MouseEvent; | 38 class MouseEvent; |
37 class SubmenuView; | 39 class SubmenuView; |
38 class View; | 40 class View; |
39 | 41 |
40 namespace internal { | 42 namespace internal { |
41 class MenuControllerDelegate; | 43 class MenuControllerDelegate; |
| 44 class MenuEventDispatcher; |
42 class MenuMessagePumpDispatcher; | 45 class MenuMessagePumpDispatcher; |
43 class MenuRunnerImpl; | 46 class MenuRunnerImpl; |
44 } | 47 } |
45 | 48 |
46 // MenuController ------------------------------------------------------------- | 49 // MenuController ------------------------------------------------------------- |
47 | 50 |
48 // MenuController is used internally by the various menu classes to manage | 51 // MenuController is used internally by the various menu classes to manage |
49 // showing, selecting and drag/drop for menus. All relevant events are | 52 // showing, selecting and drag/drop for menus. All relevant events are |
50 // forwarded to the MenuController from SubmenuView and MenuHost. | 53 // forwarded to the MenuController from SubmenuView and MenuHost. |
51 class VIEWS_EXPORT MenuController : public WidgetObserver { | 54 class VIEWS_EXPORT MenuController : public WidgetObserver { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 // Update the submenu's selection based on the current mouse location | 138 // Update the submenu's selection based on the current mouse location |
136 void UpdateSubmenuSelection(SubmenuView* source); | 139 void UpdateSubmenuSelection(SubmenuView* source); |
137 | 140 |
138 // WidgetObserver overrides: | 141 // WidgetObserver overrides: |
139 virtual void OnWidgetDestroying(Widget* widget) OVERRIDE; | 142 virtual void OnWidgetDestroying(Widget* widget) OVERRIDE; |
140 | 143 |
141 // Only used for testing. | 144 // Only used for testing. |
142 static void TurnOffMenuSelectionHoldForTest(); | 145 static void TurnOffMenuSelectionHoldForTest(); |
143 | 146 |
144 private: | 147 private: |
| 148 friend class internal::MenuEventDispatcher; |
145 friend class internal::MenuMessagePumpDispatcher; | 149 friend class internal::MenuMessagePumpDispatcher; |
146 friend class internal::MenuRunnerImpl; | 150 friend class internal::MenuRunnerImpl; |
147 friend class MenuHostRootView; | 151 friend class MenuHostRootView; |
148 friend class MenuItemView; | 152 friend class MenuItemView; |
149 friend class SubmenuView; | 153 friend class SubmenuView; |
150 | 154 |
151 class MenuScrollTask; | 155 class MenuScrollTask; |
152 | 156 |
153 struct SelectByCharDetails; | 157 struct SelectByCharDetails; |
154 | 158 |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 // screen coordinates). Otherwise this will be (0, 0). | 585 // screen coordinates). Otherwise this will be (0, 0). |
582 gfx::Point menu_start_mouse_press_loc_; | 586 gfx::Point menu_start_mouse_press_loc_; |
583 | 587 |
584 // Controls behavior differences between a combobox and other types of menu | 588 // Controls behavior differences between a combobox and other types of menu |
585 // (like a context menu). | 589 // (like a context menu). |
586 bool is_combobox_; | 590 bool is_combobox_; |
587 | 591 |
588 // Set to true if the menu item was selected by touch. | 592 // Set to true if the menu item was selected by touch. |
589 bool item_selected_by_touch_; | 593 bool item_selected_by_touch_; |
590 | 594 |
| 595 scoped_ptr<ui::ScopedEventDispatcher> nested_dispatcher_; |
| 596 |
591 DISALLOW_COPY_AND_ASSIGN(MenuController); | 597 DISALLOW_COPY_AND_ASSIGN(MenuController); |
592 }; | 598 }; |
593 | 599 |
594 } // namespace views | 600 } // namespace views |
595 | 601 |
596 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ | 602 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ |
OLD | NEW |