OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/renderer_host/input/synthetic_gesture_target_aura.h" | 5 #include "content/browser/renderer_host/input/synthetic_gesture_target_aura.h" |
6 | 6 |
7 #include "content/browser/renderer_host/render_widget_host_impl.h" | 7 #include "content/browser/renderer_host/render_widget_host_impl.h" |
8 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 8 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
9 #include "content/browser/renderer_host/ui_events_helper.h" | 9 #include "content/browser/renderer_host/ui_events_helper.h" |
10 #include "content/common/input/input_event.h" | 10 #include "content/common/input/input_event.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 } | 117 } |
118 | 118 |
119 return 0; | 119 return 0; |
120 } | 120 } |
121 | 121 |
122 } // namespace | 122 } // namespace |
123 | 123 |
124 void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform( | 124 void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform( |
125 const blink::WebMouseEvent& web_mouse, | 125 const blink::WebMouseEvent& web_mouse, |
126 const ui::LatencyInfo& latency_info) { | 126 const ui::LatencyInfo& latency_info) { |
127 aura::Window* window = render_widget_host()->GetView()->GetNativeView(); | |
128 aura::Window* root_window = window->GetRootWindow(); | |
129 aura::client::ScreenPositionClient* position_client = | |
130 aura::client::GetScreenPositionClient(root_window); | |
131 DCHECK(position_client); | |
132 | |
127 gfx::Point location(web_mouse.x, web_mouse.y); | 133 gfx::Point location(web_mouse.x, web_mouse.y); |
134 position_client->ConvertPointToScreen(window, &location); | |
Dominik Grewe
2013/12/18 10:33:53
I guess we should do the same for mouse wheel even
kouhei (in TOK)
2013/12/19 04:55:39
Done.
| |
135 | |
128 ui::EventType event_type = WebMouseEventTypeToEventType(web_mouse.type); | 136 ui::EventType event_type = WebMouseEventTypeToEventType(web_mouse.type); |
129 int flags = WebMouseEventButtonToFlags(web_mouse.button); | 137 int flags = WebMouseEventButtonToFlags(web_mouse.button); |
130 // TODO: last argument (changed_button_flags) likely isn't right. | 138 ui::MouseEvent mouse_event(event_type, location, location, flags, flags); |
131 ui::MouseEvent mouse_event(event_type, location, location, flags, 0); | |
132 | 139 |
133 GetRootWindowHostDelegate()->OnHostMouseEvent(&mouse_event); | 140 GetRootWindowHostDelegate()->OnHostMouseEvent(&mouse_event); |
134 } | 141 } |
135 | 142 |
136 SyntheticGestureParams::GestureSourceType | 143 SyntheticGestureParams::GestureSourceType |
137 SyntheticGestureTargetAura::GetDefaultSyntheticGestureSourceType() const { | 144 SyntheticGestureTargetAura::GetDefaultSyntheticGestureSourceType() const { |
138 return SyntheticGestureParams::MOUSE_INPUT; | 145 return SyntheticGestureParams::MOUSE_INPUT; |
139 } | 146 } |
140 | 147 |
141 bool SyntheticGestureTargetAura::SupportsSyntheticGestureSourceType( | 148 bool SyntheticGestureTargetAura::SupportsSyntheticGestureSourceType( |
(...skipping 13 matching lines...) Expand all Loading... | |
155 aura::Window* window = render_widget_host()->GetView()->GetNativeView(); | 162 aura::Window* window = render_widget_host()->GetView()->GetNativeView(); |
156 aura::Window* root_window = window->GetRootWindow(); | 163 aura::Window* root_window = window->GetRootWindow(); |
157 aura::RootWindowHostDelegate* root_window_host_delegate = | 164 aura::RootWindowHostDelegate* root_window_host_delegate = |
158 root_window->GetDispatcher()->AsRootWindowHostDelegate(); | 165 root_window->GetDispatcher()->AsRootWindowHostDelegate(); |
159 DCHECK(root_window_host_delegate); | 166 DCHECK(root_window_host_delegate); |
160 return root_window_host_delegate; | 167 return root_window_host_delegate; |
161 } | 168 } |
162 | 169 |
163 | 170 |
164 } // namespace content | 171 } // namespace content |
OLD | NEW |