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