OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_VIEWS_LINK_DISAMBIGUATION_LINK_DISAMBIGUATION_POPUP_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_LINK_DISAMBIGUATION_LINK_DISAMBIGUATION_POPUP_H_ | |
7 | |
8 #include "base/callback_forward.h" | |
9 #include "content/public/browser/web_contents_view_delegate.h" | |
10 #include "ui/gfx/geometry/rect.h" | |
11 | |
12 namespace aura { | |
13 class Window; | |
14 } | |
15 | |
16 // Creates a popup with a zoomed bitmap rendered by Blink of an area in web | |
17 // |content| that received an ambiguous Gesture event. This allows the user to | |
18 // select which of the links their first Gesture event overlapped. The popup | |
19 // generates a new Gesture event which is sent back to the provided |callback|. | |
20 class LinkDisambiguationPopup { | |
21 public: | |
22 LinkDisambiguationPopup(); | |
23 ~LinkDisambiguationPopup(); | |
24 | |
25 // Creates and shows the Popup. |zoomed_bitmap| is the scaled-up image of the | |
26 // ambiguous web content. |target_rect| is the original, unzoomed rectangle | |
27 // in DIPs in the coordinate system of |content|. We will convert received | |
28 // gestures in the popup to the coordinate system of |content| and as an | |
29 // offset within |target_rect|, and then call the |callback| with the | |
30 // transformed coordinates GestureEvent. | |
31 void Show(const SkBitmap& zoomed_bitmap, | |
32 const gfx::Rect& target_rect, | |
33 const gfx::NativeView content, | |
34 const content::WebContentsViewDelegate::GestureCallback& callback); | |
35 void Close(); | |
36 | |
37 private: | |
38 class ZoomBubbleView; | |
39 | |
40 // It is possible that |view_| can be destroyed by its widget instead of | |
41 // closed explicitly by us. In that case we need to be notified that it has | |
42 // been destroyed so we can invalidate our own pointer to that view. | |
43 void InvalidateBubbleView(); | |
44 | |
45 const aura::Window* content_; | |
sky
2014/08/04 20:05:19
Add description.
luken
2014/09/11 01:07:26
Done.
| |
46 ZoomBubbleView* view_; | |
47 | |
48 DISALLOW_COPY_AND_ASSIGN(LinkDisambiguationPopup); | |
49 }; | |
50 | |
51 #endif // CHROME_BROWSER_UI_VIEWS_LINK_DISAMBIGUATION_LINK_DISAMBIGUATION_POPUP _H_ | |
OLD | NEW |