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

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

Issue 2573073003: Collapse the API surface on WebInputEvent via accessor functions. (Closed)
Patch Set: Created 4 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 <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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 browser_plugin_instance_id_, 437 browser_plugin_instance_id_,
438 visible)); 438 visible));
439 } 439 }
440 440
441 blink::WebInputEventResult BrowserPlugin::handleInputEvent( 441 blink::WebInputEventResult BrowserPlugin::handleInputEvent(
442 const blink::WebInputEvent& event, 442 const blink::WebInputEvent& event,
443 blink::WebCursorInfo& cursor_info) { 443 blink::WebCursorInfo& cursor_info) {
444 if (guest_crashed_ || !attached()) 444 if (guest_crashed_ || !attached())
445 return blink::WebInputEventResult::NotHandled; 445 return blink::WebInputEventResult::NotHandled;
446 446
447 DCHECK(!blink::WebInputEvent::isTouchEventType(event.type)); 447 DCHECK(!blink::WebInputEvent::isTouchEventType(event.type()));
448 448
449 if (event.type == blink::WebInputEvent::MouseWheel) { 449 if (event.type() == blink::WebInputEvent::MouseWheel) {
450 auto wheel_event = static_cast<const blink::WebMouseWheelEvent&>(event); 450 auto wheel_event = static_cast<const blink::WebMouseWheelEvent&>(event);
451 if (wheel_event.resendingPluginId == browser_plugin_instance_id_) 451 if (wheel_event.resendingPluginId == browser_plugin_instance_id_)
452 return blink::WebInputEventResult::NotHandled; 452 return blink::WebInputEventResult::NotHandled;
453 } 453 }
454 454
455 if (blink::WebInputEvent::isGestureEventType(event.type)) { 455 if (blink::WebInputEvent::isGestureEventType(event.type())) {
456 auto gesture_event = static_cast<const blink::WebGestureEvent&>(event); 456 auto gesture_event = static_cast<const blink::WebGestureEvent&>(event);
457 DCHECK(blink::WebInputEvent::GestureTapDown == event.type || 457 DCHECK(blink::WebInputEvent::GestureTapDown == event.type() ||
458 gesture_event.resendingPluginId == browser_plugin_instance_id_); 458 gesture_event.resendingPluginId == browser_plugin_instance_id_);
459 459
460 // We shouldn't be forwarding GestureEvents to the Guest anymore. Indicate 460 // We shouldn't be forwarding GestureEvents to the Guest anymore. Indicate
461 // we handled this only if it's a non-resent event. 461 // we handled this only if it's a non-resent event.
462 return gesture_event.resendingPluginId == browser_plugin_instance_id_ 462 return gesture_event.resendingPluginId == browser_plugin_instance_id_
463 ? blink::WebInputEventResult::NotHandled 463 ? blink::WebInputEventResult::NotHandled
464 : blink::WebInputEventResult::HandledApplication; 464 : blink::WebInputEventResult::HandledApplication;
465 } 465 }
466 466
467 if (event.type == blink::WebInputEvent::ContextMenu) 467 if (event.type() == blink::WebInputEvent::ContextMenu)
468 return blink::WebInputEventResult::HandledSuppressed; 468 return blink::WebInputEventResult::HandledSuppressed;
469 469
470 if (blink::WebInputEvent::isKeyboardEventType(event.type) && 470 if (blink::WebInputEvent::isKeyboardEventType(event.type()) &&
471 !edit_commands_.empty()) { 471 !edit_commands_.empty()) {
472 BrowserPluginManager::Get()->Send( 472 BrowserPluginManager::Get()->Send(
473 new BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent( 473 new BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent(
474 browser_plugin_instance_id_, 474 browser_plugin_instance_id_,
475 edit_commands_)); 475 edit_commands_));
476 edit_commands_.clear(); 476 edit_commands_.clear();
477 } 477 }
478 478
479 BrowserPluginManager::Get()->Send( 479 BrowserPluginManager::Get()->Send(
480 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, 480 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_,
481 &event)); 481 &event));
482 GetWebCursorInfo(cursor_, &cursor_info); 482 GetWebCursorInfo(cursor_, &cursor_info);
483 483
484 // Although we forward this event to the guest, we don't report it as consumed 484 // Although we forward this event to the guest, we don't report it as consumed
485 // since other targets of this event in Blink never get that chance either. 485 // since other targets of this event in Blink never get that chance either.
486 if (event.type == blink::WebInputEvent::GestureFlingStart) 486 if (event.type() == blink::WebInputEvent::GestureFlingStart)
487 return blink::WebInputEventResult::NotHandled; 487 return blink::WebInputEventResult::NotHandled;
488 488
489 return blink::WebInputEventResult::HandledApplication; 489 return blink::WebInputEventResult::HandledApplication;
490 } 490 }
491 491
492 bool BrowserPlugin::handleDragStatusUpdate(blink::WebDragStatus drag_status, 492 bool BrowserPlugin::handleDragStatusUpdate(blink::WebDragStatus drag_status,
493 const blink::WebDragData& drag_data, 493 const blink::WebDragData& drag_data,
494 blink::WebDragOperationsMask mask, 494 blink::WebDragOperationsMask mask,
495 const blink::WebPoint& position, 495 const blink::WebPoint& position,
496 const blink::WebPoint& screen) { 496 const blink::WebPoint& screen) {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 609
610 bool BrowserPlugin::HandleMouseLockedInputEvent( 610 bool BrowserPlugin::HandleMouseLockedInputEvent(
611 const blink::WebMouseEvent& event) { 611 const blink::WebMouseEvent& event) {
612 BrowserPluginManager::Get()->Send( 612 BrowserPluginManager::Get()->Send(
613 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, 613 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_,
614 &event)); 614 &event));
615 return true; 615 return true;
616 } 616 }
617 617
618 } // namespace content 618 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698