Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / content / public / browser / web_contents_view_delegate.h
blob75ded748ba33aff3a1148749f3de2d8e3f5e1d85
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_DELEGATE_H_
6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_DELEGATE_H_
8 #if defined(__OBJC__)
9 #import <Cocoa/Cocoa.h>
10 #endif
12 #include "base/callback_forward.h"
13 #include "content/common/content_export.h"
14 #include "ui/gfx/native_widget_types.h"
16 #if defined(__OBJC__)
17 @protocol RenderWidgetHostViewMacDelegate;
18 #endif
20 namespace gfx {
21 class Rect;
22 class Size;
25 namespace ui {
26 class GestureEvent;
27 class MouseEvent;
30 namespace content {
31 class RenderFrameHost;
32 class RenderWidgetHost;
33 class WebDragDestDelegate;
34 struct ContextMenuParams;
36 // This interface allows a client to extend the functionality of the
37 // WebContentsView implementation.
38 class CONTENT_EXPORT WebContentsViewDelegate {
39 public:
40 virtual ~WebContentsViewDelegate();
42 // Returns the native window containing the WebContents, or nullptr if the
43 // WebContents is not in any window.
44 virtual gfx::NativeWindow GetNativeWindow();
46 // Returns a delegate to process drags not handled by content.
47 virtual WebDragDestDelegate* GetDragDestDelegate();
49 // Shows a context menu.
50 virtual void ShowContextMenu(RenderFrameHost* render_frame_host,
51 const ContextMenuParams& params);
53 // These methods allow the embedder to intercept a WebContentsView's
54 // implementation of these methods. See the WebContentsView interface
55 // documentation for more information about these methods.
56 virtual void StoreFocus();
57 virtual void RestoreFocus();
58 virtual bool Focus();
59 virtual void TakeFocus(bool reverse);
60 virtual void SizeChanged(const gfx::Size& size);
62 // Shows a popup window containing the |zoomed_bitmap| of web content with
63 // more than one link, allowing the user to more easily select which link
64 // they were trying to touch. |target_rect| is the rectangle in DIPs in the
65 // coordinate system of |content| that has been scaled up in |zoomed_bitmap|.
66 // Should the popup receive any gesture events they should be translated back
67 // to the coordinate system of |content| and then provided to the |callback|
68 // for forwarding on to the original scale web content.
69 virtual void ShowDisambiguationPopup(
70 const gfx::Rect& target_rect,
71 const SkBitmap& zoomed_bitmap,
72 const gfx::NativeView content,
73 const base::Callback<void(ui::GestureEvent*)>& gesture_cb,
74 const base::Callback<void(ui::MouseEvent*)>& mouse_cb);
76 // Hides the link disambiguation popup window if it is showing, otherwise does
77 // nothing.
78 virtual void HideDisambiguationPopup();
80 // Returns a newly-created delegate for the RenderWidgetHostViewMac, to handle
81 // events on the responder chain.
82 #if defined(__OBJC__)
83 virtual NSObject<RenderWidgetHostViewMacDelegate>*
84 CreateRenderWidgetHostViewDelegate(
85 RenderWidgetHost* render_widget_host);
86 #else
87 virtual void* CreateRenderWidgetHostViewDelegate(
88 RenderWidgetHost* render_widget_host);
89 #endif
92 } // namespace content
94 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_DELEGATE_H_