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

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

Issue 2876203003: Make shelf item can be dragged when context menu is opened.
Patch Set: Created 3 years, 7 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_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"
(...skipping 28 matching lines...) Expand all
39 class MenuHost : public Widget { 39 class MenuHost : public Widget {
40 public: 40 public:
41 explicit MenuHost(SubmenuView* submenu); 41 explicit MenuHost(SubmenuView* submenu);
42 ~MenuHost() override; 42 ~MenuHost() override;
43 43
44 // Initializes and shows the MenuHost. 44 // Initializes and shows the MenuHost.
45 // WARNING: |parent| may be NULL. 45 // WARNING: |parent| may be NULL.
46 void InitMenuHost(Widget* parent, 46 void InitMenuHost(Widget* parent,
47 const gfx::Rect& bounds, 47 const gfx::Rect& bounds,
48 View* contents_view, 48 View* contents_view,
49 bool do_capture); 49 bool do_capture,
50 bool cancel_active_touches);
50 51
51 // Returns true if the menu host is visible. 52 // Returns true if the menu host is visible.
52 bool IsMenuHostVisible(); 53 bool IsMenuHostVisible();
53 54
54 // Shows the menu host. If |do_capture| is true the menu host should do a 55 // Shows the menu host. If |do_capture| is true the menu host should do a
55 // mouse grab. 56 // mouse grab.
56 void ShowMenuHost(bool do_capture); 57 void ShowMenuHost(bool do_capture, bool cancel_active_touches);
57 58
58 // Hides the menu host. 59 // Hides the menu host.
59 void HideMenuHost(); 60 void HideMenuHost();
60 61
61 // Destroys and deletes the menu host. 62 // Destroys and deletes the menu host.
62 void DestroyMenuHost(); 63 void DestroyMenuHost();
63 64
64 // Sets the bounds of the menu host. 65 // Sets the bounds of the menu host.
65 void SetMenuHostBounds(const gfx::Rect& bounds); 66 void SetMenuHostBounds(const gfx::Rect& bounds);
66 67
67 // Releases a mouse grab installed by |ShowMenuHost|. 68 // Releases a mouse grab installed by |ShowMenuHost|.
68 void ReleaseMenuHostCapture(); 69 void ReleaseMenuHostCapture();
69 70
71 void TransferEvents(Widget* source, Widget* target);
72
70 private: 73 private:
71 friend class test::MenuControllerTest; 74 friend class test::MenuControllerTest;
72 75
73 // Overridden from Widget: 76 // Overridden from Widget:
74 internal::RootView* CreateRootView() override; 77 internal::RootView* CreateRootView() override;
75 void OnMouseCaptureLost() override; 78 void OnMouseCaptureLost() override;
76 void OnNativeWidgetDestroyed() override; 79 void OnNativeWidgetDestroyed() override;
77 void OnOwnerClosing() override; 80 void OnOwnerClosing() override;
78 void OnDragWillStart() override; 81 void OnDragWillStart() override;
79 void OnDragComplete() override; 82 void OnDragComplete() override;
80 83
81 // The view we contain. 84 // The view we contain.
82 SubmenuView* submenu_; 85 SubmenuView* submenu_;
83 86
87 Widget* owner_ = NULL;
84 // If true, DestroyMenuHost has been invoked. 88 // If true, DestroyMenuHost has been invoked.
85 bool destroying_; 89 bool destroying_;
86 90
87 // If true and capture is lost we don't notify the delegate. 91 // If true and capture is lost we don't notify the delegate.
88 bool ignore_capture_lost_; 92 bool ignore_capture_lost_;
89 93
90 #if !defined(OS_MACOSX) 94 #if !defined(OS_MACOSX)
91 // Handles raw touch events at the moment. 95 // Handles raw touch events at the moment.
92 std::unique_ptr<internal::PreMenuEventDispatchHandler> pre_dispatch_handler_; 96 std::unique_ptr<internal::PreMenuEventDispatchHandler> pre_dispatch_handler_;
93 #endif 97 #endif
94 98
95 DISALLOW_COPY_AND_ASSIGN(MenuHost); 99 DISALLOW_COPY_AND_ASSIGN(MenuHost);
96 }; 100 };
97 101
98 } // namespace views 102 } // namespace views
99 103
100 #endif // UI_VIEWS_CONTROLS_MENU_MENU_HOST_H_ 104 #endif // UI_VIEWS_CONTROLS_MENU_MENU_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698