OLD | NEW |
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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "content/browser/renderer_host/backing_store_aura.h" | 26 #include "content/browser/renderer_host/backing_store_aura.h" |
27 #include "content/browser/renderer_host/dip_util.h" | 27 #include "content/browser/renderer_host/dip_util.h" |
28 #include "content/browser/renderer_host/overscroll_controller.h" | 28 #include "content/browser/renderer_host/overscroll_controller.h" |
29 #include "content/browser/renderer_host/render_view_host_delegate.h" | 29 #include "content/browser/renderer_host/render_view_host_delegate.h" |
30 #include "content/browser/renderer_host/render_widget_host_impl.h" | 30 #include "content/browser/renderer_host/render_widget_host_impl.h" |
31 #include "content/browser/renderer_host/touch_smooth_scroll_gesture_aura.h" | 31 #include "content/browser/renderer_host/touch_smooth_scroll_gesture_aura.h" |
32 #include "content/browser/renderer_host/ui_events_helper.h" | 32 #include "content/browser/renderer_host/ui_events_helper.h" |
33 #include "content/browser/renderer_host/web_input_event_aura.h" | 33 #include "content/browser/renderer_host/web_input_event_aura.h" |
34 #include "content/common/gpu/client/gl_helper.h" | 34 #include "content/common/gpu/client/gl_helper.h" |
35 #include "content/common/gpu/gpu_messages.h" | 35 #include "content/common/gpu/gpu_messages.h" |
| 36 #include "content/common/input/input_event.h" |
| 37 #include "content/common/input/web_input_event_payload.h" |
36 #include "content/common/view_messages.h" | 38 #include "content/common/view_messages.h" |
37 #include "content/port/browser/render_widget_host_view_frame_subscriber.h" | 39 #include "content/port/browser/render_widget_host_view_frame_subscriber.h" |
38 #include "content/port/browser/render_widget_host_view_port.h" | 40 #include "content/port/browser/render_widget_host_view_port.h" |
39 #include "content/public/browser/browser_thread.h" | 41 #include "content/public/browser/browser_thread.h" |
40 #include "content/public/browser/content_browser_client.h" | 42 #include "content/public/browser/content_browser_client.h" |
41 #include "content/public/browser/render_process_host.h" | 43 #include "content/public/browser/render_process_host.h" |
42 #include "content/public/browser/render_view_host.h" | 44 #include "content/public/browser/render_view_host.h" |
43 #include "content/public/browser/user_metrics.h" | 45 #include "content/public/browser/user_metrics.h" |
44 #include "content/public/common/content_switches.h" | 46 #include "content/public/common/content_switches.h" |
45 #include "media/base/video_util.h" | 47 #include "media/base/video_util.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 #include "content/browser/accessibility/browser_accessibility_win.h" | 84 #include "content/browser/accessibility/browser_accessibility_win.h" |
83 #include "ui/base/win/hidden_window.h" | 85 #include "ui/base/win/hidden_window.h" |
84 #include "ui/gfx/gdi_util.h" | 86 #include "ui/gfx/gdi_util.h" |
85 #include "ui/gfx/win/dpi.h" | 87 #include "ui/gfx/win/dpi.h" |
86 #endif | 88 #endif |
87 | 89 |
88 using gfx::RectToSkIRect; | 90 using gfx::RectToSkIRect; |
89 using gfx::SkIRectToRect; | 91 using gfx::SkIRectToRect; |
90 | 92 |
91 using WebKit::WebScreenInfo; | 93 using WebKit::WebScreenInfo; |
| 94 using WebKit::WebInputEvent; |
92 using WebKit::WebTouchEvent; | 95 using WebKit::WebTouchEvent; |
93 | 96 |
94 namespace content { | 97 namespace content { |
95 | 98 |
96 void ReleaseMailbox(scoped_refptr<MemoryHolder> holder, | 99 void ReleaseMailbox(scoped_refptr<MemoryHolder> holder, |
97 unsigned sync_point, | 100 unsigned sync_point, |
98 bool lost_resource) {} | 101 bool lost_resource) {} |
99 | 102 |
100 class MemoryHolder : public base::RefCounted<MemoryHolder> { | 103 class MemoryHolder : public base::RefCounted<MemoryHolder> { |
101 public: | 104 public: |
(...skipping 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2127 return; | 2130 return; |
2128 | 2131 |
2129 ui::EventResult result = (ack_result == | 2132 ui::EventResult result = (ack_result == |
2130 INPUT_EVENT_ACK_STATE_CONSUMED) ? ui::ER_HANDLED : ui::ER_UNHANDLED; | 2133 INPUT_EVENT_ACK_STATE_CONSUMED) ? ui::ER_HANDLED : ui::ER_UNHANDLED; |
2131 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(), | 2134 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(), |
2132 end = events.end(); iter != end; ++iter) { | 2135 end = events.end(); iter != end; ++iter) { |
2133 root->ProcessedTouchEvent((*iter), window_, result); | 2136 root->ProcessedTouchEvent((*iter), window_, result); |
2134 } | 2137 } |
2135 } | 2138 } |
2136 | 2139 |
| 2140 void RenderWidgetHostViewAura::QueueInputEventToPlatform( |
| 2141 const InputEvent& event) { |
| 2142 aura::RootWindow* root_window = window_->GetRootWindow(); |
| 2143 if (!root_window) |
| 2144 return; |
| 2145 |
| 2146 aura::RootWindowHostDelegate* root_window_host_delegate = |
| 2147 root_window->AsRootWindowHostDelegate(); |
| 2148 |
| 2149 DCHECK(event.valid()); |
| 2150 DCHECK_EQ(InputEvent::Payload::WEB_INPUT_EVENT, event.payload()->GetType()); |
| 2151 |
| 2152 const WebInputEventPayload* payload = |
| 2153 WebInputEventPayload::Cast(event.payload()); |
| 2154 const WebInputEvent* web_event = payload->web_event(); |
| 2155 if (WebInputEvent::isTouchEventType(web_event->type)) { |
| 2156 ScopedVector<ui::TouchEvent> events; |
| 2157 |
| 2158 const WebTouchEvent* web_touch = |
| 2159 static_cast<const WebTouchEvent*>(web_event); |
| 2160 |
| 2161 TouchEventWithLatencyInfo touch_with_latency( |
| 2162 *web_touch, payload->latency_info()); |
| 2163 |
| 2164 // SyntheticGesture may skip calculating screenPosition, so we will fill it |
| 2165 // in here. "screenPosition" is converted from "position". |
| 2166 const unsigned num_touches = touch_with_latency.event.touchesLength; |
| 2167 for (unsigned i = 0; i < num_touches; ++ i) { |
| 2168 WebKit::WebTouchPoint* point = &touch_with_latency.event.touches[i]; |
| 2169 gfx::Point position(point->position.x, point->position.y); |
| 2170 aura::Window::ConvertPointToTarget(window_, root_window, &position); |
| 2171 root_window->ConvertPointToHost(&position); |
| 2172 point->screenPosition.x = position.x(); |
| 2173 point->screenPosition.y = position.y(); |
| 2174 } |
| 2175 |
| 2176 if (!MakeUITouchEventsFromWebTouchEvents(touch_with_latency, &events, |
| 2177 SCREEN_COORDINATES)) |
| 2178 return; |
| 2179 |
| 2180 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(), |
| 2181 end = events.end(); iter != end; ++iter) { |
| 2182 root_window_host_delegate->OnHostTouchEvent(*iter); |
| 2183 } |
| 2184 } else |
| 2185 NOTREACHED(); // FIXME: implement other types (MouseWheel?) |
| 2186 } |
| 2187 |
2137 SyntheticGesture* RenderWidgetHostViewAura::CreateSmoothScrollGesture( | 2188 SyntheticGesture* RenderWidgetHostViewAura::CreateSmoothScrollGesture( |
2138 bool scroll_down, | 2189 bool scroll_down, |
2139 int pixels_to_scroll, | 2190 int pixels_to_scroll, |
2140 int mouse_event_x, | 2191 int mouse_event_x, |
2141 int mouse_event_y) { | 2192 int mouse_event_y) { |
2142 return new TouchSmoothScrollGestureAura(scroll_down, | 2193 return new TouchSmoothScrollGestureAura(scroll_down, |
2143 pixels_to_scroll, | 2194 pixels_to_scroll, |
2144 mouse_event_x, | 2195 mouse_event_x, |
2145 mouse_event_y, | 2196 mouse_event_y, |
2146 window_); | 2197 window_); |
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3425 RenderWidgetHost* widget) { | 3476 RenderWidgetHost* widget) { |
3426 return new RenderWidgetHostViewAura(widget); | 3477 return new RenderWidgetHostViewAura(widget); |
3427 } | 3478 } |
3428 | 3479 |
3429 // static | 3480 // static |
3430 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3481 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3431 GetScreenInfoForWindow(results, NULL); | 3482 GetScreenInfoForWindow(results, NULL); |
3432 } | 3483 } |
3433 | 3484 |
3434 } // namespace content | 3485 } // namespace content |
OLD | NEW |