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

Unified Diff: content/browser/web_contents/web_contents_view_aura.cc

Issue 351683002: Adds link disambiguation popup support to Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: responding to sky's last round of feedback Created 6 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 side-by-side diff with in-line comments
Download patch
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 ecbe02ca04e5d4dd798d5a9a6599dbc6e03229c1..ff16cdb69a8a8b45a1a944a1ad93b39354a24c01 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"
@@ -810,7 +811,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_) {
@@ -988,6 +989,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:
@@ -1269,6 +1286,24 @@ void WebContentsViewAura::TakeFocus(bool reverse) {
}
}
+void WebContentsViewAura::ShowDisambiguationPopup(
+ const gfx::Rect& target_rect,
+ const SkBitmap& zoomed_bitmap) {
+ if (delegate_) {
+ delegate_->ShowDisambiguationPopup(
+ target_rect,
+ zoomed_bitmap,
+ window_.get(),
+ base::Bind(&WebContentsViewAura::ProcessLinkDisambiguationGesture,
+ base::Unretained(this)));
sky 2014/09/11 14:53:43 Why the unretained here? How do you know the popup
luken 2014/09/17 00:00:48 Good point, I don't know one will outlive the othe
+ }
+}
+
+void WebContentsViewAura::HideDisambiguationPopup() {
+ if (delegate_)
+ delegate_->HideDisambiguationPopup();
+}
+
////////////////////////////////////////////////////////////////////////////////
// WebContentsViewAura, OverscrollControllerDelegate implementation:

Powered by Google App Engine
This is Rietveld 408576698