Index: chrome/browser/ui/views/link_disambiguation/link_disambiguation_popup.h |
diff --git a/chrome/browser/ui/views/link_disambiguation/link_disambiguation_popup.h b/chrome/browser/ui/views/link_disambiguation/link_disambiguation_popup.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..08d01ce3357e1620d05b7d566452960a60d39659 |
--- /dev/null |
+++ b/chrome/browser/ui/views/link_disambiguation/link_disambiguation_popup.h |
@@ -0,0 +1,51 @@ |
+// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_UI_VIEWS_LINK_DISAMBIGUATION_LINK_DISAMBIGUATION_POPUP_H_ |
+#define CHROME_BROWSER_UI_VIEWS_LINK_DISAMBIGUATION_LINK_DISAMBIGUATION_POPUP_H_ |
+ |
+#include "base/callback_forward.h" |
+#include "content/public/browser/web_contents_view_delegate.h" |
+#include "ui/gfx/geometry/rect.h" |
+#include "ui/gfx/image/image.h" |
+ |
+namespace aura { |
+class Window; |
+} |
+ |
+// Creates a popup with a zoomed bitmap rendered by Blink of an area in web |
+// |content| that received an ambiguous Gesture event. This allows the user to |
+// select which of the links their first Gesture event overlapped. The popup |
+// generates a new Gesture event which is sent back to the provided |callback|. |
+class LinkDisambiguationPopup { |
+ public: |
+ explicit LinkDisambiguationPopup(); |
sky
2014/07/30 21:50:36
nit: no explicit
luken
2014/07/31 01:41:47
Done.
|
+ ~LinkDisambiguationPopup(); |
+ |
+ // Creates and shows the Popup. |zoomed_bitmap| is the scaled-up image of the |
+ // ambiguous web content. |target_rect| is the original, unzoomed rectangle |
+ // in DIPs in the coordinate system of |content|. We will convert received |
+ // gestures in the popup to the coordinate system of |content| and as an |
+ // offset within |target_rect|, and then call the |callback| with the |
+ // transformed coordinates GestureEvent. |
+ void Show(const SkBitmap& zoomed_bitmap, |
+ const gfx::Rect& target_rect, |
sky
2014/07/30 21:50:37
Might target_rect change while the popup is up? Wh
luken
2014/07/31 01:41:47
You are correct, good catch, |target_rect| does ch
sky
2014/07/31 15:37:40
Certainly the popup will close if the users touche
|
+ const gfx::NativeView content, |
+ content::WebContentsViewDelegate::GestureCallback callback); |
sky
2014/07/30 21:50:37
const &?
luken
2014/07/31 01:41:47
Done.
|
+ void Close(); |
+ |
+ private: |
+ class ZoomBubbleView; |
+ |
+ // It is possible that |view_| can be destroyed by its widget instead of |
+ // closed explicitly by us. In that case we need to be notified that it has |
+ // been destroyed so we can invalidate our own pointer to that view. |
+ void InvalidateBubbleView(); |
+ |
+ const aura::Window* content_; |
+ ZoomBubbleView* view_; |
+ gfx::Image zoomed_image_; |
+}; |
sky
2014/07/30 21:50:36
DISALLOW_...
luken
2014/07/31 01:41:47
Done.
|
+ |
+#endif // CHROME_BROWSER_UI_VIEWS_LINK_DISAMBIGUATION_LINK_DISAMBIGUATION_POPUP_H_ |