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_WIN_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_WIN_DELEGATE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_WIN_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_WIN_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #if defined(TOOLKIT_USES_GTK) |
| 10 #include <gtk/gtk.h> |
| 11 #elif defined(OS_MACOSX) |
| 12 #import <Cocoa/Cocoa.h> |
| 13 #endif |
| 14 |
9 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
10 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
11 | 17 |
| 18 #if defined(OS_MACOSX) |
| 19 @protocol RenderWidgetHostViewMacDelegate; |
| 20 #endif |
| 21 |
12 namespace gfx { | 22 namespace gfx { |
13 class Size; | 23 class Size; |
14 } | 24 } |
15 | 25 |
16 namespace content { | 26 namespace content { |
17 | 27 |
| 28 class RenderWidgetHost; |
18 class WebDragDestDelegate; | 29 class WebDragDestDelegate; |
19 struct ContextMenuParams; | 30 struct ContextMenuParams; |
20 | 31 |
21 // This interface allows a client to extend the functionality of | 32 // This interface allows a client to extend the functionality of the |
22 // WebContentsViewWin. | 33 // WebContentsView implementation. |
23 class CONTENT_EXPORT WebContentsViewWinDelegate { | 34 class CONTENT_EXPORT WebContentsViewDelegate { |
24 public: | 35 public: |
25 virtual ~WebContentsViewWinDelegate() {} | 36 virtual ~WebContentsViewDelegate() {} |
26 | 37 |
27 // Returns a delegate to process drags not handled by content. | 38 // Returns a delegate to process drags not handled by content. |
28 virtual WebDragDestDelegate* GetDragDestDelegate() = 0; | 39 virtual WebDragDestDelegate* GetDragDestDelegate() = 0; |
29 | 40 |
| 41 // Shows a context menu. |
| 42 virtual void ShowContextMenu(const content::ContextMenuParams& params) = 0; |
| 43 |
| 44 #if defined(OS_WIN) && !defined(USE_AURA) |
30 // These methods allow the embedder to intercept WebContentsViewWin's | 45 // These methods allow the embedder to intercept WebContentsViewWin's |
31 // implementation of these WebContentsView methods. See the WebContentsView | 46 // implementation of these WebContentsView methods. See the WebContentsView |
32 // interface documentation for more information about these methods. | 47 // interface documentation for more information about these methods. |
33 virtual void StoreFocus() = 0; | 48 virtual void StoreFocus() = 0; |
34 virtual void RestoreFocus() = 0; | 49 virtual void RestoreFocus() = 0; |
35 virtual bool Focus() = 0; | 50 virtual bool Focus() = 0; |
36 virtual void TakeFocus(bool reverse) = 0; | 51 virtual void TakeFocus(bool reverse) = 0; |
37 virtual void ShowContextMenu(const content::ContextMenuParams& params) = 0; | |
38 virtual void SizeChanged(const gfx::Size& size) = 0; | 52 virtual void SizeChanged(const gfx::Size& size) = 0; |
| 53 #elif defined(TOOLKIT_USES_GTK) |
| 54 // Initializes the WebContentsViewDelegate. |
| 55 virtual void Initialize(GtkWidget* expanded_container) = 0; |
| 56 |
| 57 // Returns the top widget that contains |view| passed in from WrapView. This |
| 58 // is exposed through TabContentsViewGtk::GetNativeView() when a wrapper is |
| 59 // supplied to a TabContentsViewGtk. |
| 60 virtual gfx::NativeView GetNativeView() const = 0; |
| 61 |
| 62 // Handles a focus event from the renderer process. |
| 63 virtual void Focus() = 0; |
| 64 |
| 65 // Gives the delegate a first chance at focus events from our render widget |
| 66 // host, before the main view invokes its default behaviour. Returns TRUE if |
| 67 // |return_value| has been set and that value should be returned to GTK+. |
| 68 virtual gboolean OnNativeViewFocusEvent(GtkWidget* widget, |
| 69 GtkDirectionType type, |
| 70 gboolean* return_value) = 0; |
| 71 #elif defined(OS_MACOSX) |
| 72 // Returns a newly-created delegate for the RenderWidgetHostViewMac, to handle |
| 73 // events on the responder chain. |
| 74 virtual NSObject<RenderWidgetHostViewMacDelegate>* |
| 75 CreateRenderWidgetHostViewDelegate( |
| 76 RenderWidgetHost* render_widget_host) = 0; |
| 77 |
| 78 // Notifications that the native view was created/destroyed. |
| 79 virtual void NativeViewCreated(NSView* view) = 0; |
| 80 virtual void NativeViewDestroyed(NSView* view) = 0; |
| 81 #endif |
39 }; | 82 }; |
40 | 83 |
41 } // namespace content | 84 } // namespace content |
42 | 85 |
43 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_WIN_DELEGATE_H_ | 86 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_WIN_DELEGATE_H_ |
OLD | NEW |