diff options
63 files changed, 268 insertions, 237 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 0166c91..1b04020 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -136,6 +136,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/common/child_process_host.h" #include "content/public/common/common_param_traits.h" +#include "content/public/common/drop_data.h" #include "content/public/common/geoposition.h" #include "content/public/common/ssl_status.h" #include "extensions/browser/view_type_utils.h" @@ -146,7 +147,6 @@ #include "ui/base/events/event_constants.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/base/ui_base_types.h" -#include "webkit/common/webdropdata.h" #include "webkit/plugins/webplugininfo.h" #if defined(ENABLE_CONFIGURATION_POLICY) @@ -943,7 +943,7 @@ void TestingAutomationProvider::DragAndDropFilePaths( } // Emulate drag and drop to set the file paths to the file upload control. - WebDropData drop_data; + content::DropData drop_data; for (size_t path_index = 0; path_index < paths->GetSize(); ++path_index) { string16 path; if (!paths->GetString(path_index, &path)) { @@ -953,7 +953,7 @@ void TestingAutomationProvider::DragAndDropFilePaths( } drop_data.filenames.push_back( - WebDropData::FileInfo(path, string16())); + content::DropData::FileInfo(path, string16())); } const gfx::Point client(x, y); diff --git a/chrome/browser/ui/aura/tab_contents/web_drag_bookmark_handler_aura.cc b/chrome/browser/ui/aura/tab_contents/web_drag_bookmark_handler_aura.cc index b43eab5..7ea3102 100644 --- a/chrome/browser/ui/aura/tab_contents/web_drag_bookmark_handler_aura.cc +++ b/chrome/browser/ui/aura/tab_contents/web_drag_bookmark_handler_aura.cc @@ -11,7 +11,6 @@ #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" #include "content/public/browser/web_contents.h" #include "ui/base/dragdrop/os_exchange_data.h" -#include "webkit/common/webdropdata.h" using content::WebContents; diff --git a/chrome/browser/ui/views/tab_contents/web_drag_bookmark_handler_win.cc b/chrome/browser/ui/views/tab_contents/web_drag_bookmark_handler_win.cc index d63d1b5..474235b 100644 --- a/chrome/browser/ui/views/tab_contents/web_drag_bookmark_handler_win.cc +++ b/chrome/browser/ui/views/tab_contents/web_drag_bookmark_handler_win.cc @@ -12,9 +12,9 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/common/url_constants.h" #include "content/public/browser/web_contents.h" +#include "content/public/common/drop_data.h" #include "ui/base/dragdrop/os_exchange_data.h" #include "ui/base/dragdrop/os_exchange_data_provider_win.h" -#include "webkit/common/webdropdata.h" using content::WebContents; @@ -92,7 +92,7 @@ void WebDragBookmarkHandlerWin::OnDragLeave(IDataObject* data_object) { } } -bool WebDragBookmarkHandlerWin::AddDragData(const WebDropData& drop_data, +bool WebDragBookmarkHandlerWin::AddDragData(const content::DropData& drop_data, ui::OSExchangeData* data) { if (!drop_data.url.SchemeIs(chrome::kJavaScriptScheme)) return false; diff --git a/chrome/browser/ui/views/tab_contents/web_drag_bookmark_handler_win.h b/chrome/browser/ui/views/tab_contents/web_drag_bookmark_handler_win.h index 06460fd..404044a 100644 --- a/chrome/browser/ui/views/tab_contents/web_drag_bookmark_handler_win.h +++ b/chrome/browser/ui/views/tab_contents/web_drag_bookmark_handler_win.h @@ -28,7 +28,7 @@ class WebDragBookmarkHandlerWin : public content::WebDragDestDelegate { virtual void OnDragEnter(IDataObject* data_object) OVERRIDE; virtual void OnDrop(IDataObject* data_object) OVERRIDE; virtual void OnDragLeave(IDataObject* data_object) OVERRIDE; - virtual bool AddDragData(const WebDropData& drop_data, + virtual bool AddDragData(const content::DropData& drop_data, ui::OSExchangeData* data) OVERRIDE; private: diff --git a/chrome/browser/ui/webui/extensions/install_extension_handler.cc b/chrome/browser/ui/webui/extensions/install_extension_handler.cc index cb640b9..6ccf455 100644 --- a/chrome/browser/ui/webui/extensions/install_extension_handler.cc +++ b/chrome/browser/ui/webui/extensions/install_extension_handler.cc @@ -17,10 +17,10 @@ #include "content/public/browser/web_contents_view.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_data_source.h" +#include "content/public/common/drop_data.h" #include "grit/generated_resources.h" #include "net/base/net_util.h" #include "ui/base/l10n/l10n_util.h" -#include "webkit/common/webdropdata.h" InstallExtensionHandler::InstallExtensionHandler() { } @@ -54,7 +54,8 @@ void InstallExtensionHandler::RegisterMessages() { } void InstallExtensionHandler::HandleStartDragMessage(const ListValue* args) { - WebDropData* drop_data = web_ui()->GetWebContents()->GetView()->GetDropData(); + content::DropData* drop_data = + web_ui()->GetWebContents()->GetView()->GetDropData(); if (!drop_data) { DLOG(ERROR) << "No current drop data."; return; @@ -65,7 +66,7 @@ void InstallExtensionHandler::HandleStartDragMessage(const ListValue* args) { return; } - const WebDropData::FileInfo& file_info = drop_data->filenames.front(); + const content::DropData::FileInfo& file_info = drop_data->filenames.front(); file_to_install_ = base::FilePath::FromWStringHack( UTF16ToWide(file_info.path)); diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index 512f1e4..54724b8 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc @@ -39,6 +39,7 @@ #include "content/public/browser/user_metrics.h" #include "content/public/browser/web_contents_view.h" #include "content/public/common/content_switches.h" +#include "content/public/common/drop_data.h" #include "content/public/common/media_stream_request.h" #include "content/public/common/result_codes.h" #include "net/base/net_errors.h" @@ -46,7 +47,6 @@ #include "third_party/WebKit/public/web/WebCursorInfo.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/surface/transport_dib.h" -#include "webkit/common/webdropdata.h" #include "webkit/glue/resource_type.h" #if defined(OS_MACOSX) @@ -1119,7 +1119,7 @@ void BrowserPluginGuest::OnCompositorFrameACK( void BrowserPluginGuest::OnDragStatusUpdate(int instance_id, WebKit::WebDragStatus drag_status, - const WebDropData& drop_data, + const DropData& drop_data, WebKit::WebDragOperationsMask mask, const gfx::Point& location) { RenderViewHost* host = GetWebContents()->GetRenderViewHost(); diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h index eb6a503..a109a7c 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.h +++ b/content/browser/browser_plugin/browser_plugin_guest.h @@ -52,7 +52,6 @@ struct ViewHostMsg_ShowPopup_Params; #endif struct ViewHostMsg_UpdateRect_Params; class WebCursor; -struct WebDropData; namespace cc { class CompositorFrameAck; @@ -69,6 +68,7 @@ class BrowserPluginEmbedder; class BrowserPluginGuestManager; class RenderProcessHost; class RenderWidgetHostView; +struct DropData; struct MediaStreamRequest; // A browser plugin guest provides functionality for WebContents to operate in @@ -330,7 +330,7 @@ class CONTENT_EXPORT BrowserPluginGuest // renderer. void OnDragStatusUpdate(int instance_id, WebKit::WebDragStatus drag_status, - const WebDropData& drop_data, + const DropData& drop_data, WebKit::WebDragOperationsMask drag_mask, const gfx::Point& location); // Instructs the guest to execute an edit command decoded in the embedder. diff --git a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc index b202528..f2cfa0b 100644 --- a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc +++ b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc @@ -23,6 +23,7 @@ #include "content/public/browser/render_view_host_observer.h" #include "content/public/browser/render_widget_host_view.h" #include "content/public/common/content_switches.h" +#include "content/public/common/drop_data.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" #include "content/shell/shell.h" @@ -34,7 +35,6 @@ #include "net/test/embedded_test_server/http_response.h" #include "net/test/spawned_test_server/spawned_test_server.h" #include "third_party/WebKit/public/web/WebInputEvent.h" -#include "webkit/common/webdropdata.h" using WebKit::WebInputEvent; using WebKit::WebMouseEvent; @@ -863,7 +863,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, MAYBE_AcceptDragEvents) { double end_x, end_y; ASSERT_TRUE(end->GetDouble(0, &end_x) && end->GetDouble(1, &end_y)); - WebDropData drop_data; + DropData drop_data; GURL url = GURL("https://www.domain.com/index.html"); drop_data.url = url; diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc index 5b1f0cbf..cc98a8b 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc @@ -57,6 +57,7 @@ #include "content/public/common/content_constants.h" #include "content/public/common/content_switches.h" #include "content/public/common/context_menu_params.h" +#include "content/public/common/drop_data.h" #include "content/public/common/result_codes.h" #include "content/public/common/url_constants.h" #include "content/public/common/url_utils.h" @@ -68,7 +69,6 @@ #include "ui/shell_dialogs/selected_file_info.h" #include "ui/snapshot/snapshot.h" #include "webkit/browser/fileapi/isolated_context.h" -#include "webkit/common/webdropdata.h" #if defined(OS_MACOSX) #include "content/browser/renderer_host/popup_menu_helper_mac.h" @@ -571,7 +571,7 @@ void RenderViewHostImpl::RequestFindMatchRects(int current_version) { #endif void RenderViewHostImpl::DragTargetDragEnter( - const WebDropData& drop_data, + const DropData& drop_data, const gfx::Point& client_pt, const gfx::Point& screen_pt, WebDragOperationsMask operations_allowed, @@ -582,13 +582,13 @@ void RenderViewHostImpl::DragTargetDragEnter( // The URL could have been cobbled together from any highlighted text string, // and can't be interpreted as a capability. - WebDropData filtered_data(drop_data); + DropData filtered_data(drop_data); FilterURL(policy, GetProcess(), true, &filtered_data.url); // The filenames vector, on the other hand, does represent a capability to // access the given files. fileapi::IsolatedContext::FileInfoSet files; - for (std::vector<WebDropData::FileInfo>::iterator iter( + for (std::vector<DropData::FileInfo>::iterator iter( filtered_data.filenames.begin()); iter != filtered_data.filenames.end(); ++iter) { // A dragged file may wind up as the value of an input element, or it @@ -1444,7 +1444,7 @@ void RenderViewHostImpl::OnRunBeforeUnloadConfirm(const GURL& frame_url, } void RenderViewHostImpl::OnStartDragging( - const WebDropData& drop_data, + const DropData& drop_data, WebDragOperationsMask drag_operations_mask, const SkBitmap& bitmap, const gfx::Vector2d& bitmap_offset_in_dip, @@ -1453,7 +1453,7 @@ void RenderViewHostImpl::OnStartDragging( if (!view) return; - WebDropData filtered_data(drop_data); + DropData filtered_data(drop_data); RenderProcessHost* process = GetProcess(); ChildProcessSecurityPolicyImpl* policy = ChildProcessSecurityPolicyImpl::GetInstance(); @@ -1471,7 +1471,7 @@ void RenderViewHostImpl::OnStartDragging( // still fire though, which causes read permissions to be granted to the // renderer for any file paths in the drop. filtered_data.filenames.clear(); - for (std::vector<WebDropData::FileInfo>::const_iterator it = + for (std::vector<DropData::FileInfo>::const_iterator it = drop_data.filenames.begin(); it != drop_data.filenames.end(); ++it) { base::FilePath path(base::FilePath::FromUTF8Unsafe(UTF16ToUTF8(it->path))); diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h index 2e76a71..a248da38 100644 --- a/content/browser/renderer_host/render_view_host_impl.h +++ b/content/browser/renderer_host/render_view_host_impl.h @@ -153,7 +153,7 @@ class CONTENT_EXPORT RenderViewHostImpl int client_x, int client_y, int screen_x, int screen_y) OVERRIDE; virtual void DragSourceSystemDragEnded() OVERRIDE; virtual void DragTargetDragEnter( - const WebDropData& drop_data, + const DropData& drop_data, const gfx::Point& client_pt, const gfx::Point& screen_pt, WebKit::WebDragOperationsMask operations_allowed, @@ -543,7 +543,7 @@ class CONTENT_EXPORT RenderViewHostImpl const string16& message, bool is_reload, IPC::Message* reply_msg); - void OnStartDragging(const WebDropData& drop_data, + void OnStartDragging(const DropData& drop_data, WebKit::WebDragOperationsMask operations_allowed, const SkBitmap& bitmap, const gfx::Vector2d& bitmap_offset_in_dip, diff --git a/content/browser/renderer_host/render_view_host_unittest.cc b/content/browser/renderer_host/render_view_host_unittest.cc index 2dc5558..dca3da8 100644 --- a/content/browser/renderer_host/render_view_host_unittest.cc +++ b/content/browser/renderer_host/render_view_host_unittest.cc @@ -12,6 +12,7 @@ #include "content/port/browser/render_view_host_delegate_view.h" #include "content/public/browser/navigation_entry.h" #include "content/public/common/bindings_policy.h" +#include "content/public/common/drop_data.h" #include "content/public/common/page_transition_types.h" #include "content/public/common/url_constants.h" #include "content/public/test/mock_render_process_host.h" @@ -19,7 +20,6 @@ #include "content/test/test_web_contents.h" #include "net/base/net_util.h" #include "third_party/WebKit/public/web/WebDragOperation.h" -#include "webkit/common/webdropdata.h" namespace content { @@ -125,7 +125,7 @@ class MockDraggingRenderViewHostDelegateView const std::vector<WebMenuItem>& items, bool right_aligned, bool allow_multiple_selection) OVERRIDE {} - virtual void StartDragging(const WebDropData& drop_data, + virtual void StartDragging(const DropData& drop_data, WebKit::WebDragOperationsMask allowed_ops, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, @@ -156,7 +156,7 @@ TEST_F(RenderViewHostTest, StartDragging) { MockDraggingRenderViewHostDelegateView delegate_view; web_contents->set_delegate_view(&delegate_view); - WebDropData drop_data; + DropData drop_data; GURL file_url = GURL("file:///home/user/secrets.txt"); drop_data.url = file_url; drop_data.html_base_url = file_url; @@ -187,7 +187,7 @@ TEST_F(RenderViewHostTest, StartDragging) { } TEST_F(RenderViewHostTest, DragEnteredFileURLsStillBlocked) { - WebDropData dropped_data; + DropData dropped_data; gfx::Point client_point; gfx::Point screen_point; // We use "//foo/bar" path (rather than "/foo/bar") since dragged paths are @@ -199,7 +199,7 @@ TEST_F(RenderViewHostTest, DragEnteredFileURLsStillBlocked) { GURL dragged_file_url = net::FilePathToFileURL(dragged_file_path); GURL sensitive_file_url = net::FilePathToFileURL(sensitive_file_path); dropped_data.url = highlighted_file_url; - dropped_data.filenames.push_back(WebDropData::FileInfo( + dropped_data.filenames.push_back(DropData::FileInfo( UTF8ToUTF16(dragged_file_path.AsUTF8Unsafe()), string16())); rvh()->DragTargetDragEnter(dropped_data, client_point, screen_point, diff --git a/content/browser/renderer_host/test_render_view_host.cc b/content/browser/renderer_host/test_render_view_host.cc index 9f12960d..09fb8bd 100644 --- a/content/browser/renderer_host/test_render_view_host.cc +++ b/content/browser/renderer_host/test_render_view_host.cc @@ -383,7 +383,7 @@ void TestRenderViewHost::SimulateWasShown() { } void TestRenderViewHost::TestOnStartDragging( - const WebDropData& drop_data) { + const DropData& drop_data) { WebKit::WebDragOperationsMask drag_operation = WebKit::WebDragOperationEvery; DragEventSourceInfo event_info; OnStartDragging(drop_data, drag_operation, SkBitmap(), gfx::Vector2d(), diff --git a/content/browser/renderer_host/test_render_view_host.h b/content/browser/renderer_host/test_render_view_host.h index 6a1e558..9de121d 100644 --- a/content/browser/renderer_host/test_render_view_host.h +++ b/content/browser/renderer_host/test_render_view_host.h @@ -262,7 +262,7 @@ class TestRenderViewHost void TestOnUpdateStateWithFile( int process_id, const base::FilePath& file_path); - void TestOnStartDragging(const WebDropData& drop_data); + void TestOnStartDragging(const DropData& drop_data); // If set, *delete_counter is incremented when this object destructs. void set_delete_counter(int* delete_counter) { diff --git a/content/browser/web_contents/interstitial_page_impl.cc b/content/browser/web_contents/interstitial_page_impl.cc index 84566e5..a19543f 100644 --- a/content/browser/web_contents/interstitial_page_impl.cc +++ b/content/browser/web_contents/interstitial_page_impl.cc @@ -80,7 +80,7 @@ class InterstitialPageImpl::InterstitialPageRVHDelegateView const std::vector<WebMenuItem>& items, bool right_aligned, bool allow_multiple_selection) OVERRIDE; - virtual void StartDragging(const WebDropData& drop_data, + virtual void StartDragging(const DropData& drop_data, WebDragOperationsMask operations_allowed, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, @@ -775,7 +775,7 @@ void InterstitialPageImpl::InterstitialPageRVHDelegateView::ShowPopupMenu( } void InterstitialPageImpl::InterstitialPageRVHDelegateView::StartDragging( - const WebDropData& drop_data, + const DropData& drop_data, WebDragOperationsMask allowed_operations, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, diff --git a/content/browser/web_contents/web_contents_drag_win.cc b/content/browser/web_contents/web_contents_drag_win.cc index b151ed2..ab06293 100644 --- a/content/browser/web_contents/web_contents_drag_win.cc +++ b/content/browser/web_contents/web_contents_drag_win.cc @@ -26,6 +26,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_view.h" #include "content/public/browser/web_drag_dest_delegate.h" +#include "content/public/common/drop_data.h" #include "net/base/net_util.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/clipboard/clipboard.h" @@ -36,7 +37,6 @@ #include "ui/gfx/image/image_skia.h" #include "ui/gfx/screen.h" #include "ui/gfx/size.h" -#include "webkit/common/webdropdata.h" using WebKit::WebDragOperationsMask; using WebKit::WebDragOperationCopy; @@ -155,7 +155,7 @@ WebContentsDragWin::~WebContentsDragWin() { DCHECK(!drag_drop_thread_.get()); } -void WebContentsDragWin::StartDragging(const WebDropData& drop_data, +void WebContentsDragWin::StartDragging(const DropData& drop_data, WebDragOperationsMask ops, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset) { @@ -191,7 +191,7 @@ void WebContentsDragWin::StartDragging(const WebDropData& drop_data, } void WebContentsDragWin::StartBackgroundDragging( - const WebDropData& drop_data, + const DropData& drop_data, WebDragOperationsMask ops, const GURL& page_url, const std::string& page_encoding, @@ -222,7 +222,7 @@ void WebContentsDragWin::StartBackgroundDragging( } void WebContentsDragWin::PrepareDragForDownload( - const WebDropData& drop_data, + const DropData& drop_data, ui::OSExchangeData* data, const GURL& page_url, const std::string& page_encoding) { @@ -277,7 +277,7 @@ void WebContentsDragWin::PrepareDragForDownload( } void WebContentsDragWin::PrepareDragForFileContents( - const WebDropData& drop_data, ui::OSExchangeData* data) { + const DropData& drop_data, ui::OSExchangeData* data) { static const int kMaxFilenameLength = 255; // FAT and NTFS base::FilePath file_name(drop_data.file_description_filename); @@ -297,7 +297,7 @@ void WebContentsDragWin::PrepareDragForFileContents( data->SetFileContents(file_name, drop_data.file_contents); } -void WebContentsDragWin::PrepareDragForUrl(const WebDropData& drop_data, +void WebContentsDragWin::PrepareDragForUrl(const DropData& drop_data, ui::OSExchangeData* data) { if (drag_dest_->delegate() && drag_dest_->delegate()->AddDragData(drop_data, data)) { @@ -307,7 +307,7 @@ void WebContentsDragWin::PrepareDragForUrl(const WebDropData& drop_data, data->SetURL(drop_data.url, drop_data.url_title); } -bool WebContentsDragWin::DoDragging(const WebDropData& drop_data, +bool WebContentsDragWin::DoDragging(const DropData& drop_data, WebDragOperationsMask ops, const GURL& page_url, const std::string& page_encoding, diff --git a/content/browser/web_contents/web_contents_drag_win.h b/content/browser/web_contents/web_contents_drag_win.h index 42d2c68..b6a9805 100644 --- a/content/browser/web_contents/web_contents_drag_win.h +++ b/content/browser/web_contents/web_contents_drag_win.h @@ -17,7 +17,6 @@ #include "ui/gfx/point.h" class SkBitmap; -struct WebDropData; namespace gfx { class ImageSkia; @@ -28,6 +27,7 @@ class DragDropThread; class WebContents; class WebDragDest; class WebDragSource; +struct DropData; // Windows-specific drag-and-drop handling in WebContentsView. // If we are dragging a virtual file out of the browser, we use a background @@ -45,7 +45,7 @@ class CONTENT_EXPORT WebContentsDragWin virtual ~WebContentsDragWin(); // Called on UI thread. - void StartDragging(const WebDropData& drop_data, + void StartDragging(const DropData& drop_data, WebKit::WebDragOperationsMask ops, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset); @@ -61,19 +61,19 @@ class CONTENT_EXPORT WebContentsDragWin private: // Called on either UI thread or drag-and-drop thread. - void PrepareDragForDownload(const WebDropData& drop_data, + void PrepareDragForDownload(const DropData& drop_data, ui::OSExchangeData* data, const GURL& page_url, const std::string& page_encoding); - void PrepareDragForFileContents(const WebDropData& drop_data, + void PrepareDragForFileContents(const DropData& drop_data, ui::OSExchangeData* data); - void PrepareDragForUrl(const WebDropData& drop_data, + void PrepareDragForUrl(const DropData& drop_data, ui::OSExchangeData* data); // Returns false if the source window becomes invalid when the drag ends. // This could happen when the window gets destroyed when the drag is still in // progress. No further processing should be done beyond this return point // because the instance has been destroyed. - bool DoDragging(const WebDropData& drop_data, + bool DoDragging(const DropData& drop_data, WebKit::WebDragOperationsMask ops, const GURL& page_url, const std::string& page_encoding, @@ -81,7 +81,7 @@ class CONTENT_EXPORT WebContentsDragWin const gfx::Vector2d& image_offset); // Called on drag-and-drop thread. - void StartBackgroundDragging(const WebDropData& drop_data, + void StartBackgroundDragging(const DropData& drop_data, WebKit::WebDragOperationsMask ops, const GURL& page_url, const std::string& page_encoding, diff --git a/content/browser/web_contents/web_contents_view_android.cc b/content/browser/web_contents/web_contents_view_android.cc index 38ce95e..016858c 100644 --- a/content/browser/web_contents/web_contents_view_android.cc +++ b/content/browser/web_contents/web_contents_view_android.cc @@ -124,7 +124,7 @@ void WebContentsViewAndroid::RestoreFocus() { NOTIMPLEMENTED(); } -WebDropData* WebContentsViewAndroid::GetDropData() const { +DropData* WebContentsViewAndroid::GetDropData() const { NOTIMPLEMENTED(); return NULL; } @@ -198,7 +198,7 @@ void WebContentsViewAndroid::ShowPopupMenu( } void WebContentsViewAndroid::StartDragging( - const WebDropData& drop_data, + const DropData& drop_data, WebKit::WebDragOperationsMask allowed_ops, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, diff --git a/content/browser/web_contents/web_contents_view_android.h b/content/browser/web_contents/web_contents_view_android.h index e6a0f01..c72c512 100644 --- a/content/browser/web_contents/web_contents_view_android.h +++ b/content/browser/web_contents/web_contents_view_android.h @@ -47,7 +47,7 @@ class WebContentsViewAndroid : public WebContentsViewPort, virtual void SetInitialFocus() OVERRIDE; virtual void StoreFocus() OVERRIDE; virtual void RestoreFocus() OVERRIDE; - virtual WebDropData* GetDropData() const OVERRIDE; + virtual DropData* GetDropData() const OVERRIDE; virtual gfx::Rect GetViewBounds() const OVERRIDE; // WebContentsViewPort implementation ---------------------------------------- @@ -71,7 +71,7 @@ class WebContentsViewAndroid : public WebContentsViewPort, const std::vector<WebMenuItem>& items, bool right_aligned, bool allow_multiple_selection) OVERRIDE; - virtual void StartDragging(const WebDropData& drop_data, + virtual void StartDragging(const DropData& drop_data, WebKit::WebDragOperationsMask allowed_ops, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc index b4a99100..947f639 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc @@ -32,6 +32,7 @@ #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_view_delegate.h" #include "content/public/browser/web_drag_dest_delegate.h" +#include "content/public/common/drop_data.h" #include "third_party/WebKit/public/web/WebInputEvent.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/drag_drop_client.h" @@ -55,7 +56,6 @@ #include "ui/gfx/image/image_png_rep.h" #include "ui/gfx/image/image_skia.h" #include "ui/gfx/screen.h" -#include "webkit/common/webdropdata.h" namespace content { WebContentsViewPort* CreateWebContentsView( @@ -228,8 +228,8 @@ class WebDragSourceAura : public base::MessageLoopForUI::Observer, DISALLOW_COPY_AND_ASSIGN(WebDragSourceAura); }; -// Utility to fill a ui::OSExchangeDataProvider object from WebDropData. -void PrepareDragData(const WebDropData& drop_data, +// Utility to fill a ui::OSExchangeDataProvider object from DropData. +void PrepareDragData(const DropData& drop_data, ui::OSExchangeData::Provider* provider) { if (!drop_data.text.string().empty()) provider->SetString(drop_data.text.string()); @@ -239,7 +239,7 @@ void PrepareDragData(const WebDropData& drop_data, provider->SetHtml(drop_data.html.string(), drop_data.html_base_url); if (!drop_data.filenames.empty()) { std::vector<ui::OSExchangeData::FileInfo> filenames; - for (std::vector<WebDropData::FileInfo>::const_iterator it = + for (std::vector<DropData::FileInfo>::const_iterator it = drop_data.filenames.begin(); it != drop_data.filenames.end(); ++it) { filenames.push_back( @@ -257,9 +257,8 @@ void PrepareDragData(const WebDropData& drop_data, } } -// Utility to fill a WebDropData object from ui::OSExchangeData. -void PrepareWebDropData(WebDropData* drop_data, - const ui::OSExchangeData& data) { +// Utility to fill a DropData object from ui::OSExchangeData. +void PrepareDropData(DropData* drop_data, const ui::OSExchangeData& data) { string16 plain_text; data.GetString(&plain_text); if (!plain_text.empty()) @@ -286,7 +285,7 @@ void PrepareWebDropData(WebDropData* drop_data, for (std::vector<ui::OSExchangeData::FileInfo>::const_iterator it = files.begin(); it != files.end(); ++it) { drop_data->filenames.push_back( - WebDropData::FileInfo( + DropData::FileInfo( UTF8ToUTF16(it->path.AsUTF8Unsafe()), UTF8ToUTF16(it->display_name.AsUTF8Unsafe()))); } @@ -1088,7 +1087,7 @@ void WebContentsViewAura::RestoreFocus() { delegate_->RestoreFocus(); } -WebDropData* WebContentsViewAura::GetDropData() const { +DropData* WebContentsViewAura::GetDropData() const { return current_drop_data_.get(); } @@ -1238,7 +1237,7 @@ void WebContentsViewAura::ShowPopupMenu(const gfx::Rect& bounds, } void WebContentsViewAura::StartDragging( - const WebDropData& drop_data, + const DropData& drop_data, WebKit::WebDragOperationsMask operations, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, @@ -1522,9 +1521,9 @@ void WebContentsViewAura::OnDragEntered(const ui::DropTargetEvent& event) { if (drag_dest_delegate_) drag_dest_delegate_->DragInitialize(web_contents_); - current_drop_data_.reset(new WebDropData()); + current_drop_data_.reset(new DropData()); - PrepareWebDropData(current_drop_data_.get(), event.data()); + PrepareDropData(current_drop_data_.get(), event.data()); WebKit::WebDragOperationsMask op = ConvertToWeb(event.source_operations()); gfx::Point screen_pt = diff --git a/content/browser/web_contents/web_contents_view_aura.h b/content/browser/web_contents/web_contents_view_aura.h index 738e28d..0ed09ef 100644 --- a/content/browser/web_contents/web_contents_view_aura.h +++ b/content/browser/web_contents/web_contents_view_aura.h @@ -109,7 +109,7 @@ class CONTENT_EXPORT WebContentsViewAura virtual void SetInitialFocus() OVERRIDE; virtual void StoreFocus() OVERRIDE; virtual void RestoreFocus() OVERRIDE; - virtual WebDropData* GetDropData() const OVERRIDE; + virtual DropData* GetDropData() const OVERRIDE; virtual gfx::Rect GetViewBounds() const OVERRIDE; // Overridden from WebContentsViewPort: @@ -133,7 +133,7 @@ class CONTENT_EXPORT WebContentsViewAura const std::vector<WebMenuItem>& items, bool right_aligned, bool allow_multiple_selection) OVERRIDE; - virtual void StartDragging(const WebDropData& drop_data, + virtual void StartDragging(const DropData& drop_data, WebKit::WebDragOperationsMask operations, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, @@ -200,7 +200,7 @@ class CONTENT_EXPORT WebContentsViewAura WebKit::WebDragOperationsMask current_drag_op_; - scoped_ptr<WebDropData> current_drop_data_; + scoped_ptr<DropData> current_drop_data_; WebDragDestDelegate* drag_dest_delegate_; diff --git a/content/browser/web_contents/web_contents_view_gtk.cc b/content/browser/web_contents/web_contents_view_gtk.cc index 747e8fa..e60a011 100644 --- a/content/browser/web_contents/web_contents_view_gtk.cc +++ b/content/browser/web_contents/web_contents_view_gtk.cc @@ -22,12 +22,12 @@ #include "content/browser/web_contents/web_drag_source_gtk.h" #include "content/public/browser/web_contents_delegate.h" #include "content/public/browser/web_contents_view_delegate.h" +#include "content/public/common/drop_data.h" #include "ui/base/gtk/gtk_expanded_container.h" #include "ui/gfx/image/image_skia.h" #include "ui/gfx/point.h" #include "ui/gfx/rect.h" #include "ui/gfx/size.h" -#include "webkit/common/webdropdata.h" using WebKit::WebDragOperation; using WebKit::WebDragOperationsMask; @@ -174,7 +174,7 @@ void WebContentsViewGtk::RestoreFocus() { SetInitialFocus(); } -WebDropData* WebContentsViewGtk::GetDropData() const { +DropData* WebContentsViewGtk::GetDropData() const { return drag_dest_->current_drop_data(); } @@ -369,7 +369,7 @@ void WebContentsViewGtk::ShowPopupMenu(const gfx::Rect& bounds, // Render view DnD ------------------------------------------------------------- -void WebContentsViewGtk::StartDragging(const WebDropData& drop_data, +void WebContentsViewGtk::StartDragging(const DropData& drop_data, WebDragOperationsMask ops, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, diff --git a/content/browser/web_contents/web_contents_view_gtk.h b/content/browser/web_contents/web_contents_view_gtk.h index 52f7d8b..7a603d7 100644 --- a/content/browser/web_contents/web_contents_view_gtk.h +++ b/content/browser/web_contents/web_contents_view_gtk.h @@ -56,7 +56,7 @@ class CONTENT_EXPORT WebContentsViewGtk virtual void SetInitialFocus() OVERRIDE; virtual void StoreFocus() OVERRIDE; virtual void RestoreFocus() OVERRIDE; - virtual WebDropData* GetDropData() const OVERRIDE; + virtual DropData* GetDropData() const OVERRIDE; virtual gfx::Rect GetViewBounds() const OVERRIDE; // WebContentsViewPort implementation ---------------------------------------- @@ -80,7 +80,7 @@ class CONTENT_EXPORT WebContentsViewGtk const std::vector<WebMenuItem>& items, bool right_aligned, bool allow_multiple_selection) OVERRIDE; - virtual void StartDragging(const WebDropData& drop_data, + virtual void StartDragging(const DropData& drop_data, WebKit::WebDragOperationsMask allowed_ops, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, diff --git a/content/browser/web_contents/web_contents_view_guest.cc b/content/browser/web_contents/web_contents_view_guest.cc index df142e3..5a2b81e 100644 --- a/content/browser/web_contents/web_contents_view_guest.cc +++ b/content/browser/web_contents/web_contents_view_guest.cc @@ -15,11 +15,11 @@ #include "content/common/drag_messages.h" #include "content/public/browser/web_contents_delegate.h" #include "content/public/common/context_menu_params.h" +#include "content/public/common/drop_data.h" #include "ui/gfx/image/image_skia.h" #include "ui/gfx/point.h" #include "ui/gfx/rect.h" #include "ui/gfx/size.h" -#include "webkit/common/webdropdata.h" using WebKit::WebDragOperation; using WebKit::WebDragOperationsMask; @@ -166,7 +166,7 @@ void WebContentsViewGuest::StoreFocus() { platform_view_->StoreFocus(); } -WebDropData* WebContentsViewGuest::GetDropData() const { +DropData* WebContentsViewGuest::GetDropData() const { NOTIMPLEMENTED(); return NULL; } @@ -204,7 +204,7 @@ void WebContentsViewGuest::ShowPopupMenu(const gfx::Rect& bounds, } void WebContentsViewGuest::StartDragging( - const WebDropData& drop_data, + const DropData& drop_data, WebDragOperationsMask ops, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, diff --git a/content/browser/web_contents/web_contents_view_guest.h b/content/browser/web_contents/web_contents_view_guest.h index ab395c0..d080a9d 100644 --- a/content/browser/web_contents/web_contents_view_guest.h +++ b/content/browser/web_contents/web_contents_view_guest.h @@ -49,7 +49,7 @@ class CONTENT_EXPORT WebContentsViewGuest virtual void SetInitialFocus() OVERRIDE; virtual void StoreFocus() OVERRIDE; virtual void RestoreFocus() OVERRIDE; - virtual WebDropData* GetDropData() const OVERRIDE; + virtual DropData* GetDropData() const OVERRIDE; virtual gfx::Rect GetViewBounds() const OVERRIDE; #if defined(OS_MACOSX) virtual void SetAllowOverlappingViews(bool overlapping) OVERRIDE; @@ -81,7 +81,7 @@ class CONTENT_EXPORT WebContentsViewGuest const std::vector<WebMenuItem>& items, bool right_aligned, bool allow_multiple_selection) OVERRIDE; - virtual void StartDragging(const WebDropData& drop_data, + virtual void StartDragging(const DropData& drop_data, WebKit::WebDragOperationsMask allowed_ops, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, diff --git a/content/browser/web_contents/web_contents_view_mac.h b/content/browser/web_contents/web_contents_view_mac.h index 16dffcd..8e0894f 100644 --- a/content/browser/web_contents/web_contents_view_mac.h +++ b/content/browser/web_contents/web_contents_view_mac.h @@ -76,7 +76,7 @@ class WebContentsViewMac : public WebContentsViewPort, virtual void SetInitialFocus() OVERRIDE; virtual void StoreFocus() OVERRIDE; virtual void RestoreFocus() OVERRIDE; - virtual WebDropData* GetDropData() const OVERRIDE; + virtual DropData* GetDropData() const OVERRIDE; virtual gfx::Rect GetViewBounds() const OVERRIDE; virtual void SetAllowOverlappingViews(bool overlapping) OVERRIDE; virtual bool GetAllowOverlappingViews() const OVERRIDE; @@ -104,7 +104,7 @@ class WebContentsViewMac : public WebContentsViewPort, const std::vector<WebMenuItem>& items, bool right_aligned, bool allow_multiple_selection) OVERRIDE; - virtual void StartDragging(const WebDropData& drop_data, + virtual void StartDragging(const DropData& drop_data, WebKit::WebDragOperationsMask allowed_operations, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, diff --git a/content/browser/web_contents/web_contents_view_mac.mm b/content/browser/web_contents/web_contents_view_mac.mm index 7d65bcf..cb9f274 100644 --- a/content/browser/web_contents/web_contents_view_mac.mm +++ b/content/browser/web_contents/web_contents_view_mac.mm @@ -30,6 +30,7 @@ using WebKit::WebDragOperation; using WebKit::WebDragOperationsMask; +using content::DropData; using content::PopupMenuHelper; using content::RenderViewHostFactory; using content::RenderWidgetHostView; @@ -55,8 +56,8 @@ COMPILE_ASSERT_MATCHING_ENUM(DragOperationEvery); - (id)initWithWebContentsViewMac:(WebContentsViewMac*)w; - (void)registerDragTypes; - (void)setCurrentDragOperation:(NSDragOperation)operation; -- (WebDropData*)dropData; -- (void)startDragWithDropData:(const WebDropData&)dropData +- (DropData*)dropData; +- (void)startDragWithDropData:(const DropData&)dropData dragOperationMask:(NSDragOperation)operationMask image:(NSImage*)image offset:(NSPoint)offset; @@ -124,7 +125,7 @@ void WebContentsViewMac::GetContainerBounds(gfx::Rect* out) const { } void WebContentsViewMac::StartDragging( - const WebDropData& drop_data, + const DropData& drop_data, WebDragOperationsMask allowed_operations, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, @@ -204,7 +205,7 @@ void WebContentsViewMac::RestoreFocus() { focus_tracker_.reset(nil); } -WebDropData* WebContentsViewMac::GetDropData() const { +DropData* WebContentsViewMac::GetDropData() const { return [cocoa_view_ dropData]; } @@ -425,7 +426,7 @@ void WebContentsViewMac::CloseTab() { [dragDest_ setCurrentOperation:operation]; } -- (WebDropData*)dropData { +- (DropData*)dropData { return [dragDest_ currentDropData]; } @@ -467,7 +468,7 @@ void WebContentsViewMac::CloseTab() { forType:type]; } -- (void)startDragWithDropData:(const WebDropData&)dropData +- (void)startDragWithDropData:(const DropData&)dropData dragOperationMask:(NSDragOperation)operationMask image:(NSImage*)image offset:(NSPoint)offset { diff --git a/content/browser/web_contents/web_contents_view_win.cc b/content/browser/web_contents/web_contents_view_win.cc index 684197f..59415ea 100644 --- a/content/browser/web_contents/web_contents_view_win.cc +++ b/content/browser/web_contents/web_contents_view_win.cc @@ -193,7 +193,7 @@ void WebContentsViewWin::RestoreFocus() { delegate_->RestoreFocus(); } -WebDropData* WebContentsViewWin::GetDropData() const { +DropData* WebContentsViewWin::GetDropData() const { return drag_dest_->current_drop_data(); } @@ -259,7 +259,7 @@ void WebContentsViewWin::ShowPopupMenu(const gfx::Rect& bounds, NOTIMPLEMENTED(); } -void WebContentsViewWin::StartDragging(const WebDropData& drop_data, +void WebContentsViewWin::StartDragging(const DropData& drop_data, WebKit::WebDragOperationsMask operations, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, diff --git a/content/browser/web_contents/web_contents_view_win.h b/content/browser/web_contents/web_contents_view_win.h index 2a40fae..cfb4ecd 100644 --- a/content/browser/web_contents/web_contents_view_win.h +++ b/content/browser/web_contents/web_contents_view_win.h @@ -63,7 +63,7 @@ class CONTENT_EXPORT WebContentsViewWin virtual void SetInitialFocus() OVERRIDE; virtual void StoreFocus() OVERRIDE; virtual void RestoreFocus() OVERRIDE; - virtual WebDropData* GetDropData() const OVERRIDE; + virtual DropData* GetDropData() const OVERRIDE; virtual gfx::Rect GetViewBounds() const OVERRIDE; // Overridden from WebContentsViewPort: @@ -87,7 +87,7 @@ class CONTENT_EXPORT WebContentsViewWin const std::vector<WebMenuItem>& items, bool right_aligned, bool allow_multiple_selection) OVERRIDE; - virtual void StartDragging(const WebDropData& drop_data, + virtual void StartDragging(const DropData& drop_data, WebKit::WebDragOperationsMask operations, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, diff --git a/content/browser/web_contents/web_drag_dest_gtk.cc b/content/browser/web_contents/web_drag_dest_gtk.cc index c745d31..4c878cf 100644 --- a/content/browser/web_contents/web_drag_dest_gtk.cc +++ b/content/browser/web_contents/web_drag_dest_gtk.cc @@ -110,7 +110,7 @@ gboolean WebDragDestGtk::OnDragMotion(GtkWidget* sender, guint time) { if (context_ != context) { context_ = context; - drop_data_.reset(new WebDropData); + drop_data_.reset(new DropData); is_drop_target_ = false; if (delegate()) @@ -204,8 +204,7 @@ void WebDragDestGtk::OnDragDataReceived( if (url.SchemeIs(chrome::kFileScheme) && net::FileURLToFilePath(url, &file_path)) { drop_data_->filenames.push_back( - WebDropData::FileInfo(UTF8ToUTF16(file_path.value()), - string16())); + DropData::FileInfo(UTF8ToUTF16(file_path.value()), string16())); // This is a hack. Some file managers also populate text/plain with // a file URL when dragging files, so we clear it to avoid exposing // it to the web content. diff --git a/content/browser/web_contents/web_drag_dest_gtk.h b/content/browser/web_contents/web_drag_dest_gtk.h index 8b954b9..b912afa 100644 --- a/content/browser/web_contents/web_drag_dest_gtk.h +++ b/content/browser/web_contents/web_drag_dest_gtk.h @@ -11,9 +11,9 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "content/common/content_export.h" +#include "content/public/common/drop_data.h" #include "third_party/WebKit/public/web/WebDragOperation.h" #include "ui/base/gtk/gtk_signal.h" -#include "webkit/common/webdropdata.h" namespace content { @@ -28,7 +28,7 @@ class CONTENT_EXPORT WebDragDestGtk { WebDragDestGtk(WebContents* web_contents, GtkWidget* widget); ~WebDragDestGtk(); - WebDropData* current_drop_data() const { return drop_data_.get(); } + DropData* current_drop_data() const { return drop_data_.get(); } // This is called when the renderer responds to a drag motion event. We must // update the system drag cursor. @@ -79,7 +79,7 @@ class CONTENT_EXPORT WebDragDestGtk { GdkDragContext* context_; // The data for the current drag, or NULL if |context_| is NULL. - scoped_ptr<WebDropData> drop_data_; + scoped_ptr<DropData> drop_data_; // The number of outstanding drag data requests we have sent to the drag // source. diff --git a/content/browser/web_contents/web_drag_dest_mac.h b/content/browser/web_contents/web_drag_dest_mac.h index 3d4cbe5..63a9efa 100644 --- a/content/browser/web_contents/web_drag_dest_mac.h +++ b/content/browser/web_contents/web_drag_dest_mac.h @@ -7,8 +7,7 @@ #include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" #include "content/common/content_export.h" -#include "webkit/common/webdropdata.h" - +#include "content/public/common/drop_data.h" namespace content { class RenderViewHost; @@ -40,7 +39,7 @@ CONTENT_EXPORT RenderViewHostIdentifier currentRVH_; // The data for the current drag, or NULL if none is in progress. - scoped_ptr<WebDropData> dropData_; + scoped_ptr<content::DropData> dropData_; // True if the drag has been canceled. bool canceled_; @@ -51,7 +50,7 @@ CONTENT_EXPORT // (if necessary). - (id)initWithWebContentsImpl:(content::WebContentsImpl*)contents; -- (WebDropData*)currentDropData; +- (content::DropData*)currentDropData; - (void)setDragDelegate:(content::WebDragDestDelegate*)delegate; @@ -76,7 +75,7 @@ CONTENT_EXPORT @interface WebDragDest(Testing) // Given |data|, which should not be nil, fill it in using the contents of the // given pasteboard. -- (void)populateWebDropData:(WebDropData*)data +- (void)populateDropData:(content::DropData*)data fromPasteboard:(NSPasteboard*)pboard; // Given a point in window coordinates and a view in that window, return a // flipped point in the coordinate system of |view|. diff --git a/content/browser/web_contents/web_drag_dest_mac.mm b/content/browser/web_contents/web_drag_dest_mac.mm index 6e89318..8a529e8 100644 --- a/content/browser/web_contents/web_drag_dest_mac.mm +++ b/content/browser/web_contents/web_drag_dest_mac.mm @@ -11,14 +11,15 @@ #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/web_contents_delegate.h" #include "content/public/browser/web_drag_dest_delegate.h" +#include "content/public/common/drop_data.h" #import "third_party/mozilla/NSPasteboard+Utils.h" #include "third_party/WebKit/public/web/WebInputEvent.h" #include "ui/base/clipboard/custom_data_helper.h" #import "ui/base/dragdrop/cocoa_dnd_util.h" #include "ui/base/window_open_disposition.h" -#include "webkit/common/webdropdata.h" using WebKit::WebDragOperationsMask; +using content::DropData; using content::OpenURLParams; using content::Referrer; using content::WebContentsImpl; @@ -50,7 +51,7 @@ int GetModifierFlags() { return self; } -- (WebDropData*)currentDropData { +- (DropData*)currentDropData { return dropData_.get(); } @@ -105,10 +106,10 @@ int GetModifierFlags() { // we need to send a new enter message in draggingUpdated:. currentRVH_ = webContents_->GetRenderViewHost(); - // Fill out a WebDropData from pasteboard. - scoped_ptr<WebDropData> dropData; - dropData.reset(new WebDropData()); - [self populateWebDropData:dropData.get() + // Fill out a DropData from pasteboard. + scoped_ptr<DropData> dropData; + dropData.reset(new DropData()); + [self populateDropData:dropData.get() fromPasteboard:[info draggingPasteboard]]; NSDragOperation mask = [info draggingSourceOperationMask]; @@ -246,8 +247,8 @@ int GetModifierFlags() { // Given |data|, which should not be nil, fill it in using the contents of the // given pasteboard. The types handled by this method should be kept in sync // with [WebContentsViewCocoa registerDragTypes]. -- (void)populateWebDropData:(WebDropData*)data - fromPasteboard:(NSPasteboard*)pboard { +- (void)populateDropData:(DropData*)data + fromPasteboard:(NSPasteboard*)pboard { DCHECK(data); DCHECK(pboard); NSArray* types = [pboard types]; @@ -288,7 +289,7 @@ int GetModifierFlags() { fileExistsAtPath:filename]; if (exists) { data->filenames.push_back( - WebDropData::FileInfo( + DropData::FileInfo( base::SysNSStringToUTF16(filename), string16())); } } diff --git a/content/browser/web_contents/web_drag_dest_mac_unittest.mm b/content/browser/web_contents/web_drag_dest_mac_unittest.mm index 028f137..48719de 100644 --- a/content/browser/web_contents/web_drag_dest_mac_unittest.mm +++ b/content/browser/web_contents/web_drag_dest_mac_unittest.mm @@ -8,13 +8,14 @@ #include "base/strings/utf_string_conversions.h" #include "content/browser/renderer_host/test_render_view_host.h" #import "content/browser/web_contents/web_drag_dest_mac.h" +#include "content/public/common/drop_data.h" #include "content/test/test_web_contents.h" #include "testing/gtest/include/gtest/gtest.h" #import "third_party/mozilla/NSPasteboard+Utils.h" #import "ui/base/dragdrop/cocoa_dnd_util.h" #import "ui/base/test/ui_cocoa_test_helper.h" -#include "webkit/common/webdropdata.h" +using content::DropData; using content::RenderViewHostImplTestHarness; namespace { @@ -144,7 +145,7 @@ TEST_F(WebDragDestTest, URL) { } TEST_F(WebDragDestTest, Data) { - WebDropData data; + DropData data; NSPasteboard* pboard = [NSPasteboard pasteboardWithUniqueName]; PutURLOnPasteboard(@"http://www.google.com", pboard); @@ -155,7 +156,7 @@ TEST_F(WebDragDestTest, Data) { NSString* textString = @"hi there"; [pboard setString:htmlString forType:NSHTMLPboardType]; [pboard setString:textString forType:NSStringPboardType]; - [drag_dest_ populateWebDropData:&data fromPasteboard:pboard]; + [drag_dest_ populateDropData:&data fromPasteboard:pboard]; EXPECT_EQ(data.url.spec(), "http://www.google.com/"); EXPECT_EQ(base::SysNSStringToUTF16(textString), data.text.string()); EXPECT_EQ(base::SysNSStringToUTF16(htmlString), data.html.string()); diff --git a/content/browser/web_contents/web_drag_dest_win.cc b/content/browser/web_contents/web_drag_dest_win.cc index 1aadc95..af0e724 100644 --- a/content/browser/web_contents/web_drag_dest_win.cc +++ b/content/browser/web_contents/web_drag_dest_win.cc @@ -13,6 +13,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_delegate.h" #include "content/public/browser/web_drag_dest_delegate.h" +#include "content/public/common/drop_data.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" #include "third_party/WebKit/public/web/WebInputEvent.h" @@ -21,7 +22,6 @@ #include "ui/base/dragdrop/os_exchange_data_provider_win.h" #include "ui/base/window_open_disposition.h" #include "ui/gfx/point.h" -#include "webkit/common/webdropdata.h" using WebKit::WebDragOperationNone; using WebKit::WebDragOperationCopy; @@ -60,9 +60,9 @@ int GetModifierFlags() { return modifier_state; } -// Helper method for converting Window's specific IDataObject to a WebDropData +// Helper method for converting Window's specific IDataObject to a DropData // object. -void PopulateWebDropData(IDataObject* data_object, WebDropData* drop_data) { +void PopulateDropData(IDataObject* data_object, DropData* drop_data) { base::string16 url_str; if (ui::ClipboardUtil::GetUrl( data_object, &url_str, &drop_data->url_title, false)) { @@ -74,7 +74,7 @@ void PopulateWebDropData(IDataObject* data_object, WebDropData* drop_data) { ui::ClipboardUtil::GetFilenames(data_object, &filenames); for (size_t i = 0; i < filenames.size(); ++i) drop_data->filenames.push_back( - WebDropData::FileInfo(filenames[i], base::string16())); + DropData::FileInfo(filenames[i], base::string16())); base::string16 text; ui::ClipboardUtil::GetPlainText(data_object, &text); if (!text.empty()) { @@ -154,11 +154,11 @@ DWORD WebDragDest::OnDragEnter(IDataObject* data_object, DWORD effects) { current_rvh_ = web_contents_->GetRenderViewHost(); - // TODO(tc): PopulateWebDropData can be slow depending on what is in the + // TODO(tc): PopulateDropData can be slow depending on what is in the // IDataObject. Maybe we can do this in a background thread. - scoped_ptr<WebDropData> drop_data; - drop_data.reset(new WebDropData()); - PopulateWebDropData(data_object, drop_data.get()); + scoped_ptr<DropData> drop_data; + drop_data.reset(new DropData()); + PopulateDropData(data_object, drop_data.get()); if (drop_data->url.is_empty()) ui::OSExchangeDataProviderWin::GetPlainTextURL(data_object, diff --git a/content/browser/web_contents/web_drag_dest_win.h b/content/browser/web_contents/web_drag_dest_win.h index 89c0027..5ddb7ed 100644 --- a/content/browser/web_contents/web_drag_dest_win.h +++ b/content/browser/web_contents/web_drag_dest_win.h @@ -7,9 +7,9 @@ #include "base/memory/scoped_ptr.h" #include "content/common/content_export.h" +#include "content/public/common/drop_data.h" #include "third_party/WebKit/public/web/WebDragOperation.h" #include "ui/base/dragdrop/drop_target_win.h" -#include "webkit/common/webdropdata.h" namespace content { class InterstitialDropTarget; @@ -27,7 +27,7 @@ class CONTENT_EXPORT WebDragDest : public ui::DropTargetWin { WebDragDest(HWND source_hwnd, WebContents* contents); virtual ~WebDragDest(); - WebDropData* current_drop_data() const { return drop_data_.get(); } + DropData* current_drop_data() const { return drop_data_.get(); } void set_drag_cursor(WebKit::WebDragOperation op) { drag_cursor_ = op; @@ -76,7 +76,7 @@ class CONTENT_EXPORT WebDragDest : public ui::DropTargetWin { WebDragDestDelegate* delegate_; // The data for the current drag, or NULL if |context_| is NULL. - scoped_ptr<WebDropData> drop_data_; + scoped_ptr<DropData> drop_data_; // True if the drag has been canceled. bool canceled_; diff --git a/content/browser/web_contents/web_drag_source_gtk.cc b/content/browser/web_contents/web_drag_source_gtk.cc index 27e0e6a..0f1d9d5 100644 --- a/content/browser/web_contents/web_drag_source_gtk.cc +++ b/content/browser/web_contents/web_drag_source_gtk.cc @@ -18,6 +18,7 @@ #include "content/public/browser/content_browser_client.h" #include "content/public/browser/web_contents_view.h" #include "content/public/common/content_client.h" +#include "content/public/common/drop_data.h" #include "net/base/file_stream.h" #include "net/base/net_util.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -26,7 +27,6 @@ #include "ui/base/gtk/gtk_compat.h" #include "ui/base/gtk/gtk_screen_util.h" #include "ui/gfx/gtk_util.h" -#include "webkit/common/webdropdata.h" using WebKit::WebDragOperation; using WebKit::WebDragOperationsMask; @@ -68,7 +68,7 @@ WebDragSourceGtk::~WebDragSourceGtk() { gtk_widget_destroy(drag_icon_); } -bool WebDragSourceGtk::StartDragging(const WebDropData& drop_data, +bool WebDragSourceGtk::StartDragging(const DropData& drop_data, WebDragOperationsMask allowed_ops, GdkEventButton* last_mouse_down, const SkBitmap& image, @@ -105,7 +105,7 @@ bool WebDragSourceGtk::StartDragging(const WebDropData& drop_data, // NOTE: Begin a drag even if no targets present. Otherwise, things like // draggable list elements will not work. - drop_data_.reset(new WebDropData(drop_data)); + drop_data_.reset(new DropData(drop_data)); // The image we get from WebKit makes heavy use of alpha-shading. This looks // bad on non-compositing WMs. Fall back to the default drag icon. diff --git a/content/browser/web_contents/web_drag_source_gtk.h b/content/browser/web_contents/web_drag_source_gtk.h index dd3d5b4..f7954cd 100644 --- a/content/browser/web_contents/web_drag_source_gtk.h +++ b/content/browser/web_contents/web_drag_source_gtk.h @@ -21,12 +21,12 @@ #include "ui/gfx/vector2d.h" class SkBitmap; -struct WebDropData; namespace content { class RenderViewHostImpl; class WebContentsImpl; +struct DropData; // WebDragSourceGtk takes care of managing the drag from a WebContents // with Gtk. @@ -38,7 +38,7 @@ class CONTENT_EXPORT WebDragSourceGtk : // Starts a drag for the WebContents this WebDragSourceGtk was created for. // Returns false if the drag could not be started. - bool StartDragging(const WebDropData& drop_data, + bool StartDragging(const DropData& drop_data, WebKit::WebDragOperationsMask allowed_ops, GdkEventButton* last_mouse_down, const SkBitmap& image, @@ -67,7 +67,7 @@ class CONTENT_EXPORT WebDragSourceGtk : // The drop data for the current drag (for drags that originate in the render // view). Non-NULL iff there is a current drag. - scoped_ptr<WebDropData> drop_data_; + scoped_ptr<DropData> drop_data_; // The image used for depicting the drag, and the offset between the cursor // and the top left pixel. diff --git a/content/browser/web_contents/web_drag_source_mac.h b/content/browser/web_contents/web_drag_source_mac.h index 87fb2b6..0c9b951 100644 --- a/content/browser/web_contents/web_drag_source_mac.h +++ b/content/browser/web_contents/web_drag_source_mac.h @@ -11,9 +11,9 @@ #include "content/common/content_export.h" #include "googleurl/src/gurl.h" -struct WebDropData; namespace content { class WebContentsImpl; +struct DropData; } // A class that handles tracking and event processing for a drag and drop @@ -28,7 +28,7 @@ CONTENT_EXPORT NSView* contentsView_; // Our drop data. Should only be initialized once. - scoped_ptr<WebDropData> dropData_; + scoped_ptr<content::DropData> dropData_; // The image to show as drag image. Can be nil. base::scoped_nsobject<NSImage> dragImage_; @@ -57,7 +57,7 @@ CONTENT_EXPORT // with data types appropriate for dropData. - (id)initWithContents:(content::WebContentsImpl*)contents view:(NSView*)contentsView - dropData:(const WebDropData*)dropData + dropData:(const content::DropData*)dropData image:(NSImage*)image offset:(NSPoint)offset pasteboard:(NSPasteboard*)pboard diff --git a/content/browser/web_contents/web_drag_source_mac.mm b/content/browser/web_contents/web_drag_source_mac.mm index 258af55..c940c80 100644 --- a/content/browser/web_contents/web_drag_source_mac.mm +++ b/content/browser/web_contents/web_drag_source_mac.mm @@ -23,6 +23,7 @@ #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/content_browser_client.h" #include "content/public/common/content_client.h" +#include "content/public/common/drop_data.h" #include "content/public/common/url_constants.h" #include "grit/ui_resources.h" #include "net/base/escape.h" @@ -32,13 +33,13 @@ #include "ui/base/clipboard/custom_data_helper.h" #include "ui/base/dragdrop/cocoa_dnd_util.h" #include "ui/gfx/image/image.h" -#include "webkit/common/webdropdata.h" using base::SysNSStringToUTF8; using base::SysUTF8ToNSString; using base::SysUTF16ToNSString; using content::BrowserThread; using content::DragDownloadFile; +using content::DropData; using content::PromiseFileFinalizer; using content::RenderViewHostImpl; using net::FileStream; @@ -63,7 +64,7 @@ base::FilePath FilePathFromFilename(const string16& filename) { // Returns a filename appropriate for the drop data // TODO(viettrungluu): Refactor to make it common across platforms, // and move it somewhere sensible. -base::FilePath GetFileNameFromDragData(const WebDropData& drop_data) { +base::FilePath GetFileNameFromDragData(const DropData& drop_data) { base::FilePath file_name( FilePathFromFilename(drop_data.file_description_filename)); @@ -84,7 +85,7 @@ base::FilePath GetFileNameFromDragData(const WebDropData& drop_data) { // This helper's sole task is to write out data for a promised file; the caller // is responsible for opening the file. It takes the drop data and an open file // stream. -void PromiseWriterHelper(const WebDropData& drop_data, +void PromiseWriterHelper(const DropData& drop_data, scoped_ptr<FileStream> file_stream) { DCHECK(file_stream); file_stream->WriteSync(drop_data.file_contents.data(), @@ -135,7 +136,7 @@ NSString* GetDropLocation(NSPasteboard* pboard) { - (id)initWithContents:(content::WebContentsImpl*)contents view:(NSView*)contentsView - dropData:(const WebDropData*)dropData + dropData:(const DropData*)dropData image:(NSImage*)image offset:(NSPoint)offset pasteboard:(NSPasteboard*)pboard @@ -147,7 +148,7 @@ NSString* GetDropLocation(NSPasteboard* pboard) { contentsView_ = contentsView; DCHECK(contentsView_); - dropData_.reset(new WebDropData(*dropData)); + dropData_.reset(new DropData(*dropData)); DCHECK(dropData_.get()); dragImage_.reset([image retain]); @@ -470,7 +471,7 @@ NSString* GetDropLocation(NSPasteboard* pboard) { // if there is an image flavor, don't put the HTML data on as HTML, but rather // put it on as this Chrome-only flavor. // - // (The only time that Blink fills in the WebDropData::file_contents is with + // (The only time that Blink fills in the DropData::file_contents is with // an image drop, but the MIME time is tested anyway for paranoia's sake.) bool hasImageData = !dropData_->file_contents.empty() && fileUTI_ && diff --git a/content/browser/web_contents/web_drag_source_mac_unittest.mm b/content/browser/web_contents/web_drag_source_mac_unittest.mm index 96a401c..7b21080 100644 --- a/content/browser/web_contents/web_drag_source_mac_unittest.mm +++ b/content/browser/web_contents/web_drag_source_mac_unittest.mm @@ -5,10 +5,10 @@ #import "content/browser/web_contents/web_drag_source_mac.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/public/common/drop_data.h" #include "content/public/test/test_renderer_host.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" -#include "webkit/common/webdropdata.h" namespace content { @@ -19,7 +19,7 @@ TEST_F(WebDragSourceMacTest, DragInvalidlyEscapedBookmarklet) { base::scoped_nsobject<NSView> view( [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 10, 10)]); - scoped_ptr<WebDropData> dropData(new WebDropData); + scoped_ptr<DropData> dropData(new DropData); dropData->url = GURL("javascript:%"); WebContentsImpl* contentsImpl = static_cast<WebContentsImpl*>(contents.get()); diff --git a/content/common/browser_plugin/browser_plugin_messages.h b/content/common/browser_plugin/browser_plugin_messages.h index 274ab33..e59a6fa6 100644 --- a/content/common/browser_plugin/browser_plugin_messages.h +++ b/content/common/browser_plugin/browser_plugin_messages.h @@ -17,6 +17,7 @@ #include "content/common/content_param_traits.h" #include "content/common/edit_command.h" #include "content/public/common/common_param_traits.h" +#include "content/public/common/drop_data.h" #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_utils.h" @@ -25,7 +26,6 @@ #include "ui/gfx/point.h" #include "ui/gfx/rect.h" #include "ui/gfx/size.h" -#include "webkit/common/webdropdata.h" #include "webkit/common/cursors/webcursor.h" #undef IPC_MESSAGE_EXPORT @@ -241,7 +241,7 @@ IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_SetVisibility, IPC_MESSAGE_ROUTED5(BrowserPluginHostMsg_DragStatusUpdate, int /* instance_id */, WebKit::WebDragStatus /* drag_status */, - WebDropData /* drop_data */, + content::DropData /* drop_data */, WebKit::WebDragOperationsMask /* operation_mask */, gfx::Point /* plugin_location */) diff --git a/content/common/drag_messages.h b/content/common/drag_messages.h index b297fa2..3e21478 100644 --- a/content/common/drag_messages.h +++ b/content/common/drag_messages.h @@ -7,19 +7,19 @@ #include "content/common/drag_event_source_info.h" #include "content/public/common/common_param_traits.h" +#include "content/public/common/drop_data.h" #include "ipc/ipc_message_macros.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/WebKit/public/web/WebDragOperation.h" #include "ui/gfx/point.h" #include "ui/gfx/vector2d.h" -#include "webkit/common/webdropdata.h" #define IPC_MESSAGE_START DragMsgStart // Messages sent from the browser to the renderer. IPC_MESSAGE_ROUTED5(DragMsg_TargetDragEnter, - WebDropData /* drop_data */, + content::DropData /* drop_data */, gfx::Point /* client_pt */, gfx::Point /* screen_pt */, WebKit::WebDragOperationsMask /* ops_allowed */, @@ -52,11 +52,11 @@ IPC_MESSAGE_ROUTED0(DragMsg_SourceSystemDragEnded) // Messages sent from the renderer to the browser. // Used to tell the parent the user started dragging in the content area. The -// WebDropData struct contains contextual information about the pieces of the +// DropData struct contains contextual information about the pieces of the // page the user dragged. The parent uses this notification to initiate a // drag session at the OS level. IPC_MESSAGE_ROUTED5(DragHostMsg_StartDragging, - WebDropData /* drop_data */, + content::DropData /* drop_data */, WebKit::WebDragOperationsMask /* ops_allowed */, SkBitmap /* image */, gfx::Vector2d /* image_offset */, diff --git a/content/common/drag_traits.h b/content/common/drag_traits.h index 17306d4..87d52ff 100644 --- a/content/common/drag_traits.h +++ b/content/common/drag_traits.h @@ -4,21 +4,21 @@ #include "content/common/drag_event_source_info.h" #include "content/public/common/common_param_traits.h" +#include "content/public/common/drop_data.h" #include "ipc/ipc_message_macros.h" #include "third_party/WebKit/public/web/WebDragOperation.h" #include "ui/gfx/point.h" -#include "webkit/common/webdropdata.h" #define IPC_MESSAGE_START DragMsgStart IPC_ENUM_TRAITS(WebKit::WebDragOperation) -IPC_STRUCT_TRAITS_BEGIN(WebDropData::FileInfo) +IPC_STRUCT_TRAITS_BEGIN(content::DropData::FileInfo) IPC_STRUCT_TRAITS_MEMBER(path) IPC_STRUCT_TRAITS_MEMBER(display_name) IPC_STRUCT_TRAITS_END() -IPC_STRUCT_TRAITS_BEGIN(WebDropData) +IPC_STRUCT_TRAITS_BEGIN(content::DropData) IPC_STRUCT_TRAITS_MEMBER(url) IPC_STRUCT_TRAITS_MEMBER(url_title) IPC_STRUCT_TRAITS_MEMBER(download_metadata) diff --git a/content/content_common.gypi b/content/content_common.gypi index f291f84..ff57dc7 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -38,6 +38,8 @@ 'public/common/context_menu_params.cc', 'public/common/context_menu_params.h', 'public/common/console_message_level.h', + 'public/common/drop_data.cc', + 'public/common/drop_data.h', 'public/common/favicon_url.cc', 'public/common/favicon_url.h', 'public/common/file_chooser_params.cc', diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi index a2e4ba1..f14f4a6 100644 --- a/content/content_renderer.gypi +++ b/content/content_renderer.gypi @@ -98,6 +98,8 @@ 'renderer/dom_storage/webstoragearea_impl.h', 'renderer/dom_storage/webstoragenamespace_impl.cc', 'renderer/dom_storage/webstoragenamespace_impl.h', + 'renderer/drop_data_builder.cc', + 'renderer/drop_data_builder.h', 'renderer/external_popup_menu.cc', 'renderer/external_popup_menu.h', 'renderer/gamepad_shared_memory_reader.cc', diff --git a/content/port/browser/render_view_host_delegate_view.h b/content/port/browser/render_view_host_delegate_view.h index 8b7b953..375b867 100644 --- a/content/port/browser/render_view_host_delegate_view.h +++ b/content/port/browser/render_view_host_delegate_view.h @@ -13,7 +13,6 @@ #include "third_party/WebKit/public/web/WebDragOperation.h" class SkBitmap; -struct WebDropData; struct WebMenuItem; namespace gfx { @@ -25,6 +24,7 @@ class Vector2d; namespace content { struct ContextMenuParams; +struct DropData; // This class provides a way for the RenderViewHost to reach out to its // delegate's view. It only needs to be implemented by embedders if they don't @@ -48,10 +48,10 @@ class CONTENT_EXPORT RenderViewHostDelegateView { // The user started dragging content of the specified type within the // RenderView. Contextual information about the dragged content is supplied - // by WebDropData. If the delegate's view cannot start the drag for /any/ + // by DropData. If the delegate's view cannot start the drag for /any/ // reason, it must inform the renderer that the drag has ended; otherwise, // this results in bugs like http://crbug.com/157134. - virtual void StartDragging(const WebDropData& drop_data, + virtual void StartDragging(const DropData& drop_data, WebKit::WebDragOperationsMask allowed_ops, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, diff --git a/content/public/browser/render_view_host.h b/content/public/browser/render_view_host.h index ecb2fb7..20032c1 100644 --- a/content/public/browser/render_view_host.h +++ b/content/public/browser/render_view_host.h @@ -13,7 +13,6 @@ #include "third_party/WebKit/public/web/WebDragOperation.h" class GURL; -struct WebDropData; struct WebPreferences; namespace gfx { @@ -43,6 +42,7 @@ class RenderViewHostDelegate; class SessionStorageNamespace; class SiteInstance; struct CustomContextMenuContext; +struct DropData; // A RenderViewHost is responsible for creating and talking to a RenderView // object in a child process. It exposes a high level API to users, for things @@ -136,7 +136,7 @@ class CONTENT_EXPORT RenderViewHost : virtual public RenderWidgetHost { // D&d drop target messages that get sent to WebKit. virtual void DragTargetDragEnter( - const WebDropData& drop_data, + const DropData& drop_data, const gfx::Point& client_pt, const gfx::Point& screen_pt, WebKit::WebDragOperationsMask operations_allowed, diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc index a9299c8..0ba01b5 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc @@ -112,7 +112,7 @@ bool WebContentsDelegate::PreHandleKeyboardEvent( bool WebContentsDelegate::CanDragEnter( WebContents* source, - const WebDropData& data, + const DropData& data, WebKit::WebDragOperationsMask operations_allowed) { return true; } diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h index 392d5f6..40a6d54 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -24,7 +24,6 @@ #include "ui/gfx/vector2d.h" class GURL; -struct WebDropData; namespace base { class FilePath; @@ -41,6 +40,7 @@ class RenderViewHost; class WebContents; class WebContentsImpl; struct ContextMenuParams; +struct DropData; struct FileChooserParams; struct NativeWebKeyboardEvent; struct SSLStatus; @@ -272,7 +272,7 @@ class CONTENT_EXPORT WebContentsDelegate { // true to allow dragging and dropping on the web contents window or false to // cancel the operation. This method is used by Chromium Embedded Framework. virtual bool CanDragEnter(WebContents* source, - const WebDropData& data, + const DropData& data, WebKit::WebDragOperationsMask operations_allowed); // Render view drag n drop ended. diff --git a/content/public/browser/web_contents_view.h b/content/public/browser/web_contents_view.h index d6a483d..7e91bfa 100644 --- a/content/public/browser/web_contents_view.h +++ b/content/public/browser/web_contents_view.h @@ -14,9 +14,8 @@ #include "ui/gfx/rect.h" #include "ui/gfx/size.h" -struct WebDropData; - namespace content { +struct DropData; // The WebContentsView is an interface that is implemented by the platform- // dependent web contents views. The WebContents uses this interface to talk to @@ -77,7 +76,7 @@ class CONTENT_EXPORT WebContentsView { virtual void RestoreFocus() = 0; // Returns the current drop data, if any. - virtual WebDropData* GetDropData() const = 0; + virtual DropData* GetDropData() const = 0; // Get the bounds of the View, relative to the parent. virtual gfx::Rect GetViewBounds() const = 0; diff --git a/content/public/browser/web_drag_dest_delegate.h b/content/public/browser/web_drag_dest_delegate.h index acbdd58..cca3d2e 100644 --- a/content/public/browser/web_drag_dest_delegate.h +++ b/content/public/browser/web_drag_dest_delegate.h @@ -16,15 +16,14 @@ #endif class GURL; -struct WebDropData; namespace ui { class OSExchangeData; } namespace content { - class WebContents; +struct DropData; // An optional delegate that listens for drags of bookmark data. class WebDragDestDelegate { @@ -64,7 +63,7 @@ class WebDragDestDelegate { #elif defined(OS_WIN) // Allows the delegate to set data on the drag. If it doesn't want to set // data, it should return false. - virtual bool AddDragData(const WebDropData& drop_data, + virtual bool AddDragData(const DropData& drop_data, ui::OSExchangeData* data) = 0; #endif // TOOLKIT_GTK diff --git a/content/public/common/drop_data.cc b/content/public/common/drop_data.cc new file mode 100644 index 0000000..9e42dda --- /dev/null +++ b/content/public/common/drop_data.cc @@ -0,0 +1,25 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/public/common/drop_data.h" + +namespace content { + +DropData::FileInfo::FileInfo() { +} + +DropData::FileInfo::FileInfo(const base::string16& path, + const base::string16& display_name) + : path(path), + display_name(display_name) { +} + +DropData::DropData() + : referrer_policy(WebKit::WebReferrerPolicyDefault) { +} + +DropData::~DropData() { +} + +} // namespace content diff --git a/webkit/common/webdropdata.h b/content/public/common/drop_data.h index 293e2bb..008b3f9 100644 --- a/webkit/common/webdropdata.h +++ b/content/public/common/drop_data.h @@ -1,33 +1,28 @@ // Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// -// A struct for managing data being dropped on a webview. This represents a -// union of all the types of data that can be dropped in a platform neutral + +// A struct for managing data being dropped on a WebContents. This represents +// a union of all the types of data that can be dropped in a platform neutral // way. -#ifndef WEBKIT_COMMON_WEBDROPDATA_H_ -#define WEBKIT_COMMON_WEBDROPDATA_H_ +#ifndef CONTENT_PUBLIC_COMMON_DROP_DATA_H_ +#define CONTENT_PUBLIC_COMMON_DROP_DATA_H_ #include <map> #include <string> #include <vector> #include "base/strings/nullable_string16.h" -#include "base/strings/string16.h" +#include "content/common/content_export.h" #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" #include "url/gurl.h" -#include "webkit/common/webkit_common_export.h" - -struct IDataObject; -namespace WebKit { -class WebDragData; -} +namespace content { -struct WEBKIT_COMMON_EXPORT WebDropData { +struct CONTENT_EXPORT DropData { // The struct is used to represent a file in the drop data. - struct WEBKIT_COMMON_EXPORT FileInfo { + struct CONTENT_EXPORT FileInfo { FileInfo(); FileInfo(const base::string16& path, const base::string16& display_name); @@ -37,12 +32,8 @@ struct WEBKIT_COMMON_EXPORT WebDropData { base::string16 display_name; }; - // Construct from a WebDragData object. - explicit WebDropData(const WebKit::WebDragData&); - - WebDropData(); - - ~WebDropData(); + DropData(); + ~DropData(); // User is dragging a link into the webview. GURL url; @@ -77,4 +68,6 @@ struct WEBKIT_COMMON_EXPORT WebDropData { std::map<base::string16, base::string16> custom_data; }; -#endif // WEBKIT_COMMON_WEBDROPDATA_H_ +} // namespace content + +#endif // CONTENT_PUBLIC_COMMON_DROP_DATA_H_ diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc index 90855c4..3fb23bf 100644 --- a/content/renderer/browser_plugin/browser_plugin.cc +++ b/content/renderer/browser_plugin/browser_plugin.cc @@ -19,6 +19,7 @@ #include "content/renderer/browser_plugin/browser_plugin_bindings.h" #include "content/renderer/browser_plugin/browser_plugin_compositing_helper.h" #include "content/renderer/browser_plugin/browser_plugin_manager.h" +#include "content/renderer/drop_data_builder.h" #include "content/renderer/render_process_impl.h" #include "content/renderer/render_thread_impl.h" #include "content/renderer/v8_value_converter_impl.h" @@ -1523,7 +1524,7 @@ bool BrowserPlugin::handleDragStatusUpdate(WebKit::WebDragStatus drag_status, render_view_routing_id_, guest_instance_id_, drag_status, - WebDropData(drag_data), + DropDataBuilder::Build(drag_data), mask, position)); return true; diff --git a/webkit/common/webdropdata.cc b/content/renderer/drop_data_builder.cc index aee885ae..56bc81a 100644 --- a/webkit/common/webdropdata.cc +++ b/content/renderer/drop_data_builder.cc @@ -2,79 +2,66 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/common/webdropdata.h" +#include "content/renderer/drop_data_builder.h" -#include <utility> - -#include "base/logging.h" #include "base/strings/string_util.h" -#include "base/strings/utf_string_conversions.h" -#include "third_party/WebKit/public/platform/WebData.h" +#include "content/public/common/drop_data.h" #include "third_party/WebKit/public/platform/WebDragData.h" #include "third_party/WebKit/public/platform/WebString.h" -#include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/platform/WebVector.h" #include "ui/base/clipboard/clipboard.h" -using WebKit::WebData; using WebKit::WebDragData; -using WebKit::WebString; using WebKit::WebVector; -WebDropData::FileInfo::FileInfo() { -} +namespace content { -WebDropData::FileInfo::FileInfo(const base::string16& path, - const base::string16& display_name) - : path(path), - display_name(display_name) { -} +//static +DropData DropDataBuilder::Build(const WebDragData& drag_data) { + DropData result; + result.referrer_policy = WebKit::WebReferrerPolicyDefault; -WebDropData::WebDropData(const WebDragData& drag_data) - : referrer_policy(WebKit::WebReferrerPolicyDefault) { const WebVector<WebDragData::Item>& item_list = drag_data.items(); for (size_t i = 0; i < item_list.size(); ++i) { const WebDragData::Item& item = item_list[i]; switch (item.storageType) { case WebDragData::Item::StorageTypeString: { if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeText)) { - text = base::NullableString16(item.stringData, false); + result.text = base::NullableString16(item.stringData, false); break; } if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeURIList)) { - url = GURL(item.stringData); - url_title = item.title; + result.url = GURL(item.stringData); + result.url_title = item.title; break; } if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeDownloadURL)) { - download_metadata = item.stringData; + result.download_metadata = item.stringData; break; } if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeHTML)) { - html = base::NullableString16(item.stringData, false); - html_base_url = item.baseURL; + result.html = base::NullableString16(item.stringData, false); + result.html_base_url = item.baseURL; break; } - custom_data.insert(std::make_pair(item.stringType, item.stringData)); + result.custom_data.insert( + std::make_pair(item.stringType, item.stringData)); break; } case WebDragData::Item::StorageTypeBinaryData: - file_contents.assign(item.binaryData.data(), - item.binaryData.size()); - file_description_filename = item.title; + result.file_contents.assign(item.binaryData.data(), + item.binaryData.size()); + result.file_description_filename = item.title; break; case WebDragData::Item::StorageTypeFilename: // TODO(varunjain): This only works on chromeos. Support win/mac/gtk. - filenames.push_back(FileInfo(item.filenameData, - item.displayNameData)); + result.filenames.push_back( + DropData::FileInfo(item.filenameData, item.displayNameData)); break; } } -} -WebDropData::WebDropData() - : referrer_policy(WebKit::WebReferrerPolicyDefault) { + return result; } -WebDropData::~WebDropData() { -} +} // namespace content diff --git a/content/renderer/drop_data_builder.h b/content/renderer/drop_data_builder.h new file mode 100644 index 0000000..4870d47 --- /dev/null +++ b/content/renderer/drop_data_builder.h @@ -0,0 +1,22 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_RENDERER_DROP_DATA_BUILDER_H_ +#define CONTENT_RENDERER_DROP_DATA_BUILDER_H_ + +namespace WebKit { +class WebDragData; +} + +namespace content { +struct DropData; + +class DropDataBuilder { + public: + static DropData Build(const WebKit::WebDragData& data); +}; + +} // namespace content + +#endif // CONTENT_RENDERER_DROP_DATA_BUILDER_H_ diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index f61a275..34b0173 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -52,6 +52,7 @@ #include "content/public/common/content_constants.h" #include "content/public/common/content_switches.h" #include "content/public/common/context_menu_params.h" +#include "content/public/common/drop_data.h" #include "content/public/common/favicon_url.h" #include "content/public/common/file_chooser_params.h" #include "content/public/common/ssl_status.h" @@ -78,6 +79,7 @@ #include "content/renderer/disambiguation_popup_helper.h" #include "content/renderer/dom_automation_controller.h" #include "content/renderer/dom_storage/webstoragenamespace_impl.h" +#include "content/renderer/drop_data_builder.h" #include "content/renderer/external_popup_menu.h" #include "content/renderer/fetchers/alt_error_page_resource_fetcher.h" #include "content/renderer/geolocation_dispatcher.h" @@ -202,7 +204,6 @@ #include "ui/shell_dialogs/selected_file_info.h" #include "v8/include/v8.h" #include "webkit/common/dom_storage/dom_storage_types.h" -#include "webkit/common/webdropdata.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/weburlresponse_extradata_impl.h" #include "webkit/plugins/npapi/plugin_list.h" @@ -690,7 +691,7 @@ bool TouchEnabled() { #endif } -WebDragData WebDropDataToDragData(const WebDropData& drop_data) { +WebDragData DropDataToWebDragData(const DropData& drop_data) { std::vector<WebDragData::Item> item_list; // These fields are currently unused when dragging into WebKit. @@ -726,7 +727,7 @@ WebDragData WebDropDataToDragData(const WebDropData& drop_data) { item_list.push_back(item); } - for (std::vector<WebDropData::FileInfo>::const_iterator it = + for (std::vector<DropData::FileInfo>::const_iterator it = drop_data.filenames.begin(); it != drop_data.filenames.end(); ++it) { @@ -2589,7 +2590,7 @@ void RenderViewImpl::startDragging(WebFrame* frame, WebDragOperationsMask mask, const WebImage& image, const WebPoint& webImageOffset) { - WebDropData drop_data(data); + DropData drop_data(DropDataBuilder::Build(data)); drop_data.referrer_policy = frame->document().referrerPolicy(); gfx::Vector2d imageOffset(webImageOffset.x, webImageOffset.y); Send(new DragHostMsg_StartDragging(routing_id_, @@ -5343,13 +5344,13 @@ void RenderViewImpl::OnAllowBindings(int enabled_bindings_flags) { RenderProcess::current()->AddBindings(enabled_bindings_flags); } -void RenderViewImpl::OnDragTargetDragEnter(const WebDropData& drop_data, +void RenderViewImpl::OnDragTargetDragEnter(const DropData& drop_data, const gfx::Point& client_point, const gfx::Point& screen_point, WebDragOperationsMask ops, int key_modifiers) { WebDragOperation operation = webview()->dragTargetDragEnter( - WebDropDataToDragData(drop_data), + DropDataToWebDragData(drop_data), client_point, screen_point, ops, diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index 97d4b6b..7beac39 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h @@ -80,7 +80,6 @@ struct PP_NetAddress_Private; struct ViewMsg_Navigate_Params; struct ViewMsg_PostMessage_Params; struct ViewMsg_StopFinding_Params; -struct WebDropData; namespace ui { struct SelectedFileInfo; @@ -163,6 +162,7 @@ class SpeechRecognitionDispatcher; class StatsCollectionController; class WebPluginDelegateProxy; struct CustomContextMenuContext; +struct DropData; struct FaviconURL; struct FileChooserParams; struct RenderViewImplParams; @@ -983,7 +983,7 @@ class CONTENT_EXPORT RenderViewImpl void OnDragTargetDrop(const gfx::Point& client_pt, const gfx::Point& screen_pt, int key_modifiers); - void OnDragTargetDragEnter(const WebDropData& drop_data, + void OnDragTargetDragEnter(const DropData& drop_data, const gfx::Point& client_pt, const gfx::Point& screen_pt, WebKit::WebDragOperationsMask operations_allowed, diff --git a/content/renderer/webclipboard_impl.cc b/content/renderer/webclipboard_impl.cc index 7ba388d..78e0a80 100644 --- a/content/renderer/webclipboard_impl.cc +++ b/content/renderer/webclipboard_impl.cc @@ -8,6 +8,8 @@ #include "base/pickle.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "content/public/common/drop_data.h" +#include "content/renderer/drop_data_builder.h" #include "content/renderer/scoped_clipboard_writer_glue.h" #include "googleurl/src/gurl.h" #include "third_party/WebKit/public/platform/WebData.h" @@ -20,7 +22,6 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/clipboard/custom_data_helper.h" -#include "webkit/common/webdropdata.h" #include "webkit/glue/webkit_glue.h" #include "webkit/renderer/clipboard_utils.h" @@ -208,7 +209,7 @@ void WebClipboardImpl::writeImage( void WebClipboardImpl::writeDataObject(const WebDragData& data) { ScopedClipboardWriterGlue scw(client_); - WebDropData data_object(data); + const DropData& data_object = DropDataBuilder::Build(data); // TODO(dcheng): Properly support text/uri-list here. if (!data_object.text.is_null()) scw.WriteText(data_object.text.string()); diff --git a/content/test/test_web_contents_view.cc b/content/test/test_web_contents_view.cc index 3578b06..1d6f7db 100644 --- a/content/test/test_web_contents_view.cc +++ b/content/test/test_web_contents_view.cc @@ -22,7 +22,7 @@ void TestWebContentsView::ShowPopupMenu(const gfx::Rect& bounds, } void TestWebContentsView::StartDragging( - const WebDropData& drop_data, + const DropData& drop_data, WebKit::WebDragOperationsMask allowed_ops, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, @@ -72,7 +72,7 @@ void TestWebContentsView::StoreFocus() { void TestWebContentsView::RestoreFocus() { } -WebDropData* TestWebContentsView::GetDropData() const { +DropData* TestWebContentsView::GetDropData() const { return NULL; } diff --git a/content/test/test_web_contents_view.h b/content/test/test_web_contents_view.h index e5bc57f..149e300 100644 --- a/content/test/test_web_contents_view.h +++ b/content/test/test_web_contents_view.h @@ -25,7 +25,7 @@ class TestWebContentsView : public WebContentsViewPort, const std::vector<WebMenuItem>& items, bool right_aligned, bool allow_multiple_selection) OVERRIDE; - virtual void StartDragging(const WebDropData& drop_data, + virtual void StartDragging(const DropData& drop_data, WebKit::WebDragOperationsMask allowed_ops, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, @@ -46,7 +46,7 @@ class TestWebContentsView : public WebContentsViewPort, virtual void SetInitialFocus() OVERRIDE; virtual void StoreFocus() OVERRIDE; virtual void RestoreFocus() OVERRIDE; - virtual WebDropData* GetDropData() const OVERRIDE; + virtual DropData* GetDropData() const OVERRIDE; virtual gfx::Rect GetViewBounds() const OVERRIDE; #if defined(OS_MACOSX) virtual void SetAllowOverlappingViews(bool overlapping) OVERRIDE; diff --git a/ui/base/dragdrop/os_exchange_data_provider_aurax11.cc b/ui/base/dragdrop/os_exchange_data_provider_aurax11.cc index 318f9da..52aa7c6 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_aurax11.cc +++ b/ui/base/dragdrop/os_exchange_data_provider_aurax11.cc @@ -16,7 +16,7 @@ #include "ui/base/x/x11_util.h" // Note: the GetBlah() methods are used immediately by the -// web_contents_view_aura.cc:PrepareWebDropData(), while the omnibox is a +// web_contents_view_aura.cc:PrepareDropData(), while the omnibox is a // little more discriminating and calls HasBlah() before trying to get the // information. diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index 4b764a0..a2b9f0f 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -149,8 +149,6 @@ ], 'sources': [ - '../common/webdropdata.cc', - '../common/webdropdata.h', '../common/webkit_common_export.h', '../common/webmenuitem.cc', '../common/webmenuitem.h', |