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