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