| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 195 |
| 196 void WebViewPlugin::updateFocus(bool focused, blink::WebFocusType focus_type) { | 196 void WebViewPlugin::updateFocus(bool focused, blink::WebFocusType focus_type) { |
| 197 focused_ = focused; | 197 focused_ = focused; |
| 198 } | 198 } |
| 199 | 199 |
| 200 blink::WebInputEventResult WebViewPlugin::handleInputEvent( | 200 blink::WebInputEventResult WebViewPlugin::handleInputEvent( |
| 201 const WebInputEvent& event, | 201 const WebInputEvent& event, |
| 202 WebCursorInfo& cursor) { | 202 WebCursorInfo& cursor) { |
| 203 // For tap events, don't handle them. They will be converted to | 203 // For tap events, don't handle them. They will be converted to |
| 204 // mouse events later and passed to here. | 204 // mouse events later and passed to here. |
| 205 if (event.type == WebInputEvent::GestureTap) | 205 if (event.type() == WebInputEvent::GestureTap) |
| 206 return blink::WebInputEventResult::NotHandled; | 206 return blink::WebInputEventResult::NotHandled; |
| 207 | 207 |
| 208 // For LongPress events we return false, since otherwise the context menu will | 208 // For LongPress events we return false, since otherwise the context menu will |
| 209 // be suppressed. https://crbug.com/482842 | 209 // be suppressed. https://crbug.com/482842 |
| 210 if (event.type == WebInputEvent::GestureLongPress) | 210 if (event.type() == WebInputEvent::GestureLongPress) |
| 211 return blink::WebInputEventResult::NotHandled; | 211 return blink::WebInputEventResult::NotHandled; |
| 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 = web_view()->handleInputEvent(event); |
| 223 cursor = current_cursor_; | 223 cursor = current_cursor_; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 if (!delegate_) | 345 if (!delegate_) |
| 346 return; | 346 return; |
| 347 | 347 |
| 348 // The delegate may instantiate a new plugin. | 348 // The delegate may instantiate a new plugin. |
| 349 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); | 349 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); |
| 350 // The delegate may have dirtied style and layout of the WebView. | 350 // The delegate may have dirtied style and layout of the WebView. |
| 351 // See for example the resizePoster function in plugin_poster.html. | 351 // See for example the resizePoster function in plugin_poster.html. |
| 352 // Run the lifecycle now so that it is clean. | 352 // Run the lifecycle now so that it is clean. |
| 353 web_view()->updateAllLifecyclePhases(); | 353 web_view()->updateAllLifecyclePhases(); |
| 354 } | 354 } |
| OLD | NEW |