| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef CHROME_BROWSER_UI_VIEWS_LINK_DISAMBIGUATION_LINK_DISAMBIGUATION_POPUP_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_LINK_DISAMBIGUATION_LINK_DISAMBIGUATION_POPUP_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_LINK_DISAMBIGUATION_LINK_DISAMBIGUATION_POPUP_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_LINK_DISAMBIGUATION_LINK_DISAMBIGUATION_POPUP_H_ |
| 7 | 7 |
| 8 #include "content/public/browser/web_contents_view_delegate.h" | 8 #include "content/public/browser/web_contents_view_delegate.h" |
| 9 #include "ui/gfx/geometry/rect.h" | 9 #include "ui/gfx/geometry/rect.h" |
| 10 #include "ui/views/widget/widget.h" |
| 10 | 11 |
| 11 namespace aura { | 12 namespace aura { |
| 12 class Window; | 13 class Window; |
| 13 } | 14 } |
| 14 | 15 |
| 15 namespace ui { | 16 namespace ui { |
| 16 class MouseEvent; | 17 class MouseEvent; |
| 17 } | 18 } |
| 18 | 19 |
| 19 // Creates a popup with a zoomed bitmap rendered by Blink of an area in web | 20 // Creates a popup with a zoomed bitmap rendered by Blink of an area in web |
| 20 // |content| that received an ambiguous Gesture event. This allows the user to | 21 // |content| that received an ambiguous Gesture event. This allows the user to |
| 21 // select which of the links their first Gesture event overlapped. The popup | 22 // select which of the links their first Gesture event overlapped. The popup |
| 22 // generates a new Gesture event which is sent back to the provided |callback|. | 23 // generates a new Gesture event which is sent back to the provided |callback|. |
| 23 class LinkDisambiguationPopup { | 24 class LinkDisambiguationPopup { |
| 24 public: | 25 public: |
| 25 LinkDisambiguationPopup(); | 26 LinkDisambiguationPopup(); |
| 26 ~LinkDisambiguationPopup(); | 27 ~LinkDisambiguationPopup(); |
| 27 | 28 |
| 28 // Creates and shows the Popup. |zoomed_bitmap| is the scaled-up image of the | 29 // Creates and shows the Popup. |top_level_widget| is the active widget. |
| 29 // ambiguous web content. |target_rect| is the original, unzoomed rectangle | 30 // |zoomed_bitmap| is the scaled-up image of the ambiguous web content. |
| 30 // in DIPs in the coordinate system of |content|. We will convert received | 31 // |target_rect| is the original, unzoomed rectangle in DIPs in the |
| 32 // coordinate system of |content|. We will convert received |
| 31 // gestures in the popup to the coordinate system of |content| and as an | 33 // gestures in the popup to the coordinate system of |content| and as an |
| 32 // offset within |target_rect|, and then call the |callback| with the | 34 // offset within |target_rect|, and then call the |callback| with the |
| 33 // transformed coordinates GestureEvent. | 35 // transformed coordinates GestureEvent. |
| 34 void Show(const SkBitmap& zoomed_bitmap, | 36 void Show(views::Widget* top_level_widget, |
| 37 const SkBitmap& zoomed_bitmap, |
| 35 const gfx::Rect& target_rect, | 38 const gfx::Rect& target_rect, |
| 36 const gfx::NativeView content, | 39 const gfx::NativeView content, |
| 37 const base::Callback<void(ui::GestureEvent*)>& gesture_cb, | 40 const base::Callback<void(ui::GestureEvent*)>& gesture_cb, |
| 38 const base::Callback<void(ui::MouseEvent*)>& mouse_cb); | 41 const base::Callback<void(ui::MouseEvent*)>& mouse_cb); |
| 39 void Close(); | 42 void Close(); |
| 40 | 43 |
| 41 private: | 44 private: |
| 42 class ZoomBubbleView; | 45 class ZoomBubbleView; |
| 43 | 46 |
| 44 // It is possible that |view_| can be destroyed by its widget instead of | 47 // It is possible that |view_| can be destroyed by its widget instead of |
| 45 // closed explicitly by us. In that case we need to be notified that it has | 48 // closed explicitly by us. In that case we need to be notified that it has |
| 46 // been destroyed so we can invalidate our own pointer to that view. | 49 // been destroyed so we can invalidate our own pointer to that view. |
| 47 void InvalidateBubbleView(); | 50 void InvalidateBubbleView(); |
| 48 | 51 |
| 49 // A non-owning pointer to the calling window that contains the unzoomed web | 52 // A non-owning pointer to the calling window that contains the unzoomed web |
| 50 // content bitmap, that we will be sending the GestureEvents received back to. | 53 // content bitmap, that we will be sending the GestureEvents received back to. |
| 51 const aura::Window* content_; | 54 const aura::Window* content_; |
| 52 ZoomBubbleView* view_; | 55 ZoomBubbleView* view_; |
| 53 | 56 |
| 54 DISALLOW_COPY_AND_ASSIGN(LinkDisambiguationPopup); | 57 DISALLOW_COPY_AND_ASSIGN(LinkDisambiguationPopup); |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 #endif // CHROME_BROWSER_UI_VIEWS_LINK_DISAMBIGUATION_LINK_DISAMBIGUATION_POPUP
_H_ | 60 #endif // CHROME_BROWSER_UI_VIEWS_LINK_DISAMBIGUATION_LINK_DISAMBIGUATION_POPUP
_H_ |
| OLD | NEW |