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_PORT_BROWSER_RENDER_VIEW_HOST_DELEGATE_VIEW_H_
6 #define CONTENT_PORT_BROWSER_RENDER_VIEW_HOST_DELEGATE_VIEW_H_
10 #include "base/basictypes.h"
11 #include "content/common/content_export.h"
12 #include "content/common/drag_event_source_info.h"
13 #include "third_party/WebKit/public/web/WebDragOperation.h"
24 class RenderFrameHost
;
25 struct ContextMenuParams
;
29 // This class provides a way for the RenderViewHost to reach out to its
30 // delegate's view. It only needs to be implemented by embedders if they don't
31 // use the default WebContentsView implementations.
32 class CONTENT_EXPORT RenderViewHostDelegateView
{
34 // A context menu should be shown, to be built using the context information
35 // provided in the supplied params.
36 virtual void ShowContextMenu(RenderFrameHost
* render_frame_host
,
37 const ContextMenuParams
& params
) {}
39 // Shows a popup menu with the specified items.
40 // This method should call RenderViewHost::DidSelectPopupMenuItem[s]() or
41 // RenderViewHost::DidCancelPopupMenu() based on the user action.
42 virtual void ShowPopupMenu(const gfx::Rect
& bounds
,
44 double item_font_size
,
46 const std::vector
<MenuItem
>& items
,
48 bool allow_multiple_selection
) = 0;
50 // The user started dragging content of the specified type within the
51 // RenderView. Contextual information about the dragged content is supplied
52 // by DropData. If the delegate's view cannot start the drag for /any/
53 // reason, it must inform the renderer that the drag has ended; otherwise,
54 // this results in bugs like http://crbug.com/157134.
55 virtual void StartDragging(const DropData
& drop_data
,
56 blink::WebDragOperationsMask allowed_ops
,
57 const gfx::ImageSkia
& image
,
58 const gfx::Vector2d
& image_offset
,
59 const DragEventSourceInfo
& event_info
) {}
61 // The page wants to update the mouse cursor during a drag & drop operation.
62 // |operation| describes the current operation (none, move, copy, link.)
63 virtual void UpdateDragCursor(blink::WebDragOperation operation
) {}
65 // Notification that view for this delegate got the focus.
66 virtual void GotFocus() {}
68 // Callback to inform the browser that the page is returning the focus to
69 // the browser's chrome. If reverse is true, it means the focus was
70 // retrieved by doing a Shift-Tab.
71 virtual void TakeFocus(bool reverse
) {}
74 virtual ~RenderViewHostDelegateView() {}
77 } // namespace content
79 #endif // CONTENT_PORT_BROWSER_RENDER_VIEW_HOST_DELEGATE_VIEW_H_