Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Unified Diff: webkit/tools/test_shell/event_sending_controller.cc

Issue 187015: Add beginDragWithFiles to EventSendingController. Also implement WebKitClient... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/tools/test_shell/event_sending_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/test_shell/event_sending_controller.cc
===================================================================
--- webkit/tools/test_shell/event_sending_controller.cc (revision 25255)
+++ webkit/tools/test_shell/event_sending_controller.cc (working copy)
@@ -26,12 +26,16 @@
#include <queue>
#include "base/compiler_specific.h"
+#include "base/file_path.h"
+#include "base/file_util.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/string_util.h"
#include "base/time.h"
#include "webkit/api/public/WebDragData.h"
#include "webkit/api/public/WebPoint.h"
+#include "webkit/api/public/WebString.h"
+#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webview.h"
#include "webkit/tools/test_shell/test_shell.h"
@@ -51,6 +55,7 @@
using WebKit::WebKeyboardEvent;
using WebKit::WebMouseEvent;
using WebKit::WebPoint;
+using WebKit::WebString;
TestShell* EventSendingController::shell_ = NULL;
gfx::Point EventSendingController::last_mouse_pos_;
@@ -168,6 +173,8 @@
BindMethod("zoomPageOut", &EventSendingController::zoomPageOut);
BindMethod("scheduleAsynchronousClick",
&EventSendingController::scheduleAsynchronousClick);
+ BindMethod("beginDragWithFiles",
+ &EventSendingController::beginDragWithFiles);
// When set to true (the default value), we batch mouse move and mouse up
// events so we can simulate drag & drop.
@@ -597,6 +604,32 @@
args, static_cast<CppVariant*>(NULL)));
}
+void EventSendingController::beginDragWithFiles(
+ const CppArgumentList& args, CppVariant* result) {
+ result->SetNull();
dglazkov 2009/09/03 02:51:40 I would put this at the end --not that it matters.
+
+ current_drag_data.initialize();
+ std::vector<std::wstring> files = args[0].ToStringVector();
+ for (size_t i = 0; i < files.size(); ++i) {
+ FilePath file_path = FilePath::FromWStringHack(files[i]);
+ file_util::AbsolutePath(&file_path);
+ current_drag_data.appendToFileNames(
+ webkit_glue::FilePathStringToWebString(file_path.value()));
+ }
+
+ // Provide a drag source.
+ WebPoint client_point(last_mouse_pos_.x(), last_mouse_pos_.y());
+ WebPoint screen_point(last_mouse_pos_.x(), last_mouse_pos_.y());
+ webview()->DragTargetDragEnter(current_drag_data, 0,
+ client_point, screen_point);
+
+ // dragMode saves events and then replays them later. We don't need/want that.
+ dragMode.Set(false);
+
+ // Make the rest of eventSender think a drag is in progress.
+ pressed_button_ = WebMouseEvent::ButtonLeft;
+}
+
//
// Unimplemented stubs
//
« no previous file with comments | « webkit/tools/test_shell/event_sending_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698