| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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; |
| 31 using blink::WebCoalescedInputEvent; |
| 31 using blink::WebCursorInfo; | 32 using blink::WebCursorInfo; |
| 32 using blink::WebDragData; | 33 using blink::WebDragData; |
| 33 using blink::WebDragOperationsMask; | 34 using blink::WebDragOperationsMask; |
| 34 using blink::WebFrameWidget; | 35 using blink::WebFrameWidget; |
| 35 using blink::WebImage; | 36 using blink::WebImage; |
| 36 using blink::WebInputEvent; | 37 using blink::WebInputEvent; |
| 37 using blink::WebLocalFrame; | 38 using blink::WebLocalFrame; |
| 38 using blink::WebMouseEvent; | 39 using blink::WebMouseEvent; |
| 39 using blink::WebPlugin; | 40 using blink::WebPlugin; |
| 40 using blink::WebPluginContainer; | 41 using blink::WebPluginContainer; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 FROM_HERE, | 200 FROM_HERE, |
| 200 base::Bind(&WebViewPlugin::UpdatePluginForNewGeometry, | 201 base::Bind(&WebViewPlugin::UpdatePluginForNewGeometry, |
| 201 weak_factory_.GetWeakPtr(), window_rect, unobscured_rect)); | 202 weak_factory_.GetWeakPtr(), window_rect, unobscured_rect)); |
| 202 } | 203 } |
| 203 | 204 |
| 204 void WebViewPlugin::UpdateFocus(bool focused, blink::WebFocusType focus_type) { | 205 void WebViewPlugin::UpdateFocus(bool focused, blink::WebFocusType focus_type) { |
| 205 focused_ = focused; | 206 focused_ = focused; |
| 206 } | 207 } |
| 207 | 208 |
| 208 blink::WebInputEventResult WebViewPlugin::HandleInputEvent( | 209 blink::WebInputEventResult WebViewPlugin::HandleInputEvent( |
| 209 const WebInputEvent& event, | 210 const WebCoalescedInputEvent& coalesced_event, |
| 210 WebCursorInfo& cursor) { | 211 WebCursorInfo& cursor) { |
| 212 const WebInputEvent& event = coalesced_event.Event(); |
| 211 // For tap events, don't handle them. They will be converted to | 213 // For tap events, don't handle them. They will be converted to |
| 212 // mouse events later and passed to here. | 214 // mouse events later and passed to here. |
| 213 if (event.GetType() == WebInputEvent::kGestureTap) | 215 if (event.GetType() == WebInputEvent::kGestureTap) |
| 214 return blink::WebInputEventResult::kNotHandled; | 216 return blink::WebInputEventResult::kNotHandled; |
| 215 | 217 |
| 216 // For LongPress events we return false, since otherwise the context menu will | 218 // For LongPress events we return false, since otherwise the context menu will |
| 217 // be suppressed. https://crbug.com/482842 | 219 // be suppressed. https://crbug.com/482842 |
| 218 if (event.GetType() == WebInputEvent::kGestureLongPress) | 220 if (event.GetType() == WebInputEvent::kGestureLongPress) |
| 219 return blink::WebInputEventResult::kNotHandled; | 221 return blink::WebInputEventResult::kNotHandled; |
| 220 | 222 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 if (!delegate_) | 367 if (!delegate_) |
| 366 return; | 368 return; |
| 367 | 369 |
| 368 // The delegate may instantiate a new plugin. | 370 // The delegate may instantiate a new plugin. |
| 369 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); | 371 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); |
| 370 // The delegate may have dirtied style and layout of the WebView. | 372 // The delegate may have dirtied style and layout of the WebView. |
| 371 // See for example the resizePoster function in plugin_poster.html. | 373 // See for example the resizePoster function in plugin_poster.html. |
| 372 // Run the lifecycle now so that it is clean. | 374 // Run the lifecycle now so that it is clean. |
| 373 web_view()->UpdateAllLifecyclePhases(); | 375 web_view()->UpdateAllLifecyclePhases(); |
| 374 } | 376 } |
| OLD | NEW |