- Add CefDragHandler to support examination of drag data and cancellation of drag requests (issue #297).

- Mac: Fix dragging of URLs by providing a default image if no drag image is supplied.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@279 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2011-08-22 01:31:55 +00:00
parent 88a46e0b44
commit 1b1255c92d
26 changed files with 1192 additions and 30 deletions

View File

@ -235,6 +235,35 @@ void ClientHandler::OnJSBinding(CefRefPtr<CefBrowser> browser,
InitBindingTest(browser, frame, object);
}
bool ClientHandler::OnDragStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> dragData,
DragOperationsMask mask)
{
REQUIRE_UI_THREAD();
// Forbid dragging of image files.
if (dragData->IsFile()) {
std::string fileExt = dragData->GetFileExtension();
if (fileExt == ".png" || fileExt == ".jpg" || fileExt == ".gif")
return true;
}
return false;
}
bool ClientHandler::OnDragEnter(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> dragData,
DragOperationsMask mask)
{
REQUIRE_UI_THREAD();
// Forbid dragging of link URLs.
if (dragData->IsLink())
return true;
return false;
}
void ClientHandler::NotifyDownloadComplete(const CefString& fileName)
{
SetLastDownloadFile(fileName);