| 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 15 matching lines...) Expand all Loading... |
| 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::WebCursorInfo; | 31 using blink::WebCursorInfo; |
| 32 using blink::WebDragData; | 32 using blink::WebDragData; |
| 33 using blink::WebDragOperationsMask; | 33 using blink::WebDragOperationsMask; |
| 34 using blink::WebFrameWidget; | 34 using blink::WebFrameWidget; |
| 35 using blink::WebImage; | 35 using blink::WebImage; |
| 36 using blink::WebInputEvent; | |
| 37 using blink::WebLocalFrame; | 36 using blink::WebLocalFrame; |
| 38 using blink::WebMouseEvent; | 37 using blink::WebMouseEvent; |
| 39 using blink::WebPlugin; | 38 using blink::WebPlugin; |
| 40 using blink::WebPluginContainer; | 39 using blink::WebPluginContainer; |
| 41 using blink::WebPoint; | 40 using blink::WebPoint; |
| 42 using blink::WebRect; | 41 using blink::WebRect; |
| 43 using blink::WebString; | 42 using blink::WebString; |
| 44 using blink::WebURLError; | 43 using blink::WebURLError; |
| 45 using blink::WebURLResponse; | 44 using blink::WebURLResponse; |
| 46 using blink::WebVector; | 45 using blink::WebVector; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 FROM_HERE, | 197 FROM_HERE, |
| 199 base::Bind(&WebViewPlugin::UpdatePluginForNewGeometry, | 198 base::Bind(&WebViewPlugin::UpdatePluginForNewGeometry, |
| 200 weak_factory_.GetWeakPtr(), window_rect, unobscured_rect)); | 199 weak_factory_.GetWeakPtr(), window_rect, unobscured_rect)); |
| 201 } | 200 } |
| 202 | 201 |
| 203 void WebViewPlugin::UpdateFocus(bool focused, blink::WebFocusType focus_type) { | 202 void WebViewPlugin::UpdateFocus(bool focused, blink::WebFocusType focus_type) { |
| 204 focused_ = focused; | 203 focused_ = focused; |
| 205 } | 204 } |
| 206 | 205 |
| 207 blink::WebInputEventResult WebViewPlugin::HandleInputEvent( | 206 blink::WebInputEventResult WebViewPlugin::HandleInputEvent( |
| 208 const WebInputEvent& event, | 207 const blink::WebCoalescedInputEvent& coalesced_event, |
| 209 WebCursorInfo& cursor) { | 208 WebCursorInfo& cursor) { |
| 209 const blink::WebInputEvent& event = coalesced_event.Event(); |
| 210 // For tap events, don't handle them. They will be converted to | 210 // For tap events, don't handle them. They will be converted to |
| 211 // mouse events later and passed to here. | 211 // mouse events later and passed to here. |
| 212 if (event.GetType() == WebInputEvent::kGestureTap) | 212 if (event.GetType() == blink::WebInputEvent::kGestureTap) |
| 213 return blink::WebInputEventResult::kNotHandled; | 213 return blink::WebInputEventResult::kNotHandled; |
| 214 | 214 |
| 215 // For LongPress events we return false, since otherwise the context menu will | 215 // For LongPress events we return false, since otherwise the context menu will |
| 216 // be suppressed. https://crbug.com/482842 | 216 // be suppressed. https://crbug.com/482842 |
| 217 if (event.GetType() == WebInputEvent::kGestureLongPress) | 217 if (event.GetType() == blink::WebInputEvent::kGestureLongPress) |
| 218 return blink::WebInputEventResult::kNotHandled; | 218 return blink::WebInputEventResult::kNotHandled; |
| 219 | 219 |
| 220 if (event.GetType() == WebInputEvent::kContextMenu) { | 220 if (event.GetType() == blink::WebInputEvent::kContextMenu) { |
| 221 if (delegate_) { | 221 if (delegate_) { |
| 222 const WebMouseEvent& mouse_event = | 222 const WebMouseEvent& mouse_event = |
| 223 reinterpret_cast<const WebMouseEvent&>(event); | 223 reinterpret_cast<const WebMouseEvent&>(event); |
| 224 delegate_->ShowContextMenu(mouse_event); | 224 delegate_->ShowContextMenu(mouse_event); |
| 225 } | 225 } |
| 226 return blink::WebInputEventResult::kHandledSuppressed; | 226 return blink::WebInputEventResult::kHandledSuppressed; |
| 227 } | 227 } |
| 228 current_cursor_ = cursor; | 228 current_cursor_ = cursor; |
| 229 blink::WebInputEventResult handled = | 229 blink::WebInputEventResult handled = |
| 230 web_view()->HandleInputEvent(blink::WebCoalescedInputEvent(event)); | 230 web_view()->HandleInputEvent(blink::WebCoalescedInputEvent(event)); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 if (!delegate_) | 372 if (!delegate_) |
| 373 return; | 373 return; |
| 374 | 374 |
| 375 // The delegate may instantiate a new plugin. | 375 // The delegate may instantiate a new plugin. |
| 376 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); | 376 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); |
| 377 // The delegate may have dirtied style and layout of the WebView. | 377 // The delegate may have dirtied style and layout of the WebView. |
| 378 // See for example the resizePoster function in plugin_poster.html. | 378 // See for example the resizePoster function in plugin_poster.html. |
| 379 // Run the lifecycle now so that it is clean. | 379 // Run the lifecycle now so that it is clean. |
| 380 web_view()->UpdateAllLifecyclePhases(); | 380 web_view()->UpdateAllLifecyclePhases(); |
| 381 } | 381 } |
| OLD | NEW |