Chromium Code Reviews| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 476 | 476 |
| 477 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_SetVisibility( | 477 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_SetVisibility( |
| 478 browser_plugin_instance_id_, | 478 browser_plugin_instance_id_, |
| 479 visible)); | 479 visible)); |
| 480 } | 480 } |
| 481 | 481 |
| 482 bool BrowserPlugin::acceptsInputEvents() { | 482 bool BrowserPlugin::acceptsInputEvents() { |
| 483 return true; | 483 return true; |
| 484 } | 484 } |
| 485 | 485 |
| 486 bool BrowserPlugin::handleInputEvent(const blink::WebInputEvent& event, | 486 blink::WebInputEventResult BrowserPlugin::handleInputEvent( |
| 487 blink::WebCursorInfo& cursor_info) { | 487 const blink::WebInputEvent& event, |
| 488 blink::WebCursorInfo& cursor_info) { | |
| 488 if (guest_crashed_ || !attached()) | 489 if (guest_crashed_ || !attached()) |
| 489 return false; | 490 return blink::WebInputEventResult::NotHandled; |
| 490 | 491 |
| 491 if (event.type == blink::WebInputEvent::MouseWheel) { | 492 if (event.type == blink::WebInputEvent::MouseWheel) { |
| 492 auto wheel_event = static_cast<const blink::WebMouseWheelEvent&>(event); | 493 auto wheel_event = static_cast<const blink::WebMouseWheelEvent&>(event); |
| 493 if (wheel_event.resendingPluginId == browser_plugin_instance_id_) | 494 if (wheel_event.resendingPluginId == browser_plugin_instance_id_) |
| 494 return false; | 495 return blink::WebInputEventResult::NotHandled; |
| 495 } | 496 } |
| 496 | 497 |
| 497 if (blink::WebInputEvent::isGestureEventType(event.type)) { | 498 if (blink::WebInputEvent::isGestureEventType(event.type)) { |
| 498 auto gesture_event = static_cast<const blink::WebGestureEvent&>(event); | 499 auto gesture_event = static_cast<const blink::WebGestureEvent&>(event); |
| 499 if (gesture_event.resendingPluginId == browser_plugin_instance_id_) | 500 if (gesture_event.resendingPluginId == browser_plugin_instance_id_) |
| 500 return false; | 501 return blink::WebInputEventResult::NotHandled; |
| 501 } | 502 } |
| 502 | 503 |
| 503 if (event.type == blink::WebInputEvent::ContextMenu) | 504 if (event.type == blink::WebInputEvent::ContextMenu) |
| 504 return true; | 505 return blink::WebInputEventResult::HandledSuppressed; |
| 505 | 506 |
| 506 if (blink::WebInputEvent::isKeyboardEventType(event.type) && | 507 if (blink::WebInputEvent::isKeyboardEventType(event.type) && |
| 507 !edit_commands_.empty()) { | 508 !edit_commands_.empty()) { |
| 508 BrowserPluginManager::Get()->Send( | 509 BrowserPluginManager::Get()->Send( |
| 509 new BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent( | 510 new BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent( |
| 510 browser_plugin_instance_id_, | 511 browser_plugin_instance_id_, |
| 511 edit_commands_)); | 512 edit_commands_)); |
| 512 edit_commands_.clear(); | 513 edit_commands_.clear(); |
| 513 } | 514 } |
| 514 | 515 |
| 515 BrowserPluginManager::Get()->Send( | 516 BrowserPluginManager::Get()->Send( |
| 516 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, | 517 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, |
| 517 view_rect_, | 518 view_rect_, |
| 518 &event)); | 519 &event)); |
| 519 GetWebCursorInfo(cursor_, &cursor_info); | 520 GetWebCursorInfo(cursor_, &cursor_info); |
| 520 | 521 |
| 521 // Although we forward this event to the guest, we don't report it as consumed | 522 // Although we forward this event to the guest, we don't report it as consumed |
| 522 // since other targets of this event in Blink never get that chance either. | 523 // since other targets of this event in Blink never get that chance either. |
| 523 if (event.type == blink::WebInputEvent::GestureFlingStart) | 524 if (event.type == blink::WebInputEvent::GestureFlingStart) |
| 524 return false; | 525 return blink::WebInputEventResult::NotHandled; |
| 525 | 526 |
| 526 return true; | 527 return blink::WebInputEventResult::HandledSystem; |
|
dtapuska
2015/11/30 16:15:43
Adjusted here
| |
| 527 } | 528 } |
| 528 | 529 |
| 529 bool BrowserPlugin::handleDragStatusUpdate(blink::WebDragStatus drag_status, | 530 bool BrowserPlugin::handleDragStatusUpdate(blink::WebDragStatus drag_status, |
| 530 const blink::WebDragData& drag_data, | 531 const blink::WebDragData& drag_data, |
| 531 blink::WebDragOperationsMask mask, | 532 blink::WebDragOperationsMask mask, |
| 532 const blink::WebPoint& position, | 533 const blink::WebPoint& position, |
| 533 const blink::WebPoint& screen) { | 534 const blink::WebPoint& screen) { |
| 534 if (guest_crashed_ || !attached()) | 535 if (guest_crashed_ || !attached()) |
| 535 return false; | 536 return false; |
| 536 BrowserPluginManager::Get()->Send( | 537 BrowserPluginManager::Get()->Send( |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 648 bool BrowserPlugin::HandleMouseLockedInputEvent( | 649 bool BrowserPlugin::HandleMouseLockedInputEvent( |
| 649 const blink::WebMouseEvent& event) { | 650 const blink::WebMouseEvent& event) { |
| 650 BrowserPluginManager::Get()->Send( | 651 BrowserPluginManager::Get()->Send( |
| 651 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, | 652 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, |
| 652 view_rect_, | 653 view_rect_, |
| 653 &event)); | 654 &event)); |
| 654 return true; | 655 return true; |
| 655 } | 656 } |
| 656 | 657 |
| 657 } // namespace content | 658 } // namespace content |
| OLD | NEW |