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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 | 494 |
495 bool BrowserPlugin::acceptsInputEvents() { | 495 bool BrowserPlugin::acceptsInputEvents() { |
496 return true; | 496 return true; |
497 } | 497 } |
498 | 498 |
499 bool BrowserPlugin::handleInputEvent(const blink::WebInputEvent& event, | 499 bool BrowserPlugin::handleInputEvent(const blink::WebInputEvent& event, |
500 blink::WebCursorInfo& cursor_info) { | 500 blink::WebCursorInfo& cursor_info) { |
501 if (guest_crashed_ || !attached()) | 501 if (guest_crashed_ || !attached()) |
502 return false; | 502 return false; |
503 | 503 |
| 504 if (event.type == blink::WebInputEvent::MouseWheel) { |
| 505 auto wheel_event = static_cast<const blink::WebMouseWheelEvent&>(event); |
| 506 if (wheel_event.resendingPluginId == browser_plugin_instance_id_) |
| 507 return false; |
| 508 } |
| 509 |
| 510 if (blink::WebInputEvent::isGestureEventType(event.type)) { |
| 511 auto gesture_event = static_cast<const blink::WebGestureEvent&>(event); |
| 512 if (gesture_event.resendingPluginId == browser_plugin_instance_id_) |
| 513 return false; |
| 514 } |
| 515 |
504 if (event.type == blink::WebInputEvent::ContextMenu) | 516 if (event.type == blink::WebInputEvent::ContextMenu) |
505 return true; | 517 return true; |
506 | 518 |
507 if (blink::WebInputEvent::isKeyboardEventType(event.type) && | 519 if (blink::WebInputEvent::isKeyboardEventType(event.type) && |
508 !edit_commands_.empty()) { | 520 !edit_commands_.empty()) { |
509 BrowserPluginManager::Get()->Send( | 521 BrowserPluginManager::Get()->Send( |
510 new BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent( | 522 new BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent( |
511 browser_plugin_instance_id_, | 523 browser_plugin_instance_id_, |
512 edit_commands_)); | 524 edit_commands_)); |
513 edit_commands_.clear(); | 525 edit_commands_.clear(); |
514 } | 526 } |
515 | 527 |
516 BrowserPluginManager::Get()->Send( | 528 BrowserPluginManager::Get()->Send( |
517 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, | 529 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, |
518 view_rect_, | 530 view_rect_, |
519 &event)); | 531 &event)); |
520 GetWebKitCursorInfo(cursor_, &cursor_info); | 532 GetWebKitCursorInfo(cursor_, &cursor_info); |
| 533 |
| 534 // Although we forward this event to the guest, we don't report it as consumed |
| 535 // since other targets of this event in Blink never get that chance either. |
| 536 if (event.type == blink::WebInputEvent::GestureFlingStart) |
| 537 return false; |
| 538 |
521 return true; | 539 return true; |
522 } | 540 } |
523 | 541 |
524 bool BrowserPlugin::handleDragStatusUpdate(blink::WebDragStatus drag_status, | 542 bool BrowserPlugin::handleDragStatusUpdate(blink::WebDragStatus drag_status, |
525 const blink::WebDragData& drag_data, | 543 const blink::WebDragData& drag_data, |
526 blink::WebDragOperationsMask mask, | 544 blink::WebDragOperationsMask mask, |
527 const blink::WebPoint& position, | 545 const blink::WebPoint& position, |
528 const blink::WebPoint& screen) { | 546 const blink::WebPoint& screen) { |
529 if (guest_crashed_ || !attached()) | 547 if (guest_crashed_ || !attached()) |
530 return false; | 548 return false; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 bool BrowserPlugin::HandleMouseLockedInputEvent( | 661 bool BrowserPlugin::HandleMouseLockedInputEvent( |
644 const blink::WebMouseEvent& event) { | 662 const blink::WebMouseEvent& event) { |
645 BrowserPluginManager::Get()->Send( | 663 BrowserPluginManager::Get()->Send( |
646 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, | 664 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, |
647 view_rect_, | 665 view_rect_, |
648 &event)); | 666 &event)); |
649 return true; | 667 return true; |
650 } | 668 } |
651 | 669 |
652 } // namespace content | 670 } // namespace content |
OLD | NEW |