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

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

Issue 1565013002: Don't send touch events to windows like menus when the touch occurs outside the menu bounds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build redness Created 4 years, 11 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 <stddef.h> 10 #include <stddef.h>
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // 144 //
145 // NOTE: the coordinates of the events are in that of the 145 // NOTE: the coordinates of the events are in that of the
146 // MenuScrollViewContainer. 146 // MenuScrollViewContainer.
147 bool OnMousePressed(SubmenuView* source, const ui::MouseEvent& event); 147 bool OnMousePressed(SubmenuView* source, const ui::MouseEvent& event);
148 bool OnMouseDragged(SubmenuView* source, const ui::MouseEvent& event); 148 bool OnMouseDragged(SubmenuView* source, const ui::MouseEvent& event);
149 void OnMouseReleased(SubmenuView* source, const ui::MouseEvent& event); 149 void OnMouseReleased(SubmenuView* source, const ui::MouseEvent& event);
150 void OnMouseMoved(SubmenuView* source, const ui::MouseEvent& event); 150 void OnMouseMoved(SubmenuView* source, const ui::MouseEvent& event);
151 void OnMouseEntered(SubmenuView* source, const ui::MouseEvent& event); 151 void OnMouseEntered(SubmenuView* source, const ui::MouseEvent& event);
152 bool OnMouseWheel(SubmenuView* source, const ui::MouseWheelEvent& event); 152 bool OnMouseWheel(SubmenuView* source, const ui::MouseWheelEvent& event);
153 void OnGestureEvent(SubmenuView* source, ui::GestureEvent* event); 153 void OnGestureEvent(SubmenuView* source, ui::GestureEvent* event);
154 void OnTouchEvent(SubmenuView* source, ui::TouchEvent* event);
154 View* GetTooltipHandlerForPoint(SubmenuView* source, const gfx::Point& point); 155 View* GetTooltipHandlerForPoint(SubmenuView* source, const gfx::Point& point);
155 void ViewHierarchyChanged(SubmenuView* source, 156 void ViewHierarchyChanged(SubmenuView* source,
156 const View::ViewHierarchyChangedDetails& details); 157 const View::ViewHierarchyChangedDetails& details);
157 158
158 bool GetDropFormats(SubmenuView* source, 159 bool GetDropFormats(SubmenuView* source,
159 int* formats, 160 int* formats,
160 std::set<ui::Clipboard::FormatType>* format_types); 161 std::set<ui::Clipboard::FormatType>* format_types);
161 bool AreDropTypesRequired(SubmenuView* source); 162 bool AreDropTypesRequired(SubmenuView* source);
162 bool CanDrop(SubmenuView* source, const ui::OSExchangeData& data); 163 bool CanDrop(SubmenuView* source, const ui::OSExchangeData& data);
163 void OnDragEntered(SubmenuView* source, const ui::DropTargetEvent& event); 164 void OnDragEntered(SubmenuView* source, const ui::DropTargetEvent& event);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 300
300 // Sets the selection to |menu_item|. A value of NULL unselects 301 // Sets the selection to |menu_item|. A value of NULL unselects
301 // everything. |types| is a bitmask of |SetSelectionTypes|. 302 // everything. |types| is a bitmask of |SetSelectionTypes|.
302 // 303 //
303 // Internally this updates pending_state_ immediatley. state_ is only updated 304 // Internally this updates pending_state_ immediatley. state_ is only updated
304 // immediately if SELECTION_UPDATE_IMMEDIATELY is set. If 305 // immediately if SELECTION_UPDATE_IMMEDIATELY is set. If
305 // SELECTION_UPDATE_IMMEDIATELY is not set CommitPendingSelection is invoked 306 // SELECTION_UPDATE_IMMEDIATELY is not set CommitPendingSelection is invoked
306 // to show/hide submenus and update state_. 307 // to show/hide submenus and update state_.
307 void SetSelection(MenuItemView* menu_item, int types); 308 void SetSelection(MenuItemView* menu_item, int types);
308 309
310 // The |EventType| template argument indicates the type of the event.
311 // For e.g. MouseEvent, TouchEvent, etc.
312 template<class EventType>
309 void SetSelectionOnPointerDown(SubmenuView* source, 313 void SetSelectionOnPointerDown(SubmenuView* source,
310 const ui::LocatedEvent& event); 314 const EventType& event);
311 void StartDrag(SubmenuView* source, const gfx::Point& location); 315 void StartDrag(SubmenuView* source, const gfx::Point& location);
312 316
313 // Key processing. 317 // Key processing.
314 void OnKeyDown(ui::KeyboardCode key_code); 318 void OnKeyDown(ui::KeyboardCode key_code);
315 319
316 // Creates a MenuController. If |blocking| is true a nested message loop is 320 // Creates a MenuController. If |blocking| is true a nested message loop is
317 // started in |Run|. 321 // started in |Run|.
318 MenuController(bool blocking, 322 MenuController(bool blocking,
319 internal::MenuControllerDelegate* delegate); 323 internal::MenuControllerDelegate* delegate);
320 324
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 // Selects by mnemonic, and if that doesn't work tries the first character of 499 // Selects by mnemonic, and if that doesn't work tries the first character of
496 // the title. 500 // the title.
497 void SelectByChar(base::char16 key); 501 void SelectByChar(base::char16 key);
498 502
499 // For Windows and Aura we repost an event for some events that dismiss 503 // For Windows and Aura we repost an event for some events that dismiss
500 // the context menu. The event is then reprocessed to cause its result 504 // the context menu. The event is then reprocessed to cause its result
501 // if the context menu had not been present. 505 // if the context menu had not been present.
502 // On non-aura Windows, a new mouse event is generated and posted to 506 // On non-aura Windows, a new mouse event is generated and posted to
503 // the window (if there is one) at the location of the event. On 507 // the window (if there is one) at the location of the event. On
504 // aura, the event is reposted on the RootWindow. 508 // aura, the event is reposted on the RootWindow.
505 void RepostEvent(SubmenuView* source, const ui::LocatedEvent& event); 509 // The |EventType| template argument indicates the type of the event.
510 // For e.g. MouseEvent, TouchEvent, etc.
511 template<class EventType>
sky 2016/01/12 21:16:42 I'm not seeing why you need the template args.
ananta 2016/01/13 01:21:24 Replaced with LocatedEvent* here and other places.
512 void RepostEvent(SubmenuView* source, const EventType& event);
506 513
507 // Sets the drop target to new_item. 514 // Sets the drop target to new_item.
508 void SetDropMenuItem(MenuItemView* new_item, 515 void SetDropMenuItem(MenuItemView* new_item,
509 MenuDelegate::DropPosition position); 516 MenuDelegate::DropPosition position);
510 517
511 // Starts/stops scrolling as appropriate. part gives the part the mouse is 518 // Starts/stops scrolling as appropriate. part gives the part the mouse is
512 // over. 519 // over.
513 void UpdateScrolling(const MenuPart& part); 520 void UpdateScrolling(const MenuPart& part);
514 521
515 // Stops scrolling. 522 // Stops scrolling.
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 int current_mouse_pressed_state_; 695 int current_mouse_pressed_state_;
689 696
690 scoped_ptr<MenuMessageLoop> message_loop_; 697 scoped_ptr<MenuMessageLoop> message_loop_;
691 698
692 DISALLOW_COPY_AND_ASSIGN(MenuController); 699 DISALLOW_COPY_AND_ASSIGN(MenuController);
693 }; 700 };
694 701
695 } // namespace views 702 } // namespace views
696 703
697 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ 704 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698