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

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

Issue 191723003: Nukes USE_AURA ifdefs from views (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 6 years, 9 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } 44 }
45 } 45 }
46 46
47 void MenuHostRootView::OnMouseMoved(const ui::MouseEvent& event) { 47 void MenuHostRootView::OnMouseMoved(const ui::MouseEvent& event) {
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 #if defined(USE_AURA)
55 // Aura uses MenuController to forward events like other mouse events.
56 return GetMenuController() && 54 return GetMenuController() &&
57 GetMenuController()->OnMouseWheel(submenu_, event); 55 GetMenuController()->OnMouseWheel(submenu_, event);
58 #else
59 // Windows uses focus_util_win::RerouteMouseWheel to forward events to
60 // the right menu.
61 // RootView::OnMouseWheel forwards to the focused view. We don't have a
62 // focused view, so we need to override this then forward to the menu.
63 return submenu_->OnMouseWheel(event);
64 #endif
65 } 56 }
66 57
67 void MenuHostRootView::DispatchGestureEvent(ui::GestureEvent* event) { 58 void MenuHostRootView::DispatchGestureEvent(ui::GestureEvent* event) {
68 RootView::DispatchGestureEvent(event); 59 RootView::DispatchGestureEvent(event);
69 if (event->handled()) 60 if (event->handled())
70 return; 61 return;
71 // ChromeOS uses MenuController to forward events like other 62 // ChromeOS uses MenuController to forward events like other
72 // mouse events. 63 // mouse events.
73 if (!GetMenuController()) 64 if (!GetMenuController())
74 return; 65 return;
75 GetMenuController()->OnGestureEvent(submenu_, event); 66 GetMenuController()->OnGestureEvent(submenu_, event);
76 } 67 }
77 68
78 MenuController* MenuHostRootView::GetMenuController() { 69 MenuController* MenuHostRootView::GetMenuController() {
79 return submenu_ ? submenu_->GetMenuItem()->GetMenuController() : NULL; 70 return submenu_ ? submenu_->GetMenuItem()->GetMenuController() : NULL;
80 } 71 }
81 72
82 bool MenuHostRootView::DoesEventTargetEmptyMenuItem( 73 bool MenuHostRootView::DoesEventTargetEmptyMenuItem(
83 const ui::MouseEvent& event) { 74 const ui::MouseEvent& event) {
84 View* view = GetEventHandlerForPoint(event.location()); 75 View* view = GetEventHandlerForPoint(event.location());
85 return view && view->id() == MenuItemView::kEmptyMenuItemViewID; 76 return view && view->id() == MenuItemView::kEmptyMenuItemViewID;
86 } 77 }
87 78
88 } // namespace views 79 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698