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

@@ -290,6 +290,14 @@ bool ClientHandler::OnDragEnter(CefRefPtr<CefBrowser> browser,
return false;
}
void ClientHandler::OnDraggableRegionsChanged(
CefRefPtr<CefBrowser> browser,
const std::vector<CefDraggableRegion>& regions) {
CEF_REQUIRE_UI_THREAD();
NotifyDraggableRegions(regions);
}
bool ClientHandler::OnRequestGeolocationPermission(
CefRefPtr<CefBrowser> browser,
const CefString& requesting_url,
@@ -676,6 +684,19 @@ void ClientHandler::NotifyLoadingState(bool isLoading,
delegate_->OnSetLoadingState(isLoading, canGoBack, canGoForward);
}
void ClientHandler::NotifyDraggableRegions(
const std::vector<CefDraggableRegion>& regions) {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(
base::Bind(&ClientHandler::NotifyDraggableRegions, this, regions));
return;
}
if (delegate_)
delegate_->OnSetDraggableRegions(regions);
}
void ClientHandler::BuildTestMenu(CefRefPtr<CefMenuModel> model) {
if (model->GetCount() > 0)
model->AddSeparator();