| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 185 |
| 186 void WebViewPlugin::updateFocus(bool focused, blink::WebFocusType focus_type) { | 186 void WebViewPlugin::updateFocus(bool focused, blink::WebFocusType focus_type) { |
| 187 focused_ = focused; | 187 focused_ = focused; |
| 188 } | 188 } |
| 189 | 189 |
| 190 blink::WebInputEventResult WebViewPlugin::handleInputEvent( | 190 blink::WebInputEventResult WebViewPlugin::handleInputEvent( |
| 191 const WebInputEvent& event, | 191 const WebInputEvent& event, |
| 192 WebCursorInfo& cursor) { | 192 WebCursorInfo& cursor) { |
| 193 // For tap events, don't handle them. They will be converted to | 193 // For tap events, don't handle them. They will be converted to |
| 194 // mouse events later and passed to here. | 194 // mouse events later and passed to here. |
| 195 if (event.type == WebInputEvent::GestureTap) | 195 if (event.type() == WebInputEvent::GestureTap) |
| 196 return blink::WebInputEventResult::NotHandled; | 196 return blink::WebInputEventResult::NotHandled; |
| 197 | 197 |
| 198 // For LongPress events we return false, since otherwise the context menu will | 198 // For LongPress events we return false, since otherwise the context menu will |
| 199 // be suppressed. https://crbug.com/482842 | 199 // be suppressed. https://crbug.com/482842 |
| 200 if (event.type == WebInputEvent::GestureLongPress) | 200 if (event.type() == WebInputEvent::GestureLongPress) |
| 201 return blink::WebInputEventResult::NotHandled; | 201 return blink::WebInputEventResult::NotHandled; |
| 202 | 202 |
| 203 if (event.type == WebInputEvent::ContextMenu) { | 203 if (event.type() == WebInputEvent::ContextMenu) { |
| 204 if (delegate_) { | 204 if (delegate_) { |
| 205 const WebMouseEvent& mouse_event = | 205 const WebMouseEvent& mouse_event = |
| 206 reinterpret_cast<const WebMouseEvent&>(event); | 206 reinterpret_cast<const WebMouseEvent&>(event); |
| 207 delegate_->ShowContextMenu(mouse_event); | 207 delegate_->ShowContextMenu(mouse_event); |
| 208 } | 208 } |
| 209 return blink::WebInputEventResult::HandledSuppressed; | 209 return blink::WebInputEventResult::HandledSuppressed; |
| 210 } | 210 } |
| 211 current_cursor_ = cursor; | 211 current_cursor_ = cursor; |
| 212 blink::WebInputEventResult handled = web_view_->handleInputEvent(event); | 212 blink::WebInputEventResult handled = web_view_->handleInputEvent(event); |
| 213 cursor = current_cursor_; | 213 cursor = current_cursor_; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 if (!delegate_) | 312 if (!delegate_) |
| 313 return; | 313 return; |
| 314 | 314 |
| 315 // The delegate may instantiate a new plugin. | 315 // The delegate may instantiate a new plugin. |
| 316 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); | 316 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); |
| 317 // The delegate may have dirtied style and layout of the WebView. | 317 // The delegate may have dirtied style and layout of the WebView. |
| 318 // See for example the resizePoster function in plugin_poster.html. | 318 // See for example the resizePoster function in plugin_poster.html. |
| 319 // Run the lifecycle now so that it is clean. | 319 // Run the lifecycle now so that it is clean. |
| 320 web_view_->updateAllLifecyclePhases(); | 320 web_view_->updateAllLifecyclePhases(); |
| 321 } | 321 } |
| OLD | NEW |