Index: ui/views/controls/menu/menu_message_loop_aura.cc |
diff --git a/ui/views/controls/menu/menu_message_loop_aura.cc b/ui/views/controls/menu/menu_message_loop_aura.cc |
index 3cb1068a2cc9e41c604c26eb3003f3a4dfd621c1..765d08eb9ac6567ff3045ea5b9a917ad0d64f418 100644 |
--- a/ui/views/controls/menu/menu_message_loop_aura.cc |
+++ b/ui/views/controls/menu/menu_message_loop_aura.cc |
@@ -100,19 +100,46 @@ MenuMessageLoop* MenuMessageLoop::Create() { |
return new MenuMessageLoopAura; |
} |
+// Force instantiation of the RepostEventToWindow function for the following |
+// EventTypes. |
+// 1. MouseEvent. |
+// 2. GestureEvent. |
+// 3. TouchEvent. |
+// Alternatively we could possibly implement the function in the header file, |
+// which I think is uglier. |
+template |
+void MenuMessageLoop::RepostEventToWindow<ui::MouseEvent>( |
+ const ui::MouseEvent& event, |
+ gfx::NativeWindow window, |
+ const gfx::Point& screen_loc); |
+ |
+template |
+void MenuMessageLoop::RepostEventToWindow<ui::GestureEvent>( |
+ const ui::GestureEvent& event, |
+ gfx::NativeWindow window, |
+ const gfx::Point& screen_loc); |
+ |
+template |
+void MenuMessageLoop::RepostEventToWindow<ui::TouchEvent>( |
+ const ui::TouchEvent& event, |
+ gfx::NativeWindow window, |
+ const gfx::Point& screen_loc); |
+ |
// static |
-void MenuMessageLoop::RepostEventToWindow(const ui::LocatedEvent& event, |
+template<class EventType> |
+void MenuMessageLoop::RepostEventToWindow(const EventType& event, |
gfx::NativeWindow window, |
const gfx::Point& screen_loc) { |
aura::Window* root = window->GetRootWindow(); |
- ScreenPositionClient* spc = aura::client::GetScreenPositionClient(root); |
+ aura::client::ScreenPositionClient* spc = |
+ aura::client::GetScreenPositionClient(root); |
if (!spc) |
return; |
gfx::Point root_loc(screen_loc); |
spc->ConvertPointFromScreen(root, &root_loc); |
- ui::MouseEvent clone(static_cast<const ui::MouseEvent&>(event)); |
+ EventType clone(event); |
clone.set_location(root_loc); |
clone.set_root_location(root_loc); |
root->GetHost()->dispatcher()->RepostEvent(clone); |