From 58377e2edb08dabeeba8a01bfb4484eb61527b4a Mon Sep 17 00:00:00 2001 From: "tc@google.com" Date: Thu, 26 Feb 2009 01:27:55 +0000 Subject: Add an identity (id) to system drag & drop. Used for gears file drag & drop in chrome, assign a drag id (identity) to each drag and drop session. Send the identity to the renderer WebViewImpl in drag enter notifications, provide a getter method. BUG=7995 Original patch by noel.gordon@gmail.com in: http://codereview.chromium.org/28108/show Review URL: http://codereview.chromium.org/28158 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10430 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/webview_impl.cc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'webkit/glue/webview_impl.cc') diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index 6b0444d..4db2ac0 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -334,6 +334,8 @@ WebViewImpl::WebViewImpl() suppress_next_keypress_event_(false), window_open_disposition_(IGNORE_ACTION), ime_accept_events_(true), + drag_target_dispatch_(false), + drag_identity_(0), autocomplete_popup_showing_(false) { // WebKit/win/WebView.cpp does the same thing, except they call the // KJS specific wrapper around this method. We need to have threading @@ -1472,37 +1474,61 @@ bool WebViewImpl::DragTargetDragEnter(const WebDropData& drop_data, DCHECK(!current_drop_data_.get()); current_drop_data_ = webkit_glue::WebDropDataToChromiumDataObject(drop_data); + drag_identity_ = drop_data.identity; DragData drag_data(current_drop_data_.get(), IntPoint(client_x, client_y), IntPoint(screen_x, screen_y), kDropTargetOperation); + drag_target_dispatch_ = true; DragOperation effect = page_->dragController()->dragEntered(&drag_data); + drag_target_dispatch_ = false; + return effect != DragOperationNone; } bool WebViewImpl::DragTargetDragOver( int client_x, int client_y, int screen_x, int screen_y) { DCHECK(current_drop_data_.get()); + DragData drag_data(current_drop_data_.get(), IntPoint(client_x, client_y), IntPoint(screen_x, screen_y), kDropTargetOperation); + drag_target_dispatch_ = true; DragOperation effect = page_->dragController()->dragUpdated(&drag_data); + drag_target_dispatch_ = false; + return effect != DragOperationNone; } void WebViewImpl::DragTargetDragLeave() { DCHECK(current_drop_data_.get()); + DragData drag_data(current_drop_data_.get(), IntPoint(), IntPoint(), DragOperationNone); + drag_target_dispatch_ = true; page_->dragController()->dragExited(&drag_data); + drag_target_dispatch_ = false; + current_drop_data_ = NULL; + drag_identity_ = 0; } void WebViewImpl::DragTargetDrop( int client_x, int client_y, int screen_x, int screen_y) { DCHECK(current_drop_data_.get()); + DragData drag_data(current_drop_data_.get(), IntPoint(client_x, client_y), IntPoint(screen_x, screen_y), kDropTargetOperation); + drag_target_dispatch_ = true; page_->dragController()->performDrag(&drag_data); + drag_target_dispatch_ = false; + current_drop_data_ = NULL; + drag_identity_ = 0; +} + +int32 WebViewImpl::GetDragIdentity() { + if (drag_target_dispatch_) + return drag_identity_; + return 0; } SearchableFormData* WebViewImpl::CreateSearchableFormDataForFocusedNode() { -- cgit v1.1