Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: content/public/browser/web_contents_view_delegate.h

Issue 2026813003: Enable external popup menu in Blimp, part 2/2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/public/browser/render_frame_host.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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) && defined(USE_AURA)
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_
OLDNEW
« no previous file with comments | « content/public/browser/render_frame_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698