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

Side by Side Diff: ui/views/controls/menu/menu_host_root_view.cc

Issue 395563002: Make RootView::DispatchGestureEvent() non-virtual (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
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 #include "ui/views/controls/menu/menu_host_root_view.h" 5 #include "ui/views/controls/menu/menu_host_root_view.h"
6 6
7 #include "ui/views/controls/menu/menu_controller.h" 7 #include "ui/views/controls/menu/menu_controller.h"
8 #include "ui/views/controls/menu/menu_item_view.h" 8 #include "ui/views/controls/menu/menu_item_view.h"
9 #include "ui/views/controls/menu/submenu_view.h" 9 #include "ui/views/controls/menu/submenu_view.h"
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 RootView::OnMouseMoved(event); 48 RootView::OnMouseMoved(event);
49 if (GetMenuController()) 49 if (GetMenuController())
50 GetMenuController()->OnMouseMoved(submenu_, event); 50 GetMenuController()->OnMouseMoved(submenu_, event);
51 } 51 }
52 52
53 bool MenuHostRootView::OnMouseWheel(const ui::MouseWheelEvent& event) { 53 bool MenuHostRootView::OnMouseWheel(const ui::MouseWheelEvent& event) {
54 return GetMenuController() && 54 return GetMenuController() &&
55 GetMenuController()->OnMouseWheel(submenu_, event); 55 GetMenuController()->OnMouseWheel(submenu_, event);
56 } 56 }
57 57
58 void MenuHostRootView::DispatchGestureEvent(ui::GestureEvent* event) { 58 ui::EventDispatchDetails MenuHostRootView::OnEventFromSource(ui::Event* event) {
59 RootView::DispatchGestureEvent(event); 59 // TODO(tdanderson): Instead call up to EventProcessor::OnEventFromSource()
60 if (event->handled()) 60 // once RootView::OnEventFromSource() is removed.
sadrul 2014/07/15 18:23:46 ditto
tdanderson 2014/07/15 20:25:40 Done.
61 return; 61 ui::EventDispatchDetails result = RootView::OnEventFromSource(event);
62 // ChromeOS uses MenuController to forward events like other 62
63 // mouse events. 63 if (event->IsGestureEvent()) {
64 if (!GetMenuController()) 64 ui::GestureEvent* gesture_event = static_cast<ui::GestureEvent*>(event);
65 return; 65 if (gesture_event->handled())
66 GetMenuController()->OnGestureEvent(submenu_, event); 66 return result;
67 // ChromeOS uses MenuController to forward events like other
68 // mouse events.
69 if (!GetMenuController())
70 return result;
71 GetMenuController()->OnGestureEvent(submenu_, gesture_event);
72 }
73
74 return result;
67 } 75 }
68 76
69 MenuController* MenuHostRootView::GetMenuController() { 77 MenuController* MenuHostRootView::GetMenuController() {
70 return submenu_ ? submenu_->GetMenuItem()->GetMenuController() : NULL; 78 return submenu_ ? submenu_->GetMenuItem()->GetMenuController() : NULL;
71 } 79 }
72 80
73 bool MenuHostRootView::DoesEventTargetEmptyMenuItem( 81 bool MenuHostRootView::DoesEventTargetEmptyMenuItem(
74 const ui::MouseEvent& event) { 82 const ui::MouseEvent& event) {
75 View* view = GetEventHandlerForPoint(event.location()); 83 View* view = GetEventHandlerForPoint(event.location());
76 return view && view->id() == MenuItemView::kEmptyMenuItemViewID; 84 return view && view->id() == MenuItemView::kEmptyMenuItemViewID;
77 } 85 }
78 86
79 } // namespace views 87 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698