| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 FROM_HERE, | 194 FROM_HERE, |
| 194 base::Bind(&WebViewPlugin::UpdatePluginForNewGeometry, | 195 base::Bind(&WebViewPlugin::UpdatePluginForNewGeometry, |
| 195 weak_factory_.GetWeakPtr(), window_rect, unobscured_rect)); | 196 weak_factory_.GetWeakPtr(), window_rect, unobscured_rect)); |
| 196 } | 197 } |
| 197 | 198 |
| 198 void WebViewPlugin::UpdateFocus(bool focused, blink::WebFocusType focus_type) { | 199 void WebViewPlugin::UpdateFocus(bool focused, blink::WebFocusType focus_type) { |
| 199 focused_ = focused; | 200 focused_ = focused; |
| 200 } | 201 } |
| 201 | 202 |
| 202 blink::WebInputEventResult WebViewPlugin::HandleInputEvent( | 203 blink::WebInputEventResult WebViewPlugin::HandleInputEvent( |
| 203 const WebInputEvent& event, | 204 const WebCoalescedInputEvent& coalesced_event, |
| 204 WebCursorInfo& cursor) { | 205 WebCursorInfo& cursor) { |
| 206 const WebInputEvent& event = coalesced_event.Event(); |
| 205 // For tap events, don't handle them. They will be converted to | 207 // For tap events, don't handle them. They will be converted to |
| 206 // mouse events later and passed to here. | 208 // mouse events later and passed to here. |
| 207 if (event.GetType() == WebInputEvent::kGestureTap) | 209 if (event.GetType() == WebInputEvent::kGestureTap) |
| 208 return blink::WebInputEventResult::kNotHandled; | 210 return blink::WebInputEventResult::kNotHandled; |
| 209 | 211 |
| 210 // For LongPress events we return false, since otherwise the context menu will | 212 // For LongPress events we return false, since otherwise the context menu will |
| 211 // be suppressed. https://crbug.com/482842 | 213 // be suppressed. https://crbug.com/482842 |
| 212 if (event.GetType() == WebInputEvent::kGestureLongPress) | 214 if (event.GetType() == WebInputEvent::kGestureLongPress) |
| 213 return blink::WebInputEventResult::kNotHandled; | 215 return blink::WebInputEventResult::kNotHandled; |
| 214 | 216 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 if (!delegate_) | 361 if (!delegate_) |
| 360 return; | 362 return; |
| 361 | 363 |
| 362 // The delegate may instantiate a new plugin. | 364 // The delegate may instantiate a new plugin. |
| 363 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); | 365 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); |
| 364 // The delegate may have dirtied style and layout of the WebView. | 366 // The delegate may have dirtied style and layout of the WebView. |
| 365 // See for example the resizePoster function in plugin_poster.html. | 367 // See for example the resizePoster function in plugin_poster.html. |
| 366 // Run the lifecycle now so that it is clean. | 368 // Run the lifecycle now so that it is clean. |
| 367 web_view()->UpdateAllLifecyclePhases(); | 369 web_view()->UpdateAllLifecyclePhases(); |
| 368 } | 370 } |
| OLD | NEW |