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_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_VIEW_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_VIEW_H_
10 #include "base/basictypes.h"
11 #include "base/callback.h"
12 #include "content/common/content_export.h"
13 #include "content/common/drag_event_source_info.h"
14 #include "third_party/WebKit/public/web/WebDragOperation.h"
30 class RenderFrameHost
;
31 struct ContextMenuParams
;
35 // This class provides a way for the RenderViewHost to reach out to its
36 // delegate's view. It only needs to be implemented by embedders if they don't
37 // use the default WebContentsView implementations.
38 class CONTENT_EXPORT RenderViewHostDelegateView
{
40 // A context menu should be shown, to be built using the context information
41 // provided in the supplied params.
42 virtual void ShowContextMenu(RenderFrameHost
* render_frame_host
,
43 const ContextMenuParams
& params
) {}
45 // The user started dragging content of the specified type within the
46 // RenderView. Contextual information about the dragged content is supplied
47 // by DropData. If the delegate's view cannot start the drag for /any/
48 // reason, it must inform the renderer that the drag has ended; otherwise,
49 // this results in bugs like http://crbug.com/157134.
50 virtual void StartDragging(const DropData
& drop_data
,
51 blink::WebDragOperationsMask allowed_ops
,
52 const gfx::ImageSkia
& image
,
53 const gfx::Vector2d
& image_offset
,
54 const DragEventSourceInfo
& event_info
) {}
56 // The page wants to update the mouse cursor during a drag & drop operation.
57 // |operation| describes the current operation (none, move, copy, link.)
58 virtual void UpdateDragCursor(blink::WebDragOperation operation
) {}
60 // Notification that view for this delegate got the focus.
61 virtual void GotFocus() {}
63 // Callback to inform the browser that the page is returning the focus to
64 // the browser's chrome. If reverse is true, it means the focus was
65 // retrieved by doing a Shift-Tab.
66 virtual void TakeFocus(bool reverse
) {}
68 #if defined(OS_MACOSX) || defined(OS_ANDROID)
69 // Shows a popup menu with the specified items.
70 // This method should call RenderFrameHost::DidSelectPopupMenuItem[s]() or
71 // RenderFrameHost::DidCancelPopupMenu() based on the user action.
72 virtual void ShowPopupMenu(RenderFrameHost
* render_frame_host
,
73 const gfx::Rect
& bounds
,
75 double item_font_size
,
77 const std::vector
<MenuItem
>& items
,
79 bool allow_multiple_selection
) {};
81 // Hides a popup menu opened by ShowPopupMenu().
82 virtual void HidePopupMenu() {};
85 #if defined(TOOLKIT_VIEWS) || defined(USE_AURA)
86 // Shows a Link Disambiguation Popup. |target_rect| is the area the user
87 // touched that resulted in ambiguity, in DIPs in the host's coordinate
88 // system, |zoomed_bitmap| is an enlarged image of that |target_rect|, and
89 // |callback| is for forwarding on to the original scale web content.
90 virtual void ShowDisambiguationPopup(
91 const gfx::Rect
& target_rect
,
92 const SkBitmap
& zoomed_bitmap
,
93 const base::Callback
<void(ui::GestureEvent
*)>& gesture_cb
,
94 const base::Callback
<void(ui::MouseEvent
*)>& mouse_cb
) {}
96 // Hides the Link Disambiguation Popup, if it was showing, otherwise does
98 virtual void HideDisambiguationPopup() {}
102 virtual ~RenderViewHostDelegateView() {}
105 } // namespace content
107 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_VIEW_H_