summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webview_impl.cc
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-26 01:27:55 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-26 01:27:55 +0000
commit58377e2edb08dabeeba8a01bfb4484eb61527b4a (patch)
tree25fe434821c4537d799a316c91a995394ec00efb /webkit/glue/webview_impl.cc
parent24c289f856db14a85e5840ad0132512ef59c5c5f (diff)
downloadchromium_src-58377e2edb08dabeeba8a01bfb4484eb61527b4a.zip
chromium_src-58377e2edb08dabeeba8a01bfb4484eb61527b4a.tar.gz
chromium_src-58377e2edb08dabeeba8a01bfb4484eb61527b4a.tar.bz2
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
Diffstat (limited to 'webkit/glue/webview_impl.cc')
-rw-r--r--webkit/glue/webview_impl.cc26
1 files changed, 26 insertions, 0 deletions
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() {