Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: content/renderer/browser_plugin/browser_plugin.cc

Issue 1463823003: Return a enumeration of the state of handling of InputEvents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add 4th result type Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 489
490 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_SetVisibility( 490 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_SetVisibility(
491 browser_plugin_instance_id_, 491 browser_plugin_instance_id_,
492 visible)); 492 visible));
493 } 493 }
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 blink::WebInputEventResult BrowserPlugin::handleInputEvent(
500 blink::WebCursorInfo& cursor_info) { 500 const blink::WebInputEvent& event,
501 blink::WebCursorInfo& cursor_info) {
501 if (guest_crashed_ || !attached()) 502 if (guest_crashed_ || !attached())
502 return false; 503 return blink::WebInputEventResult::NotHandled;
503 504
504 if (event.type == blink::WebInputEvent::MouseWheel) { 505 if (event.type == blink::WebInputEvent::MouseWheel) {
505 auto wheel_event = static_cast<const blink::WebMouseWheelEvent&>(event); 506 auto wheel_event = static_cast<const blink::WebMouseWheelEvent&>(event);
506 if (wheel_event.resendingPluginId == browser_plugin_instance_id_) 507 if (wheel_event.resendingPluginId == browser_plugin_instance_id_)
507 return false; 508 return blink::WebInputEventResult::NotHandled;
508 } 509 }
509 510
510 if (blink::WebInputEvent::isGestureEventType(event.type)) { 511 if (blink::WebInputEvent::isGestureEventType(event.type)) {
511 auto gesture_event = static_cast<const blink::WebGestureEvent&>(event); 512 auto gesture_event = static_cast<const blink::WebGestureEvent&>(event);
512 if (gesture_event.resendingPluginId == browser_plugin_instance_id_) 513 if (gesture_event.resendingPluginId == browser_plugin_instance_id_)
513 return false; 514 return blink::WebInputEventResult::NotHandled;
514 } 515 }
515 516
516 if (event.type == blink::WebInputEvent::ContextMenu) 517 if (event.type == blink::WebInputEvent::ContextMenu)
517 return true; 518 return blink::WebInputEventResult::HandledSuppressed;
518 519
519 if (blink::WebInputEvent::isKeyboardEventType(event.type) && 520 if (blink::WebInputEvent::isKeyboardEventType(event.type) &&
520 !edit_commands_.empty()) { 521 !edit_commands_.empty()) {
521 BrowserPluginManager::Get()->Send( 522 BrowserPluginManager::Get()->Send(
522 new BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent( 523 new BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent(
523 browser_plugin_instance_id_, 524 browser_plugin_instance_id_,
524 edit_commands_)); 525 edit_commands_));
525 edit_commands_.clear(); 526 edit_commands_.clear();
526 } 527 }
527 528
528 BrowserPluginManager::Get()->Send( 529 BrowserPluginManager::Get()->Send(
529 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, 530 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_,
530 view_rect_, 531 view_rect_,
531 &event)); 532 &event));
532 GetWebCursorInfo(cursor_, &cursor_info); 533 GetWebCursorInfo(cursor_, &cursor_info);
533 534
534 // Although we forward this event to the guest, we don't report it as consumed 535 // 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 // since other targets of this event in Blink never get that chance either.
536 if (event.type == blink::WebInputEvent::GestureFlingStart) 537 if (event.type == blink::WebInputEvent::GestureFlingStart)
537 return false; 538 return blink::WebInputEventResult::NotHandled;
538 539
539 return true; 540 return blink::WebInputEventResult::HandledSystem;
540 } 541 }
541 542
542 bool BrowserPlugin::handleDragStatusUpdate(blink::WebDragStatus drag_status, 543 bool BrowserPlugin::handleDragStatusUpdate(blink::WebDragStatus drag_status,
543 const blink::WebDragData& drag_data, 544 const blink::WebDragData& drag_data,
544 blink::WebDragOperationsMask mask, 545 blink::WebDragOperationsMask mask,
545 const blink::WebPoint& position, 546 const blink::WebPoint& position,
546 const blink::WebPoint& screen) { 547 const blink::WebPoint& screen) {
547 if (guest_crashed_ || !attached()) 548 if (guest_crashed_ || !attached())
548 return false; 549 return false;
549 BrowserPluginManager::Get()->Send( 550 BrowserPluginManager::Get()->Send(
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 bool BrowserPlugin::HandleMouseLockedInputEvent( 662 bool BrowserPlugin::HandleMouseLockedInputEvent(
662 const blink::WebMouseEvent& event) { 663 const blink::WebMouseEvent& event) {
663 BrowserPluginManager::Get()->Send( 664 BrowserPluginManager::Get()->Send(
664 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, 665 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_,
665 view_rect_, 666 view_rect_,
666 &event)); 667 &event));
667 return true; 668 return true;
668 } 669 }
669 670
670 } // namespace content 671 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698