| Index: content/browser/web_contents/web_contents_view_aura.cc
|
| diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
|
| index 63bd454bd6de08cf4dea78aac6a90449c24ed659..85dc8f306d62e6813ab8282c5a7797aeff2654f2 100644
|
| --- a/content/browser/web_contents/web_contents_view_aura.cc
|
| +++ b/content/browser/web_contents/web_contents_view_aura.cc
|
| @@ -19,6 +19,7 @@
|
| #include "content/browser/renderer_host/render_view_host_impl.h"
|
| #include "content/browser/renderer_host/render_widget_host_impl.h"
|
| #include "content/browser/renderer_host/render_widget_host_view_aura.h"
|
| +#include "content/browser/renderer_host/web_input_event_aura.h"
|
| #include "content/browser/web_contents/aura/gesture_nav_simple.h"
|
| #include "content/browser/web_contents/aura/image_window_delegate.h"
|
| #include "content/browser/web_contents/aura/overscroll_navigation_overlay.h"
|
| @@ -45,6 +46,7 @@
|
| #include "net/base/filename_util.h"
|
| #include "third_party/WebKit/public/web/WebInputEvent.h"
|
| #include "ui/aura/client/aura_constants.h"
|
| +#include "ui/aura/client/screen_position_client.h"
|
| #include "ui/aura/client/window_tree_client.h"
|
| #include "ui/aura/env.h"
|
| #include "ui/aura/window.h"
|
| @@ -802,7 +804,7 @@ void WebContentsViewAura::InstallOverscrollControllerDelegate(
|
| void WebContentsViewAura::PrepareOverscrollWindow() {
|
| // If there is an existing |overscroll_window_| which is in the middle of an
|
| // animation, then destroying the window here causes the animation to be
|
| - // completed immidiately, which triggers |OnImplicitAnimationsCompleted()|
|
| + // completed immediately, which triggers |OnImplicitAnimationsCompleted()|
|
| // callback, and that tries to reset |overscroll_window_| again, causing a
|
| // double-free. So use a temporary variable here.
|
| if (overscroll_window_) {
|
| @@ -980,6 +982,22 @@ void WebContentsViewAura::OverscrollUpdateForWebContentsDelegate(int delta_y) {
|
| web_contents_->GetDelegate()->OverscrollUpdate(delta_y);
|
| }
|
|
|
| +void WebContentsViewAura::ProcessLinkDisambiguationGesture(
|
| + ui::GestureEvent* event) {
|
| + blink::WebGestureEvent web_gesture = content::MakeWebGestureEvent(event);
|
| + // If we fail to make a WebGestureEvent that is a Tap from the provided event,
|
| + // don't forward it to Blink.
|
| + if (web_gesture.type < blink::WebInputEvent::Type::GestureTap ||
|
| + web_gesture.type > blink::WebInputEvent::Type::GestureTapCancel)
|
| + return;
|
| +
|
| + RenderWidgetHostViewAura* rwhva = ToRenderWidgetHostViewAura(
|
| + web_contents_->GetRenderWidgetHostView());
|
| + RenderWidgetHostImpl* host = RenderWidgetHostImpl::From(
|
| + rwhva->GetRenderWidgetHost());
|
| + host->ForwardGestureEvent(web_gesture);
|
| +}
|
| +
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // WebContentsViewAura, WebContentsView implementation:
|
|
|
| @@ -1456,6 +1474,28 @@ bool WebContentsViewAura::HasHitTestMask() const {
|
| void WebContentsViewAura::GetHitTestMask(gfx::Path* mask) const {
|
| }
|
|
|
| +void WebContentsViewAura::OnLinkDisambiguationPopupRequested(
|
| + const gfx::Rect& target_rect, const SkBitmap& zoomed_bitmap) {
|
| + // |target_rect| is provided in pixels, not DIPs. So we convert it to DIPs
|
| + // by dividing by the device scale factor.
|
| + gfx::Screen* screen = gfx::Screen::GetScreenFor(window_.get());
|
| + if (!screen) return;
|
| + float device_scale_factor = screen->GetDisplayNearestWindow(
|
| + window_.get()).device_scale_factor();
|
| + gfx::RectF screen_target_rect_f(target_rect);
|
| + screen_target_rect_f.Scale(1.0f / device_scale_factor);
|
| + gfx::Rect screen_target_rect(gfx::ToEnclosingRect(screen_target_rect_f));
|
| +
|
| + if (delegate_) {
|
| + delegate_->ShowLinkDisambiguationPopup(
|
| + screen_target_rect,
|
| + zoomed_bitmap,
|
| + window_.get(),
|
| + base::Bind(&WebContentsViewAura::ProcessLinkDisambiguationGesture,
|
| + base::Unretained(this)));
|
| + }
|
| +}
|
| +
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // WebContentsViewAura, ui::EventHandler implementation:
|
|
|
|
|