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

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

Issue 2155243007: Turn Bookmark Menus Async (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge the pretarget handlers Created 4 years, 4 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
« no previous file with comments | « ui/views/controls/menu/menu_controller_unittest.cc ('k') | ui/views/controls/menu/menu_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_HOST_H_ 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_HOST_H_
6 #define UI_VIEWS_CONTROLS_MENU_MENU_HOST_H_ 6 #define UI_VIEWS_CONTROLS_MENU_MENU_HOST_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "ui/gfx/geometry/rect.h" 12 #include "ui/gfx/geometry/rect.h"
13 #include "ui/views/widget/widget.h" 13 #include "ui/views/widget/widget.h"
14 14
15 namespace views { 15 namespace views {
16 16
17 class NativeWidget; 17 class NativeWidget;
18 class SubmenuView; 18 class SubmenuView;
19 class View; 19 class View;
20 class Widget; 20 class Widget;
21 21
22 namespace internal { 22 namespace internal {
23 23
24 // This class is internal to views. 24 // This class is internal to views.
25 class PreMenuEventDispatchHandler; 25 class PreMenuEventDispatchHandler;
26 26
27 } // internal 27 } // internal
28 28
29 namespace test {
30 class MenuControllerTest;
31 } // test
32
29 // SubmenuView uses a MenuHost to house the SubmenuView. 33 // SubmenuView uses a MenuHost to house the SubmenuView.
30 // 34 //
31 // SubmenuView owns the MenuHost. When SubmenuView is done with the MenuHost 35 // SubmenuView owns the MenuHost. When SubmenuView is done with the MenuHost
32 // |DestroyMenuHost| is invoked. The one exception to this is if the native 36 // |DestroyMenuHost| is invoked. The one exception to this is if the native
33 // OS destroys the widget out from under us, in which case |MenuHostDestroyed| 37 // OS destroys the widget out from under us, in which case |MenuHostDestroyed|
34 // is invoked back on the SubmenuView and the SubmenuView then drops references 38 // is invoked back on the SubmenuView and the SubmenuView then drops references
35 // to the MenuHost. 39 // to the MenuHost.
36 class MenuHost : public Widget { 40 class MenuHost : public Widget {
37 public: 41 public:
38 explicit MenuHost(SubmenuView* submenu); 42 explicit MenuHost(SubmenuView* submenu);
(...skipping 19 matching lines...) Expand all
58 // Destroys and deletes the menu host. 62 // Destroys and deletes the menu host.
59 void DestroyMenuHost(); 63 void DestroyMenuHost();
60 64
61 // Sets the bounds of the menu host. 65 // Sets the bounds of the menu host.
62 void SetMenuHostBounds(const gfx::Rect& bounds); 66 void SetMenuHostBounds(const gfx::Rect& bounds);
63 67
64 // Releases a mouse grab installed by |ShowMenuHost|. 68 // Releases a mouse grab installed by |ShowMenuHost|.
65 void ReleaseMenuHostCapture(); 69 void ReleaseMenuHostCapture();
66 70
67 private: 71 private:
72 friend class test::MenuControllerTest;
73
68 // Overridden from Widget: 74 // Overridden from Widget:
69 internal::RootView* CreateRootView() override; 75 internal::RootView* CreateRootView() override;
70 void OnMouseCaptureLost() override; 76 void OnMouseCaptureLost() override;
71 void OnNativeWidgetDestroyed() override; 77 void OnNativeWidgetDestroyed() override;
72 void OnOwnerClosing() override; 78 void OnOwnerClosing() override;
73 void OnDragWillStart() override; 79 void OnDragWillStart() override;
74 void OnDragComplete() override; 80 void OnDragComplete() override;
75 81
76 // The view we contain. 82 // The view we contain.
77 SubmenuView* submenu_; 83 SubmenuView* submenu_;
78 84
79 // If true, DestroyMenuHost has been invoked. 85 // If true, DestroyMenuHost has been invoked.
80 bool destroying_; 86 bool destroying_;
81 87
82 // If true and capture is lost we don't notify the delegate. 88 // If true and capture is lost we don't notify the delegate.
83 bool ignore_capture_lost_; 89 bool ignore_capture_lost_;
84 90
85 #if !defined(OS_MACOSX) 91 #if !defined(OS_MACOSX)
86 // Handles raw touch events at the moment. 92 // Handles raw touch events at the moment.
87 std::unique_ptr<internal::PreMenuEventDispatchHandler> pre_dispatch_handler_; 93 std::unique_ptr<internal::PreMenuEventDispatchHandler> pre_dispatch_handler_;
88 #endif 94 #endif
89 95
90 DISALLOW_COPY_AND_ASSIGN(MenuHost); 96 DISALLOW_COPY_AND_ASSIGN(MenuHost);
91 }; 97 };
92 98
93 } // namespace views 99 } // namespace views
94 100
95 #endif // UI_VIEWS_CONTROLS_MENU_MENU_HOST_H_ 101 #endif // UI_VIEWS_CONTROLS_MENU_MENU_HOST_H_
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_controller_unittest.cc ('k') | ui/views/controls/menu/menu_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698