summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-07 23:24:58 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-07 23:24:58 +0000
commite80c73be12cc2211d5a72a5ff85eb97366b2458f (patch)
tree5c395779776b368ed6cafdbc5c6bc929776c18a4 /chrome/renderer
parent25a3f6b52228bc68ce63c4032ed6b17cecd7b3c5 (diff)
downloadchromium_src-e80c73be12cc2211d5a72a5ff85eb97366b2458f.zip
chromium_src-e80c73be12cc2211d5a72a5ff85eb97366b2458f.tar.gz
chromium_src-e80c73be12cc2211d5a72a5ff85eb97366b2458f.tar.bz2
Switch to using WebDragData in WebView and WebViewDelegate.
I also cleaned up some of the WebView and WebViewDelegate methods to pass WebPoint instead of pairs of ints or gfx::Point. With this change, I am keeping webkit/glue/webdropdata.{h,cc}, which is what Chrome uses to pass around the equivalent data. Now, it is possible to construct a WebDropData from a WebKit::WebDragData and to also get a WebKit::WebDragData from a WebDropData. Hence, the conversion between WebDropData and ChromiumDataObject (see clipboard_conversion.{h,cc}) is now removed in favor of conversion between WebDropData and WebKit::WebDragData. Conversion between WebKit::WebDragData and WebCore::ChromiumDataObject is very cheap (just reference counting). Finally, this change also brings in WebData, which is now used by the return value of WebKitClient::loadResource. As a companion to that change, I also changed webkit_glue::GetDataResource to return StringPiece instead of std::string. That also saves on an unnecessary buffer copy. R=dglazkov Review URL: http://codereview.chromium.org/63084 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13305 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/render_view.cc43
-rw-r--r--chrome/renderer/render_view.h9
-rw-r--r--chrome/renderer/renderer_glue.cc4
3 files changed, 32 insertions, 24 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 99ad017..3ed10cf 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -49,6 +49,8 @@
#include "printing/units.h"
#include "skia/ext/bitmap_platform_device.h"
#include "skia/ext/image_operations.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebDragData.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h"
#include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h"
#include "webkit/default_plugin/default_plugin_shared.h"
#include "webkit/glue/dom_operations.h"
@@ -87,6 +89,7 @@ using base::Time;
using base::TimeDelta;
using webkit_glue::WebAccessibility;
using WebKit::WebConsoleMessage;
+using WebKit::WebDragData;
using WebKit::WebScriptSource;
//-----------------------------------------------------------------------------
@@ -2031,8 +2034,9 @@ void RenderView::ShowContextMenu(WebView* webview,
Send(new ViewHostMsg_ContextMenu(routing_id_, params));
}
-void RenderView::StartDragging(WebView* webview, const WebDropData& drop_data) {
- Send(new ViewHostMsg_StartDragging(routing_id_, drop_data));
+void RenderView::StartDragging(WebView* webview,
+ const WebDragData& drag_data) {
+ Send(new ViewHostMsg_StartDragging(routing_id_, WebDropData(drag_data)));
}
void RenderView::TakeFocus(WebView* webview, bool reverse) {
@@ -2570,15 +2574,13 @@ void RenderView::OnReservePageIDRange(int size_of_range) {
next_page_id_ += size_of_range + 1;
}
-void RenderView::OnDragSourceEndedOrMoved(int client_x,
- int client_y,
- int screen_x,
- int screen_y,
+void RenderView::OnDragSourceEndedOrMoved(const gfx::Point& client_point,
+ const gfx::Point& screen_point,
bool ended) {
if (ended)
- webview()->DragSourceEndedAt(client_x, client_y, screen_x, screen_y);
+ webview()->DragSourceEndedAt(client_point, screen_point);
else
- webview()->DragSourceMovedTo(client_x, client_y, screen_x, screen_y);
+ webview()->DragSourceMovedTo(client_point, screen_point);
}
void RenderView::OnDragSourceSystemDragEnded() {
@@ -2631,17 +2633,21 @@ void RenderView::OnFillPasswordForm(
}
void RenderView::OnDragTargetDragEnter(const WebDropData& drop_data,
- const gfx::Point& client_pt, const gfx::Point& screen_pt) {
- bool is_drop_target = webview()->DragTargetDragEnter(drop_data,
- client_pt.x(), client_pt.y(), screen_pt.x(), screen_pt.y());
+ const gfx::Point& client_point,
+ const gfx::Point& screen_point) {
+ bool is_drop_target = webview()->DragTargetDragEnter(
+ drop_data.ToDragData(),
+ drop_data.identity,
+ client_point,
+ screen_point);
Send(new ViewHostMsg_UpdateDragCursor(routing_id_, is_drop_target));
}
-void RenderView::OnDragTargetDragOver(const gfx::Point& client_pt,
- const gfx::Point& screen_pt) {
- bool is_drop_target = webview()->DragTargetDragOver(client_pt.x(),
- client_pt.y(), screen_pt.x(), screen_pt.y());
+void RenderView::OnDragTargetDragOver(const gfx::Point& client_point,
+ const gfx::Point& screen_point) {
+ bool is_drop_target =
+ webview()->DragTargetDragOver(client_point, screen_point);
Send(new ViewHostMsg_UpdateDragCursor(routing_id_, is_drop_target));
}
@@ -2650,10 +2656,9 @@ void RenderView::OnDragTargetDragLeave() {
webview()->DragTargetDragLeave();
}
-void RenderView::OnDragTargetDrop(const gfx::Point& client_pt,
- const gfx::Point& screen_pt) {
- webview()->DragTargetDrop(client_pt.x(), client_pt.y(), screen_pt.x(),
- screen_pt.y());
+void RenderView::OnDragTargetDrop(const gfx::Point& client_point,
+ const gfx::Point& screen_point) {
+ webview()->DragTargetDrop(client_point, screen_point);
}
void RenderView::OnUpdateWebPreferences(const WebPreferences& prefs) {
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 3fe9dbb..6a499ad 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -67,6 +67,7 @@ struct ViewMsg_PrintPage_Params;
struct ViewMsg_PrintPages_Params;
struct ViewMsg_Print_Params;
struct ViewMsg_UploadFile_Params;
+struct WebDropData;
namespace base {
class WaitableEvent;
@@ -77,6 +78,7 @@ struct FileUploadData;
}
namespace WebKit {
+class WebDragData;
struct WebFindOptions;
}
@@ -274,7 +276,7 @@ class RenderView : public RenderWidget,
int edit_flags,
const std::string& security_info);
virtual void StartDragging(WebView* webview,
- const WebDropData& drag_data);
+ const WebKit::WebDragData& drag_data);
virtual void TakeFocus(WebView* webview, bool reverse);
virtual void JSOutOfMemory();
@@ -536,8 +538,9 @@ class RenderView : public RenderWidget,
void OnReservePageIDRange(int size_of_range);
- void OnDragSourceEndedOrMoved(
- int client_x, int client_y, int screen_x, int screen_y, bool ended);
+ void OnDragSourceEndedOrMoved(const gfx::Point& client_point,
+ const gfx::Point& screen_point,
+ bool ended);
void OnDragSourceSystemDragEnded();
void OnInstallMissingPlugin();
void OnFileChooserResponse(const std::vector<FilePath>& file_names);
diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc
index c907c23..d072dce 100644
--- a/chrome/renderer/renderer_glue.cc
+++ b/chrome/renderer/renderer_glue.cc
@@ -171,8 +171,8 @@ void AppendToLog(const char* file, int line, const char* msg) {
logging::LogMessage(file, line).stream() << msg;
}
-std::string GetDataResource(int resource_id) {
- return ResourceBundle::GetSharedInstance().GetDataResource(resource_id);
+StringPiece GetDataResource(int resource_id) {
+ return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
}
#if defined(OS_WIN)