| 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_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_VIEW_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_VIEW_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_VIEW_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_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" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 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(RenderFrameHost* render_frame_host, | 36 virtual void ShowContextMenu(RenderFrameHost* render_frame_host, |
| 37 const ContextMenuParams& params) {} | 37 const ContextMenuParams& params) {} |
| 38 | 38 |
| 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, | |
| 43 int item_height, | |
| 44 double item_font_size, | |
| 45 int selected_item, | |
| 46 const std::vector<MenuItem>& items, | |
| 47 bool right_aligned, | |
| 48 bool allow_multiple_selection) {}; | |
| 49 | |
| 50 // Hides a popup menu opened by ShowPopupMenu(). | |
| 51 virtual void HidePopupMenu() {}; | |
| 52 | |
| 53 // The user started dragging content of the specified type within the | 39 // The user started dragging content of the specified type within the |
| 54 // RenderView. Contextual information about the dragged content is supplied | 40 // RenderView. Contextual information about the dragged content is supplied |
| 55 // by DropData. If the delegate's view cannot start the drag for /any/ | 41 // by DropData. If the delegate's view cannot start the drag for /any/ |
| 56 // reason, it must inform the renderer that the drag has ended; otherwise, | 42 // reason, it must inform the renderer that the drag has ended; otherwise, |
| 57 // this results in bugs like http://crbug.com/157134. | 43 // this results in bugs like http://crbug.com/157134. |
| 58 virtual void StartDragging(const DropData& drop_data, | 44 virtual void StartDragging(const DropData& drop_data, |
| 59 blink::WebDragOperationsMask allowed_ops, | 45 blink::WebDragOperationsMask allowed_ops, |
| 60 const gfx::ImageSkia& image, | 46 const gfx::ImageSkia& image, |
| 61 const gfx::Vector2d& image_offset, | 47 const gfx::Vector2d& image_offset, |
| 62 const DragEventSourceInfo& event_info) {} | 48 const DragEventSourceInfo& event_info) {} |
| 63 | 49 |
| 64 // The page wants to update the mouse cursor during a drag & drop operation. | 50 // The page wants to update the mouse cursor during a drag & drop operation. |
| 65 // |operation| describes the current operation (none, move, copy, link.) | 51 // |operation| describes the current operation (none, move, copy, link.) |
| 66 virtual void UpdateDragCursor(blink::WebDragOperation operation) {} | 52 virtual void UpdateDragCursor(blink::WebDragOperation operation) {} |
| 67 | 53 |
| 68 // Notification that view for this delegate got the focus. | 54 // Notification that view for this delegate got the focus. |
| 69 virtual void GotFocus() {} | 55 virtual void GotFocus() {} |
| 70 | 56 |
| 71 // Callback to inform the browser that the page is returning the focus to | 57 // Callback to inform the browser that the page is returning the focus to |
| 72 // the browser's chrome. If reverse is true, it means the focus was | 58 // the browser's chrome. If reverse is true, it means the focus was |
| 73 // retrieved by doing a Shift-Tab. | 59 // retrieved by doing a Shift-Tab. |
| 74 virtual void TakeFocus(bool reverse) {} | 60 virtual void TakeFocus(bool reverse) {} |
| 75 | 61 |
| 62 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
| 63 // Shows a popup menu with the specified items. |
| 64 // This method should call RenderFrameHost::DidSelectPopupMenuItem[s]() or |
| 65 // RenderFrameHost::DidCancelPopupMenu() based on the user action. |
| 66 virtual void ShowPopupMenu(RenderFrameHost* render_frame_host, |
| 67 const gfx::Rect& bounds, |
| 68 int item_height, |
| 69 double item_font_size, |
| 70 int selected_item, |
| 71 const std::vector<MenuItem>& items, |
| 72 bool right_aligned, |
| 73 bool allow_multiple_selection) {}; |
| 74 |
| 75 // Hides a popup menu opened by ShowPopupMenu(). |
| 76 virtual void HidePopupMenu() {}; |
| 77 #endif |
| 78 |
| 76 protected: | 79 protected: |
| 77 virtual ~RenderViewHostDelegateView() {} | 80 virtual ~RenderViewHostDelegateView() {} |
| 78 }; | 81 }; |
| 79 | 82 |
| 80 } // namespace content | 83 } // namespace content |
| 81 | 84 |
| 82 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_VIEW_H_ | 85 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_VIEW_H_ |
| OLD | NEW |