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/renderer/render_widget_fullscreen_pepper.h" | 5 #include "content/renderer/render_widget_fullscreen_pepper.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 #include "third_party/WebKit/public/platform/WebSize.h" | 24 #include "third_party/WebKit/public/platform/WebSize.h" |
25 #include "third_party/WebKit/public/web/WebWidget.h" | 25 #include "third_party/WebKit/public/web/WebWidget.h" |
26 #include "ui/gfx/geometry/size_conversions.h" | 26 #include "ui/gfx/geometry/size_conversions.h" |
27 #include "ui/gl/gpu_preference.h" | 27 #include "ui/gl/gpu_preference.h" |
28 | 28 |
29 using blink::WebCanvas; | 29 using blink::WebCanvas; |
30 using blink::WebCompositionUnderline; | 30 using blink::WebCompositionUnderline; |
31 using blink::WebCursorInfo; | 31 using blink::WebCursorInfo; |
32 using blink::WebGestureEvent; | 32 using blink::WebGestureEvent; |
33 using blink::WebInputEvent; | 33 using blink::WebInputEvent; |
34 using blink::WebInputEventResult; | |
34 using blink::WebMouseEvent; | 35 using blink::WebMouseEvent; |
35 using blink::WebMouseWheelEvent; | 36 using blink::WebMouseWheelEvent; |
36 using blink::WebPoint; | 37 using blink::WebPoint; |
37 using blink::WebRect; | 38 using blink::WebRect; |
38 using blink::WebSize; | 39 using blink::WebSize; |
39 using blink::WebString; | 40 using blink::WebString; |
40 using blink::WebTextDirection; | 41 using blink::WebTextDirection; |
41 using blink::WebTextInputType; | 42 using blink::WebTextInputType; |
42 using blink::WebVector; | 43 using blink::WebVector; |
43 using blink::WebWidget; | 44 using blink::WebWidget; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 | 152 |
152 size_ = size; | 153 size_ = size; |
153 WebRect plugin_rect(0, 0, size_.width, size_.height); | 154 WebRect plugin_rect(0, 0, size_.width, size_.height); |
154 widget_->plugin()->ViewChanged(plugin_rect, plugin_rect, plugin_rect, | 155 widget_->plugin()->ViewChanged(plugin_rect, plugin_rect, plugin_rect, |
155 std::vector<gfx::Rect>()); | 156 std::vector<gfx::Rect>()); |
156 widget_->Invalidate(); | 157 widget_->Invalidate(); |
157 } | 158 } |
158 | 159 |
159 void themeChanged() override { NOTIMPLEMENTED(); } | 160 void themeChanged() override { NOTIMPLEMENTED(); } |
160 | 161 |
161 bool handleInputEvent(const WebInputEvent& event) override { | 162 WebInputEventResult handleInputEvent(const WebInputEvent& event) override { |
162 if (!widget_->plugin()) | 163 if (!widget_->plugin()) |
163 return false; | 164 return WebInputEventResult::NotHandled; |
164 | 165 |
165 // This cursor info is ignored, we always set the cursor directly from | 166 // This cursor info is ignored, we always set the cursor directly from |
166 // RenderWidgetFullscreenPepper::DidChangeCursor. | 167 // RenderWidgetFullscreenPepper::DidChangeCursor. |
167 WebCursorInfo cursor; | 168 WebCursorInfo cursor; |
168 | 169 |
169 // Pepper plugins do not accept gesture events. So do not send the gesture | 170 // Pepper plugins do not accept gesture events. So do not send the gesture |
170 // events directly to the plugin. Instead, try to convert them to equivalent | 171 // events directly to the plugin. Instead, try to convert them to equivalent |
171 // mouse events, and then send to the plugin. | 172 // mouse events, and then send to the plugin. |
172 if (WebInputEvent::isGestureEventType(event.type)) { | 173 if (WebInputEvent::isGestureEventType(event.type)) { |
173 bool result = false; | 174 bool result = false; |
(...skipping 27 matching lines...) Expand all Loading... | |
201 break; | 202 break; |
202 } | 203 } |
203 | 204 |
204 default: { | 205 default: { |
205 WebMouseEvent mouse = WebMouseEventFromGestureEvent(*gesture_event); | 206 WebMouseEvent mouse = WebMouseEventFromGestureEvent(*gesture_event); |
206 if (mouse.type != WebInputEvent::Undefined) | 207 if (mouse.type != WebInputEvent::Undefined) |
207 result |= widget_->plugin()->HandleInputEvent(mouse, &cursor); | 208 result |= widget_->plugin()->HandleInputEvent(mouse, &cursor); |
208 break; | 209 break; |
209 } | 210 } |
210 } | 211 } |
211 return result; | 212 return result ? WebInputEventResult::HandledSystem |
dtapuska
2015/11/30 16:15:43
Adjusted here
| |
213 : WebInputEventResult::NotHandled; | |
212 } | 214 } |
213 | 215 |
214 bool result = widget_->plugin()->HandleInputEvent(event, &cursor); | 216 bool result = widget_->plugin()->HandleInputEvent(event, &cursor); |
215 | 217 |
216 // For normal web pages, WebViewImpl does input event translations and | 218 // For normal web pages, WebViewImpl does input event translations and |
217 // generates context menu events. Since we don't have a WebView, we need to | 219 // generates context menu events. Since we don't have a WebView, we need to |
218 // do the necessary translation ourselves. | 220 // do the necessary translation ourselves. |
219 if (WebInputEvent::isMouseEventType(event.type)) { | 221 if (WebInputEvent::isMouseEventType(event.type)) { |
220 const WebMouseEvent& mouse_event = | 222 const WebMouseEvent& mouse_event = |
221 reinterpret_cast<const WebMouseEvent&>(event); | 223 reinterpret_cast<const WebMouseEvent&>(event); |
(...skipping 14 matching lines...) Expand all Loading... | |
236 send_context_menu_event = | 238 send_context_menu_event = |
237 mouse_event.type == WebInputEvent::MouseDown && | 239 mouse_event.type == WebInputEvent::MouseDown && |
238 mouse_event.button == WebMouseEvent::ButtonRight; | 240 mouse_event.button == WebMouseEvent::ButtonRight; |
239 #endif | 241 #endif |
240 if (send_context_menu_event) { | 242 if (send_context_menu_event) { |
241 WebMouseEvent context_menu_event(mouse_event); | 243 WebMouseEvent context_menu_event(mouse_event); |
242 context_menu_event.type = WebInputEvent::ContextMenu; | 244 context_menu_event.type = WebInputEvent::ContextMenu; |
243 widget_->plugin()->HandleInputEvent(context_menu_event, &cursor); | 245 widget_->plugin()->HandleInputEvent(context_menu_event, &cursor); |
244 } | 246 } |
245 } | 247 } |
246 return result; | 248 return result ? WebInputEventResult::HandledSystem |
Rick Byers
2015/11/27 21:31:53
ditto
dtapuska
2015/11/30 16:15:43
Done.
| |
249 : WebInputEventResult::NotHandled; | |
247 } | 250 } |
248 | 251 |
249 private: | 252 private: |
250 RenderWidgetFullscreenPepper* widget_; | 253 RenderWidgetFullscreenPepper* widget_; |
251 WebSize size_; | 254 WebSize size_; |
252 | 255 |
253 DISALLOW_COPY_AND_ASSIGN(PepperWidget); | 256 DISALLOW_COPY_AND_ASSIGN(PepperWidget); |
254 }; | 257 }; |
255 | 258 |
256 } // anonymous namespace | 259 } // anonymous namespace |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
382 } | 385 } |
383 | 386 |
384 void RenderWidgetFullscreenPepper::SetDeviceScaleFactor( | 387 void RenderWidgetFullscreenPepper::SetDeviceScaleFactor( |
385 float device_scale_factor) { | 388 float device_scale_factor) { |
386 RenderWidget::SetDeviceScaleFactor(device_scale_factor); | 389 RenderWidget::SetDeviceScaleFactor(device_scale_factor); |
387 if (compositor_) | 390 if (compositor_) |
388 compositor_->setDeviceScaleFactor(device_scale_factor); | 391 compositor_->setDeviceScaleFactor(device_scale_factor); |
389 } | 392 } |
390 | 393 |
391 } // namespace content | 394 } // namespace content |
OLD | NEW |