| 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 "components/plugins/renderer/webview_plugin.h" | 5 #include "components/plugins/renderer/webview_plugin.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
| 13 #include "base/numerics/safe_conversions.h" | 13 #include "base/numerics/safe_conversions.h" |
| 14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 16 #include "content/public/common/web_preferences.h" | 16 #include "content/public/common/web_preferences.h" |
| 17 #include "content/public/renderer/render_view.h" | 17 #include "content/public/renderer/render_view.h" |
| 18 #include "gin/converter.h" | 18 #include "gin/converter.h" |
| 19 #include "skia/ext/platform_canvas.h" | 19 #include "skia/ext/platform_canvas.h" |
| 20 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 20 #include "third_party/WebKit/public/platform/WebCoalescedInputEvent.h" |
| 21 #include "third_party/WebKit/public/platform/WebURL.h" | 21 #include "third_party/WebKit/public/platform/WebURL.h" |
| 22 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 22 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 23 #include "third_party/WebKit/public/web/WebDocument.h" | 23 #include "third_party/WebKit/public/web/WebDocument.h" |
| 24 #include "third_party/WebKit/public/web/WebElement.h" | 24 #include "third_party/WebKit/public/web/WebElement.h" |
| 25 #include "third_party/WebKit/public/web/WebFrameWidget.h" | 25 #include "third_party/WebKit/public/web/WebFrameWidget.h" |
| 26 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 26 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 27 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 27 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
| 28 #include "third_party/WebKit/public/web/WebView.h" | 28 #include "third_party/WebKit/public/web/WebView.h" |
| 29 | 29 |
| 30 using blink::WebCanvas; | 30 using blink::WebCanvas; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 if (event.type() == WebInputEvent::ContextMenu) { | 213 if (event.type() == WebInputEvent::ContextMenu) { |
| 214 if (delegate_) { | 214 if (delegate_) { |
| 215 const WebMouseEvent& mouse_event = | 215 const WebMouseEvent& mouse_event = |
| 216 reinterpret_cast<const WebMouseEvent&>(event); | 216 reinterpret_cast<const WebMouseEvent&>(event); |
| 217 delegate_->ShowContextMenu(mouse_event); | 217 delegate_->ShowContextMenu(mouse_event); |
| 218 } | 218 } |
| 219 return blink::WebInputEventResult::HandledSuppressed; | 219 return blink::WebInputEventResult::HandledSuppressed; |
| 220 } | 220 } |
| 221 current_cursor_ = cursor; | 221 current_cursor_ = cursor; |
| 222 blink::WebInputEventResult handled = web_view()->handleInputEvent(event); | 222 blink::WebInputEventResult handled = |
| 223 web_view()->handleInputEvent(blink::WebCoalescedInputEvent(event)); |
| 223 cursor = current_cursor_; | 224 cursor = current_cursor_; |
| 224 | 225 |
| 225 return handled; | 226 return handled; |
| 226 } | 227 } |
| 227 | 228 |
| 228 void WebViewPlugin::didReceiveResponse(const WebURLResponse& response) { | 229 void WebViewPlugin::didReceiveResponse(const WebURLResponse& response) { |
| 229 DCHECK(response_.isNull()); | 230 DCHECK(response_.isNull()); |
| 230 response_ = response; | 231 response_ = response; |
| 231 } | 232 } |
| 232 | 233 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 if (!delegate_) | 346 if (!delegate_) |
| 346 return; | 347 return; |
| 347 | 348 |
| 348 // The delegate may instantiate a new plugin. | 349 // The delegate may instantiate a new plugin. |
| 349 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); | 350 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); |
| 350 // The delegate may have dirtied style and layout of the WebView. | 351 // The delegate may have dirtied style and layout of the WebView. |
| 351 // See for example the resizePoster function in plugin_poster.html. | 352 // See for example the resizePoster function in plugin_poster.html. |
| 352 // Run the lifecycle now so that it is clean. | 353 // Run the lifecycle now so that it is clean. |
| 353 web_view()->updateAllLifecyclePhases(); | 354 web_view()->updateAllLifecyclePhases(); |
| 354 } | 355 } |
| OLD | NEW |