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 "base/callback_forward.h" |
13 #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" | 14 #include "ui/gfx/native_widget_types.h" |
16 | 15 |
17 #if defined(__OBJC__) | 16 #if defined(__OBJC__) |
18 @protocol RenderWidgetHostViewMacDelegate; | 17 @protocol RenderWidgetHostViewMacDelegate; |
19 #endif | 18 #endif |
20 | 19 |
21 namespace gfx { | 20 namespace gfx { |
| 21 class Rect; |
22 class Size; | 22 class Size; |
23 } | 23 } |
24 | 24 |
25 namespace ui { | 25 namespace ui { |
26 class GestureEvent; | 26 class GestureEvent; |
27 class MouseEvent; | 27 class MouseEvent; |
28 } | 28 } |
29 | 29 |
30 namespace content { | 30 namespace content { |
31 class RenderFrameHost; | 31 class RenderFrameHost; |
(...skipping 16 matching lines...) Expand all Loading... |
48 | 48 |
49 // These methods allow the embedder to intercept a WebContentsView's | 49 // These methods allow the embedder to intercept a WebContentsView's |
50 // implementation of these methods. See the WebContentsView interface | 50 // implementation of these methods. See the WebContentsView interface |
51 // documentation for more information about these methods. | 51 // documentation for more information about these methods. |
52 virtual void StoreFocus(); | 52 virtual void StoreFocus(); |
53 virtual void RestoreFocus(); | 53 virtual void RestoreFocus(); |
54 virtual bool Focus(); | 54 virtual bool Focus(); |
55 virtual void TakeFocus(bool reverse); | 55 virtual void TakeFocus(bool reverse); |
56 virtual void SizeChanged(const gfx::Size& size); | 56 virtual void SizeChanged(const gfx::Size& size); |
57 | 57 |
58 #if defined(TOOLKIT_VIEWS) || defined(USE_AURA) | |
59 // Shows a popup window containing the |zoomed_bitmap| of web content with | 58 // 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 | 59 // 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 | 60 // 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|. | 61 // 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 | 62 // 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| | 63 // to the coordinate system of |content| and then provided to the |callback| |
65 // for forwarding on to the original scale web content. | 64 // for forwarding on to the original scale web content. |
66 virtual void ShowDisambiguationPopup( | 65 virtual void ShowDisambiguationPopup( |
67 const gfx::Rect& target_rect, | 66 const gfx::Rect& target_rect, |
68 const SkBitmap& zoomed_bitmap, | 67 const SkBitmap& zoomed_bitmap, |
69 const gfx::NativeView content, | 68 const gfx::NativeView content, |
70 const base::Callback<void(ui::GestureEvent*)>& gesture_cb, | 69 const base::Callback<void(ui::GestureEvent*)>& gesture_cb, |
71 const base::Callback<void(ui::MouseEvent*)>& mouse_cb) = 0; | 70 const base::Callback<void(ui::MouseEvent*)>& mouse_cb); |
72 | 71 |
73 // Hides the link disambiguation popup window if it is showing, otherwise does | 72 // Hides the link disambiguation popup window if it is showing, otherwise does |
74 // nothing. | 73 // nothing. |
75 virtual void HideDisambiguationPopup() = 0; | 74 virtual void HideDisambiguationPopup(); |
76 #endif | |
77 | 75 |
78 // Returns a newly-created delegate for the RenderWidgetHostViewMac, to handle | 76 // Returns a newly-created delegate for the RenderWidgetHostViewMac, to handle |
79 // events on the responder chain. | 77 // events on the responder chain. |
80 #if defined(__OBJC__) | 78 #if defined(__OBJC__) |
81 virtual NSObject<RenderWidgetHostViewMacDelegate>* | 79 virtual NSObject<RenderWidgetHostViewMacDelegate>* |
82 CreateRenderWidgetHostViewDelegate( | 80 CreateRenderWidgetHostViewDelegate( |
83 RenderWidgetHost* render_widget_host); | 81 RenderWidgetHost* render_widget_host); |
84 #else | 82 #else |
85 virtual void* CreateRenderWidgetHostViewDelegate( | 83 virtual void* CreateRenderWidgetHostViewDelegate( |
86 RenderWidgetHost* render_widget_host); | 84 RenderWidgetHost* render_widget_host); |
87 #endif | 85 #endif |
88 }; | 86 }; |
89 | 87 |
90 } // namespace content | 88 } // namespace content |
91 | 89 |
92 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_DELEGATE_H_ | 90 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_DELEGATE_H_ |
OLD | NEW |