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

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: Fix nits Created 3 years, 11 months 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 browser_plugin_instance_id_, 438 browser_plugin_instance_id_,
439 visible)); 439 visible));
440 } 440 }
441 441
442 blink::WebInputEventResult BrowserPlugin::handleInputEvent( 442 blink::WebInputEventResult BrowserPlugin::handleInputEvent(
443 const blink::WebInputEvent& event, 443 const blink::WebInputEvent& event,
444 blink::WebCursorInfo& cursor_info) { 444 blink::WebCursorInfo& cursor_info) {
445 if (guest_crashed_ || !attached()) 445 if (guest_crashed_ || !attached())
446 return blink::WebInputEventResult::NotHandled; 446 return blink::WebInputEventResult::NotHandled;
447 447
448 DCHECK(!blink::WebInputEvent::isTouchEventType(event.type)); 448 DCHECK(!blink::WebInputEvent::isTouchEventType(event.type()));
449 449
450 if (event.type == blink::WebInputEvent::MouseWheel) { 450 if (event.type() == blink::WebInputEvent::MouseWheel) {
451 auto wheel_event = static_cast<const blink::WebMouseWheelEvent&>(event); 451 auto wheel_event = static_cast<const blink::WebMouseWheelEvent&>(event);
452 if (wheel_event.resendingPluginId == browser_plugin_instance_id_) 452 if (wheel_event.resendingPluginId == browser_plugin_instance_id_)
453 return blink::WebInputEventResult::NotHandled; 453 return blink::WebInputEventResult::NotHandled;
454 } 454 }
455 455
456 if (blink::WebInputEvent::isGestureEventType(event.type)) { 456 if (blink::WebInputEvent::isGestureEventType(event.type())) {
457 auto gesture_event = static_cast<const blink::WebGestureEvent&>(event); 457 auto gesture_event = static_cast<const blink::WebGestureEvent&>(event);
458 DCHECK(blink::WebInputEvent::GestureTapDown == event.type || 458 DCHECK(blink::WebInputEvent::GestureTapDown == event.type() ||
459 gesture_event.resendingPluginId == browser_plugin_instance_id_); 459 gesture_event.resendingPluginId == browser_plugin_instance_id_);
460 460
461 // We shouldn't be forwarding GestureEvents to the Guest anymore. Indicate 461 // We shouldn't be forwarding GestureEvents to the Guest anymore. Indicate
462 // we handled this only if it's a non-resent event. 462 // we handled this only if it's a non-resent event.
463 return gesture_event.resendingPluginId == browser_plugin_instance_id_ 463 return gesture_event.resendingPluginId == browser_plugin_instance_id_
464 ? blink::WebInputEventResult::NotHandled 464 ? blink::WebInputEventResult::NotHandled
465 : blink::WebInputEventResult::HandledApplication; 465 : blink::WebInputEventResult::HandledApplication;
466 } 466 }
467 467
468 if (event.type == blink::WebInputEvent::ContextMenu) 468 if (event.type() == blink::WebInputEvent::ContextMenu)
469 return blink::WebInputEventResult::HandledSuppressed; 469 return blink::WebInputEventResult::HandledSuppressed;
470 470
471 if (blink::WebInputEvent::isKeyboardEventType(event.type) && 471 if (blink::WebInputEvent::isKeyboardEventType(event.type()) &&
472 !edit_commands_.empty()) { 472 !edit_commands_.empty()) {
473 BrowserPluginManager::Get()->Send( 473 BrowserPluginManager::Get()->Send(
474 new BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent( 474 new BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent(
475 browser_plugin_instance_id_, 475 browser_plugin_instance_id_,
476 edit_commands_)); 476 edit_commands_));
477 edit_commands_.clear(); 477 edit_commands_.clear();
478 } 478 }
479 479
480 BrowserPluginManager::Get()->Send( 480 BrowserPluginManager::Get()->Send(
481 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, 481 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_,
482 &event)); 482 &event));
483 GetWebCursorInfo(cursor_, &cursor_info); 483 GetWebCursorInfo(cursor_, &cursor_info);
484 484
485 // Although we forward this event to the guest, we don't report it as consumed 485 // Although we forward this event to the guest, we don't report it as consumed
486 // since other targets of this event in Blink never get that chance either. 486 // since other targets of this event in Blink never get that chance either.
487 if (event.type == blink::WebInputEvent::GestureFlingStart) 487 if (event.type() == blink::WebInputEvent::GestureFlingStart)
488 return blink::WebInputEventResult::NotHandled; 488 return blink::WebInputEventResult::NotHandled;
489 489
490 return blink::WebInputEventResult::HandledApplication; 490 return blink::WebInputEventResult::HandledApplication;
491 } 491 }
492 492
493 bool BrowserPlugin::handleDragStatusUpdate(blink::WebDragStatus drag_status, 493 bool BrowserPlugin::handleDragStatusUpdate(blink::WebDragStatus drag_status,
494 const blink::WebDragData& drag_data, 494 const blink::WebDragData& drag_data,
495 blink::WebDragOperationsMask mask, 495 blink::WebDragOperationsMask mask,
496 const blink::WebPoint& position, 496 const blink::WebPoint& position,
497 const blink::WebPoint& screen) { 497 const blink::WebPoint& screen) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 620
621 bool BrowserPlugin::HandleMouseLockedInputEvent( 621 bool BrowserPlugin::HandleMouseLockedInputEvent(
622 const blink::WebMouseEvent& event) { 622 const blink::WebMouseEvent& event) {
623 BrowserPluginManager::Get()->Send( 623 BrowserPluginManager::Get()->Send(
624 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, 624 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_,
625 &event)); 625 &event));
626 return true; 626 return true;
627 } 627 }
628 628
629 } // namespace content 629 } // namespace content
OLDNEW
« no previous file with comments | « content/common/input/web_touch_event_traits.cc ('k') | content/renderer/input/input_event_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698