OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "content/renderer/browser_plugin/browser_plugin.h" | 5 #include "content/renderer/browser_plugin/browser_plugin.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 } | 441 } |
442 | 442 |
443 blink::WebInputEventResult BrowserPlugin::handleInputEvent( | 443 blink::WebInputEventResult BrowserPlugin::handleInputEvent( |
444 const blink::WebInputEvent& event, | 444 const blink::WebInputEvent& event, |
445 blink::WebCursorInfo& cursor_info) { | 445 blink::WebCursorInfo& cursor_info) { |
446 if (guest_crashed_ || !attached()) | 446 if (guest_crashed_ || !attached()) |
447 return blink::WebInputEventResult::NotHandled; | 447 return blink::WebInputEventResult::NotHandled; |
448 | 448 |
449 DCHECK(!blink::WebInputEvent::isTouchEventType(event.type())); | 449 DCHECK(!blink::WebInputEvent::isTouchEventType(event.type())); |
450 | 450 |
451 if (event.type() == blink::WebInputEvent::MouseWheel) { | 451 // With direct event routing turned on, BrowserPlugin should almost never |
452 auto wheel_event = static_cast<const blink::WebMouseWheelEvent&>(event); | 452 // see wheel events any more. The two exceptions are (1) scroll bubbling, and |
453 if (wheel_event.resendingPluginId == browser_plugin_instance_id_) | 453 // (2) synthetic mouse wheels generated by touchpad GesturePinch events on |
454 return blink::WebInputEventResult::NotHandled; | 454 // Mac, which always go to the mainframe and thus may hit BrowserPlugin if |
455 } | 455 // it's in a top-level embedder. In both cases we should indicate the event |
| 456 // as not handled (for GesturePinch on Mac, indicating the event has been |
| 457 // handled leads to touchpad pinch not working). |
| 458 if (event.type() == blink::WebInputEvent::MouseWheel) |
| 459 return blink::WebInputEventResult::NotHandled; |
456 | 460 |
457 if (blink::WebInputEvent::isGestureEventType(event.type())) { | 461 if (blink::WebInputEvent::isGestureEventType(event.type())) { |
458 auto gesture_event = static_cast<const blink::WebGestureEvent&>(event); | 462 auto gesture_event = static_cast<const blink::WebGestureEvent&>(event); |
459 DCHECK(blink::WebInputEvent::GestureTapDown == event.type() || | 463 DCHECK(blink::WebInputEvent::GestureTapDown == event.type() || |
460 gesture_event.resendingPluginId == browser_plugin_instance_id_); | 464 gesture_event.resendingPluginId == browser_plugin_instance_id_); |
461 | 465 |
462 // We shouldn't be forwarding GestureEvents to the Guest anymore. Indicate | 466 // We shouldn't be forwarding GestureEvents to the Guest anymore. Indicate |
463 // we handled this only if it's a non-resent event. | 467 // we handled this only if it's a non-resent event. |
464 return gesture_event.resendingPluginId == browser_plugin_instance_id_ | 468 return gesture_event.resendingPluginId == browser_plugin_instance_id_ |
465 ? blink::WebInputEventResult::NotHandled | 469 ? blink::WebInputEventResult::NotHandled |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 | 625 |
622 bool BrowserPlugin::HandleMouseLockedInputEvent( | 626 bool BrowserPlugin::HandleMouseLockedInputEvent( |
623 const blink::WebMouseEvent& event) { | 627 const blink::WebMouseEvent& event) { |
624 BrowserPluginManager::Get()->Send( | 628 BrowserPluginManager::Get()->Send( |
625 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, | 629 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, |
626 &event)); | 630 &event)); |
627 return true; | 631 return true; |
628 } | 632 } |
629 | 633 |
630 } // namespace content | 634 } // namespace content |
OLD | NEW |