#define CEF_INCLUDE_CEF_RENDER_HANDLER_H_
#pragma once
+#include <vector>
+
#include "include/cef_base.h"
#include "include/cef_browser.h"
-#include <vector>
+#include "include/cef_drag_data.h"
///
// Implement this interface to handle events when window rendering is disabled.
// The methods of this class will be called on the UI thread.
///
/*--cef(source=client)--*/
-class CefRenderHandler : public virtual CefBase {
+class CefRenderHandler : public virtual CefBaseRefCounted {
public:
+ typedef cef_cursor_type_t CursorType;
+ typedef cef_drag_operations_mask_t DragOperation;
+ typedef cef_drag_operations_mask_t DragOperationsMask;
typedef cef_paint_element_type_t PaintElementType;
typedef std::vector<CefRect> RectList;
///
// Called when the browser wants to move or resize the popup widget. |rect|
- // contains the new location and size.
+ // contains the new location and size in view coordinates.
///
/*--cef()--*/
virtual void OnPopupSize(CefRefPtr<CefBrowser> browser,
const CefRect& rect) {}
///
- // Called when an element should be painted. |type| indicates whether the
- // element is the view or the popup widget. |buffer| contains the pixel data
- // for the whole image. |dirtyRects| contains the set of rectangles that need
- // to be repainted. On Windows |buffer| will be |width|*|height|*4 bytes
- // in size and represents a BGRA image with an upper-left origin.
+ // Called when an element should be painted. Pixel values passed to this
+ // method are scaled relative to view coordinates based on the value of
+ // CefScreenInfo.device_scale_factor returned from GetScreenInfo. |type|
+ // indicates whether the element is the view or the popup widget. |buffer|
+ // contains the pixel data for the whole image. |dirtyRects| contains the set
+ // of rectangles in pixel coordinates that need to be repainted. |buffer| will
+ // be |width|*|height|*4 bytes in size and represents a BGRA image with an
+ // upper-left origin.
///
/*--cef()--*/
virtual void OnPaint(CefRefPtr<CefBrowser> browser,
int width, int height) =0;
///
- // Called when the browser window's cursor has changed.
+ // Called when the browser's cursor has changed. If |type| is CT_CUSTOM then
+ // |custom_cursor_info| will be populated with the custom cursor information.
///
/*--cef()--*/
virtual void OnCursorChange(CefRefPtr<CefBrowser> browser,
- CefCursorHandle cursor) {}
+ CefCursorHandle cursor,
+ CursorType type,
+ const CefCursorInfo& custom_cursor_info) {}
+
+ ///
+ // Called when the user starts dragging content in the web view. Contextual
+ // information about the dragged content is supplied by |drag_data|.
+ // (|x|, |y|) is the drag start location in screen coordinates.
+ // OS APIs that run a system message loop may be used within the
+ // StartDragging call.
+ //
+ // Return false to abort the drag operation. Don't call any of
+ // CefBrowserHost::DragSource*Ended* methods after returning false.
+ //
+ // Return true to handle the drag operation. Call
+ // CefBrowserHost::DragSourceEndedAt and DragSourceSystemDragEnded either
+ // synchronously or asynchronously to inform the web view that the drag
+ // operation has ended.
+ ///
+ /*--cef()--*/
+ virtual bool StartDragging(CefRefPtr<CefBrowser> browser,
+ CefRefPtr<CefDragData> drag_data,
+ DragOperationsMask allowed_ops,
+ int x, int y) { return false; }
+
+ ///
+ // Called when the web view wants to update the mouse cursor during a
+ // drag & drop operation. |operation| describes the allowed operation
+ // (none, move, copy, link).
+ ///
+ /*--cef()--*/
+ virtual void UpdateDragCursor(CefRefPtr<CefBrowser> browser,
+ DragOperation operation) {}
///
// Called when the scroll offset has changed.
///
/*--cef()--*/
- virtual void OnScrollOffsetChanged(CefRefPtr<CefBrowser> browser) {}
+ virtual void OnScrollOffsetChanged(CefRefPtr<CefBrowser> browser,
+ double x,
+ double y) {}
+
+ ///
+ // Called when the IME composition range has changed. |selected_range| is the
+ // range of characters that have been selected. |character_bounds| is the
+ // bounds of each character in view coordinates.
+ ///
+ /*--cef()--*/
+ virtual void OnImeCompositionRangeChanged(CefRefPtr<CefBrowser> browser,
+ const CefRange& selected_range,
+ const RectList& character_bounds) {}
};
#endif // CEF_INCLUDE_CEF_RENDER_HANDLER_H_