Chromium Code Reviews| 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 <vector> | |
| 13 | |
| 12 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
| 13 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
| 15 | 17 |
| 16 #if defined(__OBJC__) | 18 #if defined(__OBJC__) |
| 17 @protocol RenderWidgetHostViewMacDelegate; | 19 @protocol RenderWidgetHostViewMacDelegate; |
| 18 #endif | 20 #endif |
| 19 | 21 |
| 20 namespace gfx { | 22 namespace gfx { |
| 21 class Rect; | 23 class Rect; |
| 22 class Size; | 24 class Size; |
| 23 } | 25 } |
| 24 | 26 |
| 25 namespace ui { | 27 namespace ui { |
| 26 class GestureEvent; | 28 class GestureEvent; |
| 27 class MouseEvent; | 29 class MouseEvent; |
| 28 } | 30 } |
| 29 | 31 |
| 30 namespace content { | 32 namespace content { |
| 31 class RenderFrameHost; | 33 class RenderFrameHost; |
| 32 class RenderWidgetHost; | 34 class RenderWidgetHost; |
| 33 class WebDragDestDelegate; | 35 class WebDragDestDelegate; |
| 34 struct ContextMenuParams; | 36 struct ContextMenuParams; |
| 37 struct MenuItem; | |
| 35 | 38 |
| 36 // This interface allows a client to extend the functionality of the | 39 // This interface allows a client to extend the functionality of the |
| 37 // WebContentsView implementation. | 40 // WebContentsView implementation. |
| 38 class CONTENT_EXPORT WebContentsViewDelegate { | 41 class CONTENT_EXPORT WebContentsViewDelegate { |
| 39 public: | 42 public: |
| 40 virtual ~WebContentsViewDelegate(); | 43 virtual ~WebContentsViewDelegate(); |
| 41 | 44 |
| 42 // Returns the native window containing the WebContents, or nullptr if the | 45 // Returns the native window containing the WebContents, or nullptr if the |
| 43 // WebContents is not in any window. | 46 // WebContents is not in any window. |
| 44 virtual gfx::NativeWindow GetNativeWindow(); | 47 virtual gfx::NativeWindow GetNativeWindow(); |
| 45 | 48 |
| 46 // Returns a delegate to process drags not handled by content. | 49 // Returns a delegate to process drags not handled by content. |
| 47 virtual WebDragDestDelegate* GetDragDestDelegate(); | 50 virtual WebDragDestDelegate* GetDragDestDelegate(); |
| 48 | 51 |
| 49 // Shows a context menu. | 52 // Shows a context menu. |
| 50 virtual void ShowContextMenu(RenderFrameHost* render_frame_host, | 53 virtual void ShowContextMenu(RenderFrameHost* render_frame_host, |
| 51 const ContextMenuParams& params); | 54 const ContextMenuParams& params); |
| 52 | 55 |
| 53 // These methods allow the embedder to intercept a WebContentsView's | 56 // These methods allow the embedder to intercept a WebContentsView's |
| 54 // implementation of these methods. See the WebContentsView interface | 57 // implementation of these methods. See the WebContentsView interface |
| 55 // documentation for more information about these methods. | 58 // documentation for more information about these methods. |
| 56 virtual void StoreFocus(); | 59 virtual void StoreFocus(); |
| 57 virtual void RestoreFocus(); | 60 virtual void RestoreFocus(); |
| 58 virtual bool Focus(); | 61 virtual bool Focus(); |
| 59 virtual void TakeFocus(bool reverse); | 62 virtual void TakeFocus(bool reverse); |
| 60 virtual void SizeChanged(const gfx::Size& size); | 63 virtual void SizeChanged(const gfx::Size& size); |
| 61 | 64 |
| 62 // Returns a newly-created delegate for the RenderWidgetHostViewMac, to handle | 65 #if defined(USE_EXTERNAL_POPUP_MENU) |
|
Avi (use Gerrit)
2016/06/03 20:57:48
&& USE(AURA)
or whatever the ifdef there is.
haibinlu
2016/06/03 21:36:09
Done.
| |
| 63 // events on the responder chain. | 66 // Shows a popup menu with the specified items. |
| 67 // This method should call RenderFrameHost::DidSelectPopupMenuItem[s]() or | |
| 68 // RenderFrameHost::DidCancelPopupMenu() based on the user action. | |
| 69 virtual void ShowPopupMenu(RenderFrameHost* render_frame_host, | |
| 70 const gfx::Rect& bounds, | |
| 71 int item_height, | |
| 72 double item_font_size, | |
| 73 int selected_item, | |
| 74 const std::vector<MenuItem>& items, | |
| 75 bool right_aligned, | |
| 76 bool allow_multiple_selection) {} | |
| 77 | |
| 78 // Hides a popup menu opened by ShowPopupMenu(). | |
| 79 virtual void HidePopupMenu() {} | |
| 80 #endif | |
| 81 | |
| 82 // Returns a newly-created delegate for the RenderWidgetHostViewMac, to handle | |
| 83 // events on the responder chain. | |
| 64 #if defined(__OBJC__) | 84 #if defined(__OBJC__) |
| 65 virtual NSObject<RenderWidgetHostViewMacDelegate>* | 85 virtual NSObject<RenderWidgetHostViewMacDelegate>* |
| 66 CreateRenderWidgetHostViewDelegate( | 86 CreateRenderWidgetHostViewDelegate( |
| 67 RenderWidgetHost* render_widget_host); | 87 RenderWidgetHost* render_widget_host); |
| 68 #else | 88 #else |
| 69 virtual void* CreateRenderWidgetHostViewDelegate( | 89 virtual void* CreateRenderWidgetHostViewDelegate( |
| 70 RenderWidgetHost* render_widget_host); | 90 RenderWidgetHost* render_widget_host); |
| 71 #endif | 91 #endif |
| 72 }; | 92 }; |
| 73 | 93 |
| 74 } // namespace content | 94 } // namespace content |
| 75 | 95 |
| 76 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_DELEGATE_H_ | 96 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_DELEGATE_H_ |
| OLD | NEW |