Add support for draggable regions (issue #1645).

Regions are defined using the '-webkit-app-region: drag/no-drag'
CSS property and passed to the CefDragHandler::
OnDraggableRegionsChanged callback.
This commit is contained in:
Felix Bruns
2015-04-24 15:48:32 +02:00
committed by Marshall Greenblatt
parent ead921a3f6
commit c5b8b8b9c8
27 changed files with 581 additions and 3 deletions

View File

@@ -2659,6 +2659,8 @@ bool CefBrowserHostImpl::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(CefBrowserHostImpl, message)
IPC_MESSAGE_HANDLER(CefHostMsg_FrameIdentified, OnFrameIdentified)
IPC_MESSAGE_HANDLER(CefHostMsg_DidFinishLoad, OnDidFinishLoad)
IPC_MESSAGE_HANDLER(CefHostMsg_UpdateDraggableRegions,
OnUpdateDraggableRegions)
IPC_MESSAGE_HANDLER(CefHostMsg_Request, OnRequest)
IPC_MESSAGE_HANDLER(CefHostMsg_Response, OnResponse)
IPC_MESSAGE_HANDLER(CefHostMsg_ResponseAck, OnResponseAck)
@@ -2716,6 +2718,26 @@ void CefBrowserHostImpl::OnDidFinishLoad(int64 frame_id,
OnLoadEnd(frame, validated_url, http_status_code);
}
void CefBrowserHostImpl::OnUpdateDraggableRegions(
const std::vector<Cef_DraggableRegion_Params>& regions) {
std::vector<CefDraggableRegion> draggable_regions;
draggable_regions.reserve(regions.size());
std::vector<Cef_DraggableRegion_Params>::const_iterator it = regions.begin();
for (; it != regions.end(); ++it) {
const gfx::Rect& rect(it->bounds);
const CefRect bounds(rect.x(), rect.y(), rect.width(), rect.height());
draggable_regions.push_back(CefDraggableRegion(bounds, it->draggable));
}
if (client_.get()) {
CefRefPtr<CefDragHandler> handler = client_->GetDragHandler();
if (handler.get()) {
handler->OnDraggableRegionsChanged(this, draggable_regions);
}
}
}
void CefBrowserHostImpl::OnRequest(const Cef_Request_Params& params) {
bool success = false;
std::string response;