OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_DELEGATE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_DELEGATE_H_ |
7 | 7 |
8 #if defined(__OBJC__) | 8 #if defined(__OBJC__) |
9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
10 #endif | 10 #endif |
11 | 11 |
| 12 #include "base/callback.h" |
12 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "ui/gfx/geometry/rect.h" |
| 15 #include "ui/gfx/native_widget_types.h" |
13 | 16 |
14 #if defined(__OBJC__) | 17 #if defined(__OBJC__) |
15 @protocol RenderWidgetHostViewMacDelegate; | 18 @protocol RenderWidgetHostViewMacDelegate; |
16 #endif | 19 #endif |
17 | 20 |
18 namespace gfx { | 21 namespace gfx { |
19 class Size; | 22 class Size; |
20 } | 23 } |
21 | 24 |
| 25 namespace ui { |
| 26 class GestureEvent; |
| 27 class MouseEvent; |
| 28 } |
| 29 |
22 namespace content { | 30 namespace content { |
23 class RenderFrameHost; | 31 class RenderFrameHost; |
24 class RenderWidgetHost; | 32 class RenderWidgetHost; |
25 class WebDragDestDelegate; | 33 class WebDragDestDelegate; |
26 struct ContextMenuParams; | 34 struct ContextMenuParams; |
27 | 35 |
28 // This interface allows a client to extend the functionality of the | 36 // This interface allows a client to extend the functionality of the |
29 // WebContentsView implementation. | 37 // WebContentsView implementation. |
30 class CONTENT_EXPORT WebContentsViewDelegate { | 38 class CONTENT_EXPORT WebContentsViewDelegate { |
31 public: | 39 public: |
32 virtual ~WebContentsViewDelegate(); | 40 virtual ~WebContentsViewDelegate(); |
33 | 41 |
34 // Returns a delegate to process drags not handled by content. | 42 // Returns a delegate to process drags not handled by content. |
35 virtual WebDragDestDelegate* GetDragDestDelegate(); | 43 virtual WebDragDestDelegate* GetDragDestDelegate(); |
36 | 44 |
37 // Shows a context menu. | 45 // Shows a context menu. |
38 virtual void ShowContextMenu(RenderFrameHost* render_frame_host, | 46 virtual void ShowContextMenu(RenderFrameHost* render_frame_host, |
39 const ContextMenuParams& params); | 47 const ContextMenuParams& params); |
40 | 48 |
41 // These methods allow the embedder to intercept a WebContentsView's | 49 // These methods allow the embedder to intercept a WebContentsView's |
42 // implementation of these methods. See the WebContentsView interface | 50 // implementation of these methods. See the WebContentsView interface |
43 // documentation for more information about these methods. | 51 // documentation for more information about these methods. |
44 virtual void StoreFocus(); | 52 virtual void StoreFocus(); |
45 virtual void RestoreFocus(); | 53 virtual void RestoreFocus(); |
46 virtual bool Focus(); | 54 virtual bool Focus(); |
47 virtual void TakeFocus(bool reverse); | 55 virtual void TakeFocus(bool reverse); |
48 virtual void SizeChanged(const gfx::Size& size); | 56 virtual void SizeChanged(const gfx::Size& size); |
49 | 57 |
| 58 #if defined(TOOLKIT_VIEWS) |
| 59 // Shows a popup window containing the |zoomed_bitmap| of web content with |
| 60 // more than one link, allowing the user to more easily select which link |
| 61 // they were trying to touch. |target_rect| is the rectangle in DIPs in the |
| 62 // coordinate system of |content| that has been scaled up in |zoomed_bitmap|. |
| 63 // Should the popup receive any gesture events they should be translated back |
| 64 // to the coordinate system of |content| and then provided to the |callback| |
| 65 // for forwarding on to the original scale web content. |
| 66 virtual void ShowDisambiguationPopup( |
| 67 const gfx::Rect& target_rect, |
| 68 const SkBitmap& zoomed_bitmap, |
| 69 const gfx::NativeView content, |
| 70 const base::Callback<void(ui::GestureEvent*)>& gesture_cb, |
| 71 const base::Callback<void(ui::MouseEvent*)>& mouse_cb) = 0; |
| 72 |
| 73 // Hides the link disambiguation popup window if it is showing, otherwise does |
| 74 // nothing. |
| 75 virtual void HideDisambiguationPopup() = 0; |
| 76 #endif |
| 77 |
50 // Returns a newly-created delegate for the RenderWidgetHostViewMac, to handle | 78 // Returns a newly-created delegate for the RenderWidgetHostViewMac, to handle |
51 // events on the responder chain. | 79 // events on the responder chain. |
52 #if defined(__OBJC__) | 80 #if defined(__OBJC__) |
53 virtual NSObject<RenderWidgetHostViewMacDelegate>* | 81 virtual NSObject<RenderWidgetHostViewMacDelegate>* |
54 CreateRenderWidgetHostViewDelegate( | 82 CreateRenderWidgetHostViewDelegate( |
55 RenderWidgetHost* render_widget_host); | 83 RenderWidgetHost* render_widget_host); |
56 #else | 84 #else |
57 virtual void* CreateRenderWidgetHostViewDelegate( | 85 virtual void* CreateRenderWidgetHostViewDelegate( |
58 RenderWidgetHost* render_widget_host); | 86 RenderWidgetHost* render_widget_host); |
59 #endif | 87 #endif |
60 }; | 88 }; |
61 | 89 |
62 } // namespace content | 90 } // namespace content |
63 | 91 |
64 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_DELEGATE_H_ | 92 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_DELEGATE_H_ |
OLD | NEW |