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

Side by Side Diff: content/browser/frame_host/render_widget_host_view_guest.cc

Issue 1293963002: Fixing the Position of Context Menu for BrowserPlugin (<webview>) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed a Build Error in MAC Created 5 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/bind_helpers.h" 5 #include "base/bind_helpers.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "cc/surfaces/surface.h" 9 #include "cc/surfaces/surface.h"
10 #include "cc/surfaces/surface_factory.h" 10 #include "cc/surfaces/surface_factory.h"
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 return static_cast<RenderWidgetHostViewBase*>( 630 return static_cast<RenderWidgetHostViewBase*>(
631 guest_->GetOwnerRenderWidgetHostView()); 631 guest_->GetOwnerRenderWidgetHostView());
632 } 632 }
633 633
634 void RenderWidgetHostViewGuest::OnHandleInputEvent( 634 void RenderWidgetHostViewGuest::OnHandleInputEvent(
635 RenderWidgetHostImpl* embedder, 635 RenderWidgetHostImpl* embedder,
636 int browser_plugin_instance_id, 636 int browser_plugin_instance_id,
637 const gfx::Rect& guest_window_rect, 637 const gfx::Rect& guest_window_rect,
638 const blink::WebInputEvent* event) { 638 const blink::WebInputEvent* event) {
639 if (blink::WebInputEvent::isMouseEventType(event->type)) { 639 if (blink::WebInputEvent::isMouseEventType(event->type)) {
640 host_->ForwardMouseEvent( 640 // The mouse events for BrowserPlugin are modified by all
641 *static_cast<const blink::WebMouseEvent*>(event)); 641 // the CSS transforms applied on the <object> and embedder. As a result of
642 // this, the coordinates passed on to the guest renderer are potentially
643 // incorrect to determine the position of the context menu(they are not the
644 // actual X, Y of the window). As a hack, we report the last location of a
645 // right mouse up to the BrowserPluginGuest to inform it of the next
646 // potential location for context menu (BUG=470087).
647 // TODO(ekaramad): Find a better and more fundamental solution. Could the
648 // ContextMenuParams be based on global X, Y?
649 const blink::WebMouseEvent& mouse_event =
650 static_cast<const blink::WebMouseEvent&>(*event);
651 // A MouseDown on the ButtonRight could suggest a ContextMenu.
652 if (guest_ && mouse_event.type == blink::WebInputEvent::MouseDown &&
653 mouse_event.button == blink::WebPointerProperties::ButtonRight)
654 guest_->SetContextMenuPosition(
655 gfx::Point(mouse_event.globalX - GetViewBounds().x(),
656 mouse_event.globalY - GetViewBounds().y()));
657 host_->ForwardMouseEvent(mouse_event);
642 return; 658 return;
643 } 659 }
644 660
645 if (event->type == blink::WebInputEvent::MouseWheel) { 661 if (event->type == blink::WebInputEvent::MouseWheel) {
646 host_->ForwardWheelEvent( 662 host_->ForwardWheelEvent(
647 *static_cast<const blink::WebMouseWheelEvent*>(event)); 663 *static_cast<const blink::WebMouseWheelEvent*>(event));
648 return; 664 return;
649 } 665 }
650 666
651 if (blink::WebInputEvent::isKeyboardEventType(event->type)) { 667 if (blink::WebInputEvent::isKeyboardEventType(event->type)) {
(...skipping 17 matching lines...) Expand all
669 } 685 }
670 686
671 if (blink::WebInputEvent::isGestureEventType(event->type)) { 687 if (blink::WebInputEvent::isGestureEventType(event->type)) {
672 host_->ForwardGestureEvent( 688 host_->ForwardGestureEvent(
673 *static_cast<const blink::WebGestureEvent*>(event)); 689 *static_cast<const blink::WebGestureEvent*>(event));
674 return; 690 return;
675 } 691 }
676 } 692 }
677 693
678 } // namespace content 694 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.cc ('k') | content/public/browser/browser_plugin_guest_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698