summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-07 23:25:03 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-07 23:25:03 +0000
commit0bcde72cee05bb587e7069a490081834e6ceac1c (patch)
tree7b5e59f055a1f038ceb7e891a054c26acc6d1d7e /webkit
parent4f8b87a4c6d06ebad053160a61fc90492afc8439 (diff)
downloadchromium_src-0bcde72cee05bb587e7069a490081834e6ceac1c.zip
chromium_src-0bcde72cee05bb587e7069a490081834e6ceac1c.tar.gz
chromium_src-0bcde72cee05bb587e7069a490081834e6ceac1c.tar.bz2
Remove windows-isms from drag & drop. This
makes it more portable, fixes some bugs, and removes glue from port. Review URL: http://codereview.chromium.org/9801 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5032 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/SConscript.port7
-rw-r--r--webkit/build/glue/glue.vcproj8
-rw-r--r--webkit/build/port/port.vcproj36
-rw-r--r--webkit/glue/SConscript1
-rw-r--r--webkit/glue/clipboard_conversion.cc126
-rw-r--r--webkit/glue/clipboard_conversion.h28
-rw-r--r--webkit/glue/dragclient_impl.cc25
-rw-r--r--webkit/glue/webdropdata.cc3
-rw-r--r--webkit/glue/webdropdata.h17
-rw-r--r--webkit/glue/webkit_glue.h3
-rw-r--r--webkit/glue/webview_impl.cc29
-rw-r--r--webkit/glue/webview_impl.h3
-rw-r--r--webkit/port/page/chromium/EventHandlerChromium.cpp17
-rw-r--r--webkit/port/platform/chromium/ChromiumDataObject.cpp52
-rw-r--r--webkit/port/platform/chromium/ChromiumDataObject.h69
-rw-r--r--webkit/port/platform/chromium/ClipboardChromium.cpp399
-rw-r--r--webkit/port/platform/chromium/ClipboardChromium.h (renamed from webkit/port/platform/win/ClipboardWin.h)45
-rw-r--r--webkit/port/platform/chromium/DragDataChromium.cpp75
-rw-r--r--webkit/port/platform/chromium/DragDataRef.h4
-rw-r--r--webkit/port/platform/chromium/EditorChromium.cpp (renamed from webkit/port/platform/chromium/EditorLinux.cpp)8
-rw-r--r--webkit/port/platform/win/ClipboardUtilitiesWin.h5
-rw-r--r--webkit/port/platform/win/ClipboardWin.cpp808
-rw-r--r--webkit/port/platform/win/EditorWin.cpp52
-rw-r--r--webkit/port/platform/win/WCDataObject.cpp382
-rw-r--r--webkit/port/platform/win/WCDataObject.h74
-rw-r--r--webkit/tools/test_shell/drag_delegate.cc2
-rw-r--r--webkit/tools/test_shell/event_sending_controller.cc76
-rw-r--r--webkit/tools/test_shell/event_sending_controller.h11
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.cc38
-rw-r--r--webkit/webkit.xcodeproj/project.pbxproj26
30 files changed, 847 insertions, 1582 deletions
diff --git a/webkit/SConscript.port b/webkit/SConscript.port
index b7176fb..f1ef68b 100644
--- a/webkit/SConscript.port
+++ b/webkit/SConscript.port
@@ -44,11 +44,14 @@ input_files = [
'$PORT_DIR/platform/GKURL.cpp',
+ '$PORT_DIR/platform/chromium/ChromiumDataObject.cpp',
+ '$PORT_DIR/platform/chromium/ClipboardChromium.cpp',
'$PORT_DIR/platform/chromium/ContextMenuChromium.cpp',
'$PORT_DIR/platform/chromium/ContextMenuItemChromium.cpp',
'$PORT_DIR/platform/chromium/CursorChromium.cpp',
'$PORT_DIR/platform/chromium/DragDataChromium.cpp',
'$PORT_DIR/platform/chromium/DragImageChromium.cpp',
+ '$PORT_DIR/platform/chromium/EditorChromium.cpp',
'$PORT_DIR/platform/chromium/FileChooserChromium.cpp',
'$PORT_DIR/platform/chromium/FileSystemChromium.cpp',
'$PORT_DIR/platform/chromium/FramelessScrollView.cpp',
@@ -122,7 +125,6 @@ if env['PLATFORM'] == 'posix':
# Linux specific implementations
input_files.extend([
'$PORT_DIR/platform/chromium/ScreenLinux.cpp',
- '$PORT_DIR/platform/chromium/EditorLinux.cpp',
'$PORT_DIR/platform/chromium/IconLinux.cpp',
'$PORT_DIR/platform/graphics/chromium/GlyphPageTreeNodeLinux.cpp',
'$PORT_DIR/platform/chromium/PasteboardLinux.cpp',
@@ -151,11 +153,8 @@ if env['PLATFORM'] == 'win32':
'$PORT_DIR/platform/UniscribeStateTextRun.cpp',
'$PORT_DIR/platform/win/BString.cpp',
'$PORT_DIR/platform/win/ClipboardUtilitiesWin.cpp',
- '$PORT_DIR/platform/win/ClipboardWin.cpp',
- '$PORT_DIR/platform/win/EditorWin.cpp',
'$PORT_DIR/platform/win/PasteboardWin.cpp',
'$PORT_DIR/platform/win/SoundWin.cpp',
- '$PORT_DIR/platform/win/WCDataObject.cpp',
'$PORT_DIR/platform/graphics/FontCacheWin.cpp',
'$PORT_DIR/platform/graphics/FontPlatformDataWin.cpp',
'$PORT_DIR/platform/graphics/FontWin.cpp',
diff --git a/webkit/build/glue/glue.vcproj b/webkit/build/glue/glue.vcproj
index dcae341..6af0a12 100644
--- a/webkit/build/glue/glue.vcproj
+++ b/webkit/build/glue/glue.vcproj
@@ -293,6 +293,14 @@
>
</File>
<File
+ RelativePath="..\..\glue\clipboard_conversion.cc"
+ >
+ </File>
+ <File
+ RelativePath="..\..\glue\clipboard_conversion.h"
+ >
+ </File>
+ <File
RelativePath="..\..\glue\context_menu_client_impl.cc"
>
</File>
diff --git a/webkit/build/port/port.vcproj b/webkit/build/port/port.vcproj
index b18530a..e3f4f4c 100644
--- a/webkit/build/port/port.vcproj
+++ b/webkit/build/port/port.vcproj
@@ -699,51 +699,47 @@
>
</File>
<File
- RelativePath="..\..\port\platform\win\ClipboardWin.cpp"
- >
- </File>
- <File
- RelativePath="..\..\port\platform\win\ClipboardWin.h"
+ RelativePath="..\..\port\platform\win\COMPtr.h"
>
</File>
<File
- RelativePath="..\..\port\platform\win\COMPtr.h"
+ RelativePath="..\..\port\platform\win\PasteboardWin.cpp"
>
</File>
<File
- RelativePath="..\..\port\platform\win\EditorWin.cpp"
+ RelativePath="..\..\port\platform\win\SoundWin.cpp"
>
</File>
+ </Filter>
+ <Filter
+ Name="chromium"
+ >
<File
- RelativePath="..\..\port\platform\win\PasteboardWin.cpp"
+ RelativePath="..\..\port\platform\chromium\ChromiumBridge.h"
>
</File>
<File
- RelativePath="..\..\port\platform\win\SoundWin.cpp"
+ RelativePath="..\..\port\platform\chromium\ContextMenuChromium.cpp"
>
</File>
<File
- RelativePath="..\..\port\platform\win\WCDataObject.cpp"
+ RelativePath="..\..\port\platform\chromium\ContextMenuItemChromium.cpp"
>
</File>
<File
- RelativePath="..\..\port\platform\win\WCDataObject.h"
+ RelativePath="..\..\port\platform\chromium\ChromiumDataObject.cpp"
>
</File>
- </Filter>
- <Filter
- Name="chromium"
- >
<File
- RelativePath="..\..\port\platform\chromium\ChromiumBridge.h"
+ RelativePath="..\..\port\platform\chromium\ChromiumDataObject.h"
>
</File>
<File
- RelativePath="..\..\port\platform\chromium\ContextMenuChromium.cpp"
+ RelativePath="..\..\port\platform\chromium\ClipboardChromium.cpp"
>
</File>
<File
- RelativePath="..\..\port\platform\chromium\ContextMenuItemChromium.cpp"
+ RelativePath="..\..\port\platform\chromium\ClipboardChromium.h"
>
</File>
<File
@@ -759,6 +755,10 @@
>
</File>
<File
+ RelativePath="..\..\port\platform\chromium\EditorChromium.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\port\platform\chromium\FileChooserChromium.cpp"
>
</File>
diff --git a/webkit/glue/SConscript b/webkit/glue/SConscript
index 0870d6b..96a34ff 100644
--- a/webkit/glue/SConscript
+++ b/webkit/glue/SConscript
@@ -24,6 +24,7 @@ input_files = [
'cache_manager.cc',
'chrome_client_impl.cc',
'chromium_bridge_impl.cc',
+ 'clipboard_conversion.cc',
'context_menu_client_impl.cc',
'cpp_binding_example.cc',
'cpp_bound_class.cc',
diff --git a/webkit/glue/clipboard_conversion.cc b/webkit/glue/clipboard_conversion.cc
new file mode 100644
index 0000000..9df3f59
--- /dev/null
+++ b/webkit/glue/clipboard_conversion.cc
@@ -0,0 +1,126 @@
+// Copyright (c) 2008 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 "config.h"
+
+#include "webkit/glue/clipboard_conversion.h"
+
+#include "build/build_config.h"
+
+#include "ChromiumDataObject.h"
+#if defined(OS_WIN)
+#include "ClipboardUtilitiesWin.h"
+#endif
+#include "SharedBuffer.h"
+
+#include "webkit/glue/glue_util.h"
+
+namespace {
+
+// TODO(tc): CF_HTML logic should move into the browser process since it only
+// makes sense on Windows.
+std::wstring HTMLToCFHTML(const WebCore::String& html,
+ const WebCore::KURL& url) {
+#if defined(OS_WIN)
+ Vector<char> cf_html_data;
+ markupToCF_HTML(html, url, cf_html_data);
+ WebCore::String cf_html_str(cf_html_data.data(), cf_html_data.size());
+ return webkit_glue::StringToStdWString(cf_html_str);
+#else
+ return std::wstring();
+#endif
+}
+
+WebCore::String CFHTMLToHTML(const std::wstring& cf_html_wstr) {
+#if defined(OS_WIN)
+ WebCore::String cf_html = webkit_glue::StdWStringToString(cf_html_wstr);
+ // Obtain baseURL if present.
+ WebCore::String src_url_str("sourceURL:");
+ WebCore::String src_url;
+ unsigned int line_start = cf_html.find(src_url_str, 0, false);
+ if (line_start != -1) {
+ unsigned int src_end = cf_html.find("\n", line_start, false);
+ unsigned int src_start = line_start + src_url_str.length();
+ WebCore::String raw_src_url = cf_html.substring(src_start, src_end - src_start);
+ replaceNBSPWithSpace(raw_src_url);
+ src_url = raw_src_url.stripWhiteSpace();
+ }
+
+ // find the markup between "<!--StartFragment -->" and "<!--EndFragment
+ // -->", accounting for browser quirks
+ unsigned markup_start = cf_html.find("<html", 0, false);
+ unsigned tag_start = cf_html.find("startfragment", markup_start, false);
+ unsigned fragment_start = cf_html.find('>', tag_start) + 1;
+ unsigned tag_end = cf_html.find("endfragment", fragment_start, false);
+ unsigned fragment_end = cf_html.reverseFind('<', tag_end);
+ WebCore::String markup = cf_html.substring(fragment_start,
+ fragment_end - fragment_start).stripWhiteSpace();
+ return markup;
+#else
+ return WebCore::String();
+#endif
+}
+
+} // namespace
+
+namespace webkit_glue {
+
+WebDropData ChromiumDataObjectToWebDropData(
+ WebCore::ChromiumDataObject* data_object) {
+ WebDropData drop_data;
+ drop_data.url = KURLToGURL(data_object->url);
+ drop_data.url_title = StringToStdWString(data_object->url_title);
+
+ for (size_t i = 0; i < data_object->filenames.size(); ++i) {
+ drop_data.filenames.push_back(StringToStdWString(
+ data_object->filenames[i]));
+ }
+
+ drop_data.plain_text = StringToStdWString(data_object->plain_text);
+
+ drop_data.cf_html = HTMLToCFHTML(data_object->text_html, data_object->url);
+
+ drop_data.text_html = StringToStdWString(data_object->text_html);
+
+ drop_data.file_description_filename = StringToStdWString(
+ data_object->file_content_filename);
+ if (data_object->file_content) {
+ drop_data.file_contents.assign(data_object->file_content->data(),
+ data_object->file_content->size());
+ }
+
+ return drop_data;
+}
+
+PassRefPtr<WebCore::ChromiumDataObject> WebDropDataToChromiumDataObject(
+ const WebDropData& drop_data) {
+ RefPtr<WebCore::ChromiumDataObject> data_object =
+ WebCore::ChromiumDataObject::create();
+ data_object->url = GURLToKURL(drop_data.url);
+ data_object->url_title = StdWStringToString(drop_data.url_title);
+
+ for (size_t i = 0; i < drop_data.filenames.size(); ++i) {
+ data_object->filenames.append(StdWStringToString(drop_data.filenames[i]));
+ }
+
+ data_object->plain_text = StdWStringToString(drop_data.plain_text);
+
+ data_object->text_html = StdWStringToString(drop_data.text_html);
+ if (data_object->text_html.isEmpty()) {
+ // Use CF_HTML only if there's no text/html data.
+ data_object->text_html = CFHTMLToHTML(drop_data.cf_html);
+ }
+
+ data_object->file_content_filename = StdWStringToString(
+ drop_data.file_description_filename);
+ if (!drop_data.file_contents.empty()) {
+ data_object->file_content =
+ WebCore::SharedBuffer::create(drop_data.file_contents.data(),
+ drop_data.file_contents.size());
+ }
+
+ return data_object;
+}
+
+} // namespace webkit_glue
diff --git a/webkit/glue/clipboard_conversion.h b/webkit/glue/clipboard_conversion.h
new file mode 100644
index 0000000..d6acd2f
--- /dev/null
+++ b/webkit/glue/clipboard_conversion.h
@@ -0,0 +1,28 @@
+// Copyright (c) 2008 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.
+//
+// This file contains helper methods for converting WebDropData objects to
+// WebKit ChromiumDataObject and back.
+#ifndef WEBKIT_GLUE_CLIPBOARD_CONVERSION_H_
+#define WEBKIT_GLUE_CLIPBOARD_CONVERSION_H_
+
+#include "webkit/glue/webdropdata.h"
+
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+class ChromiumDataObject;
+}
+
+namespace webkit_glue {
+
+WebDropData ChromiumDataObjectToWebDropData(
+ WebCore::ChromiumDataObject* data_object);
+
+PassRefPtr<WebCore::ChromiumDataObject> WebDropDataToChromiumDataObject(
+ const WebDropData& drop_data);
+
+} // namespace webkit_glue
+
+#endif // WEBKIT_GLUE_CLIPBOARD_CONVERSION_H_
diff --git a/webkit/glue/dragclient_impl.cc b/webkit/glue/dragclient_impl.cc
index b0f1cf8..25654b0 100644
--- a/webkit/glue/dragclient_impl.cc
+++ b/webkit/glue/dragclient_impl.cc
@@ -6,17 +6,8 @@
#include "base/compiler_specific.h"
-#include "build/build_config.h"
-
-#if defined(OS_WIN)
-#include <objidl.h>
-#endif
-
MSVC_PUSH_WARNING_LEVEL(0);
-#if defined(OS_WIN)
-#include "ClipboardWin.h"
-#include "COMPtr.h"
-#endif
+#include "ClipboardChromium.h"
#include "DragData.h"
#include "Frame.h"
#include "HitTestResult.h"
@@ -29,6 +20,7 @@ MSVC_POP_WARNING();
#include "base/logging.h"
#include "base/string_util.h"
+#include "webkit/glue/clipboard_conversion.h"
#include "webkit/glue/context_node_types.h"
#include "webkit/glue/glue_util.h"
#include "webkit/glue/webdropdata.h"
@@ -68,15 +60,11 @@ void DragClientImpl::startDrag(WebCore::DragImageRef drag_image,
// Add a ref to the frame just in case a load occurs mid-drag.
RefPtr<WebCore::Frame> frame_protector = frame;
-#if defined(OS_WIN)
- COMPtr<IDataObject> data_object(
- static_cast<WebCore::ClipboardWin*>(clipboard)->dataObject());
+ RefPtr<WebCore::ChromiumDataObject> data_object =
+ static_cast<WebCore::ClipboardChromium*>(clipboard)->dataObject();
DCHECK(data_object.get());
- WebDropData drop_data;
- WebDropData::PopulateWebDropData(data_object.get(), &drop_data);
-#elif defined(OS_MACOSX) || defined(OS_LINUX)
- WebDropData drop_data;
-#endif
+ WebDropData drop_data = webkit_glue::ChromiumDataObjectToWebDropData(
+ data_object.get());
webview_->StartDragging(drop_data);
}
@@ -92,4 +80,3 @@ WebCore::DragImageRef DragClientImpl::createDragImageForLink(
void DragClientImpl::dragControllerDestroyed() {
delete this;
}
-
diff --git a/webkit/glue/webdropdata.cc b/webkit/glue/webdropdata.cc
index 8a89346..28ed52d 100644
--- a/webkit/glue/webdropdata.cc
+++ b/webkit/glue/webdropdata.cc
@@ -24,8 +24,5 @@ void WebDropData::PopulateWebDropData(IDataObject* data_object,
ClipboardUtil::GetTextHtml(data_object, &drop_data->text_html);
ClipboardUtil::GetFileContents(data_object,
&drop_data->file_description_filename, &drop_data->file_contents);
-
- // data_object used by the test_shell.
- drop_data->data_object = data_object;
}
diff --git a/webkit/glue/webdropdata.h b/webkit/glue/webdropdata.h
index f941a78..38d67b4 100644
--- a/webkit/glue/webdropdata.h
+++ b/webkit/glue/webdropdata.h
@@ -6,8 +6,8 @@
// union of all the types of data that can be dropped in a platform neutral
// way.
-#ifndef WEBKIT_GLUE_WEBDROPDATA_H__
-#define WEBKIT_GLUE_WEBDROPDATA_H__
+#ifndef WEBKIT_GLUE_WEBDROPDATA_H_
+#define WEBKIT_GLUE_WEBDROPDATA_H_
#include <string>
#include <vector>
@@ -27,6 +27,9 @@ struct WebDropData {
std::wstring plain_text;
// User is dragging MS HTML into the webview (e.g., out of IE).
+ // TODO(tc): We should remove this from webdropdata because not all platforms
+ // have cf_html. On the browser side, we should do the necessary conversions
+ // so we still support cf_html.
std::wstring cf_html;
// User is dragging text/html into the webview (e.g., out of Firefox).
@@ -36,15 +39,11 @@ struct WebDropData {
std::wstring file_description_filename;
std::string file_contents;
- // A reference to the underlying IDataObject. This is a Windows drag and
- // drop specific object. This should only be used by the test shell.
- IDataObject* data_object;
-
// Helper method for converting Window's specific IDataObject to a WebDropData
- // object.
+ // object. TODO(tc): Move this to the browser side since it's Windows
+ // specific and no longer used in webkit.
static void PopulateWebDropData(IDataObject* data_object,
WebDropData* drop_data);
};
-#endif // WEBKIT_GLUE_WEBDROPDATA_H__
-
+#endif // WEBKIT_GLUE_WEBDROPDATA_H_
diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h
index 2691b25..1d80e86 100644
--- a/webkit/glue/webkit_glue.h
+++ b/webkit/glue/webkit_glue.h
@@ -196,7 +196,8 @@ HCURSOR LoadCursor(int cursor_id);
// Glue to access the clipboard.
// Get a clipboard that can be used to construct a ScopedClipboardWriterGlue.
-Clipboard* ClipboardGetClipboard();
+// TODO(tc): Move base/clipboard.h into the base:: namespace.
+::Clipboard* ClipboardGetClipboard();
// Tests whether the clipboard contains a certain format
bool ClipboardIsFormatAvailable(unsigned int format);
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index c807b31..bf46c9d 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -83,6 +83,7 @@ MSVC_POP_WARNING();
#include "base/message_loop.h"
#include "base/string_util.h"
#include "webkit/glue/chrome_client_impl.h"
+#include "webkit/glue/clipboard_conversion.h"
#include "webkit/glue/context_menu_client_impl.h"
#include "webkit/glue/dragclient_impl.h"
#include "webkit/glue/editor_client_impl.h"
@@ -1413,14 +1414,10 @@ bool WebViewImpl::DragTargetDragEnter(const WebDropData& drop_data,
int client_x, int client_y, int screen_x, int screen_y) {
DCHECK(!current_drop_data_.get());
- // Copy drop_data into current_drop_data_.
- WebDropData* drop_data_copy = new WebDropData;
- *drop_data_copy = drop_data;
- current_drop_data_.reset(drop_data_copy);
+ current_drop_data_ = webkit_glue::WebDropDataToChromiumDataObject(drop_data);
- DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()),
- IntPoint(client_x, client_y), IntPoint(screen_x, screen_y),
- kDropTargetOperation);
+ DragData drag_data(current_drop_data_.get(), IntPoint(client_x, client_y),
+ IntPoint(screen_x, screen_y), kDropTargetOperation);
DragOperation effect = page_->dragController()->dragEntered(&drag_data);
return effect != DragOperationNone;
}
@@ -1428,29 +1425,27 @@ bool WebViewImpl::DragTargetDragEnter(const WebDropData& drop_data,
bool WebViewImpl::DragTargetDragOver(
int client_x, int client_y, int screen_x, int screen_y) {
DCHECK(current_drop_data_.get());
- DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()),
- IntPoint(client_x, client_y), IntPoint(screen_x, screen_y),
- kDropTargetOperation);
+ DragData drag_data(current_drop_data_.get(), IntPoint(client_x, client_y),
+ IntPoint(screen_x, screen_y), kDropTargetOperation);
DragOperation effect = page_->dragController()->dragUpdated(&drag_data);
return effect != DragOperationNone;
}
void WebViewImpl::DragTargetDragLeave() {
DCHECK(current_drop_data_.get());
- DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()),
- IntPoint(), IntPoint(), DragOperationNone);
+ DragData drag_data(current_drop_data_.get(), IntPoint(), IntPoint(),
+ DragOperationNone);
page_->dragController()->dragExited(&drag_data);
- current_drop_data_.reset(NULL);
+ current_drop_data_ = NULL;
}
void WebViewImpl::DragTargetDrop(
int client_x, int client_y, int screen_x, int screen_y) {
DCHECK(current_drop_data_.get());
- DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()),
- IntPoint(client_x, client_y), IntPoint(screen_x, screen_y),
- kDropTargetOperation);
+ DragData drag_data(current_drop_data_.get(), IntPoint(client_x, client_y),
+ IntPoint(screen_x, screen_y), kDropTargetOperation);
page_->dragController()->performDrag(&drag_data);
- current_drop_data_.reset(NULL);
+ current_drop_data_ = NULL;
}
SearchableFormData* WebViewImpl::CreateSearchableFormDataForFocusedNode() {
diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h
index 83cddebd..e5b5e8e 100644
--- a/webkit/glue/webview_impl.h
+++ b/webkit/glue/webview_impl.h
@@ -22,6 +22,7 @@ MSVC_PUSH_WARNING_LEVEL(0);
MSVC_POP_WARNING();
namespace WebCore {
+class ChromiumDataObject;
class Frame;
class HistoryItem;
class KeyboardEvent;
@@ -251,7 +252,7 @@ class WebViewImpl : public WebView, public WebCore::BackForwardListClient {
WebPreferences webprefs_;
// A copy of the web drop data object we received from the browser.
- scoped_ptr<WebDropData> current_drop_data_;
+ RefPtr<WebCore::ChromiumDataObject> current_drop_data_;
private:
// Returns true if the event was actually processed.
diff --git a/webkit/port/page/chromium/EventHandlerChromium.cpp b/webkit/port/page/chromium/EventHandlerChromium.cpp
index d7082e5..2ac7d07 100644
--- a/webkit/port/page/chromium/EventHandlerChromium.cpp
+++ b/webkit/port/page/chromium/EventHandlerChromium.cpp
@@ -26,7 +26,8 @@
#include "config.h"
#include "EventHandler.h"
-#include "Clipboard.h"
+#include "ChromiumDataObject.h"
+#include "ClipboardChromium.h"
#include "Cursor.h"
#include "FloatPoint.h"
#include "FocusController.h"
@@ -42,11 +43,6 @@
#include "SelectionController.h"
#include "NotImplemented.h"
-#if PLATFORM(WIN_OS)
-#include "ClipboardWin.h"
-#include "WCDataObject.h"
-#endif
-
namespace WebCore {
unsigned EventHandler::s_accessKeyModifiers = PlatformKeyboardEvent::AltKey;
@@ -132,13 +128,8 @@ bool EventHandler::eventActivatedView(const PlatformMouseEvent& event) const
PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const
{
-#if PLATFORM(WIN_OS)
- COMPtr<WCDataObject> dataObject;
- WCDataObject::createInstance(&dataObject);
- return ClipboardWin::create(true, dataObject.get(), ClipboardWritable);
-#else
- return PassRefPtr<Clipboard>(0);
-#endif
+ RefPtr<ChromiumDataObject> dataObject = ChromiumDataObject::create();
+ return ClipboardChromium::create(true, dataObject.get(), ClipboardWritable);
}
void EventHandler::focusDocumentView()
diff --git a/webkit/port/platform/chromium/ChromiumDataObject.cpp b/webkit/port/platform/chromium/ChromiumDataObject.cpp
new file mode 100644
index 0000000..ddf9cd9
--- /dev/null
+++ b/webkit/port/platform/chromium/ChromiumDataObject.cpp
@@ -0,0 +1,52 @@
+// Copyright (c) 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "config.h"
+#include "ChromiumDataObject.h"
+
+using namespace WebCore;
+
+void ChromiumDataObject::clear()
+{
+ url = KURL();
+ url_title = "";
+ filenames.clear();
+ plain_text = "";
+ text_html = "";
+ file_content_filename = "";
+ if (file_content)
+ file_content->clear();
+}
+
+bool ChromiumDataObject::hasData()
+{
+ return !url.isEmpty() || !filenames.isEmpty() ||
+ !plain_text.isEmpty() || !text_html.isEmpty() ||
+ file_content;
+}
diff --git a/webkit/port/platform/chromium/ChromiumDataObject.h b/webkit/port/platform/chromium/ChromiumDataObject.h
new file mode 100644
index 0000000..f6178f3
--- /dev/null
+++ b/webkit/port/platform/chromium/ChromiumDataObject.h
@@ -0,0 +1,69 @@
+// Copyright (c) 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// A data object for holding data that would be in a clipboard or moved
+// during a drag&drop operation. This is the data that webkit is aware
+// of and is not specific to a platform.
+
+#ifndef ChromiumDataObject_h
+#define ChromiumDataObject_h
+
+#include "KURL.h"
+#include "PlatformString.h"
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+ class ChromiumDataObject : public RefCounted<ChromiumDataObject> {
+ public:
+ static PassRefPtr<ChromiumDataObject> create() {
+ return adoptRef(new ChromiumDataObject);
+ }
+
+ void clear();
+ bool hasData();
+
+ KURL url;
+ String url_title;
+
+ Vector<String> filenames;
+
+ String plain_text;
+
+ String text_html;
+
+ String file_content_filename;
+ RefPtr<SharedBuffer> file_content;
+ private:
+ ChromiumDataObject() {}
+
+ };
+}
+
+#endif // ChromiumDataObject_h
diff --git a/webkit/port/platform/chromium/ClipboardChromium.cpp b/webkit/port/platform/chromium/ClipboardChromium.cpp
new file mode 100644
index 0000000..c080eea
--- /dev/null
+++ b/webkit/port/platform/chromium/ClipboardChromium.cpp
@@ -0,0 +1,399 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#pragma warning(push, 0)
+#include "CachedImage.h"
+#include "ChromiumDataObject.h"
+#include "ClipboardChromium.h"
+#include "CSSHelper.h"
+#include "CString.h"
+#include "Document.h"
+#include "DragData.h"
+#include "Editor.h"
+#include "Element.h"
+#include "EventHandler.h"
+#include "Frame.h"
+#include "FrameLoader.h"
+#include "FrameView.h"
+#include "HTMLNames.h"
+#include "Image.h"
+#include "MIMETypeRegistry.h"
+#include "markup.h"
+#include "Page.h"
+#include "Pasteboard.h"
+#include "PlatformString.h"
+#include "Range.h"
+#include "RenderImage.h"
+#include "StringBuilder.h"
+#include "StringHash.h"
+#include <wtf/RefPtr.h>
+#pragma warning(pop)
+
+// TODO(tc): Once the clipboard methods get moved to the bridge,
+// we can get rid of our dependency on webkit_glue and base.
+#undef LOG
+#include "base/string_util.h"
+#include "webkit/glue/glue_util.h"
+#include "webkit/glue/webkit_glue.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+// We provide the IE clipboard types (URL and Text), and the clipboard types specified in the WHATWG Web Applications 1.0 draft
+// see http://www.whatwg.org/specs/web-apps/current-work/ Section 6.3.5.3
+
+enum ClipboardDataType { ClipboardDataTypeNone, ClipboardDataTypeURL, ClipboardDataTypeText };
+
+static ClipboardDataType clipboardTypeFromMIMEType(const String& type)
+{
+ String qType = type.stripWhiteSpace().lower();
+
+ // two special cases for IE compatibility
+ if (qType == "text" || qType == "text/plain" || qType.startsWith("text/plain;"))
+ return ClipboardDataTypeText;
+ if (qType == "url" || qType == "text/uri-list")
+ return ClipboardDataTypeURL;
+
+ return ClipboardDataTypeNone;
+}
+
+#if PLATFORM(WIN_OS)
+static void replaceNewlinesWithWindowsStyleNewlines(String& str)
+{
+ static const UChar Newline = '\n';
+ static const char* const WindowsNewline("\r\n");
+ str.replace(Newline, WindowsNewline);
+}
+#endif
+
+static void replaceNBSPWithSpace(String& str)
+{
+ static const UChar NonBreakingSpaceCharacter = 0xA0;
+ static const UChar SpaceCharacter = ' ';
+ str.replace(NonBreakingSpaceCharacter, SpaceCharacter);
+}
+
+
+ClipboardChromium::ClipboardChromium(bool isForDragging,
+ ChromiumDataObject* dataObject,
+ ClipboardAccessPolicy policy)
+ : Clipboard(policy, isForDragging)
+ , m_dataObject(dataObject)
+{
+}
+
+PassRefPtr<ClipboardChromium> ClipboardChromium::create(bool isForDragging,
+ ChromiumDataObject* dataObject, ClipboardAccessPolicy policy)
+{
+ return adoptRef(new ClipboardChromium(isForDragging, dataObject, policy));
+}
+
+void ClipboardChromium::clearData(const String& type)
+{
+ if (policy() != ClipboardWritable || !m_dataObject)
+ return;
+
+ ClipboardDataType dataType = clipboardTypeFromMIMEType(type);
+
+ if (dataType == ClipboardDataTypeURL) {
+ m_dataObject->url = KURL();
+ m_dataObject->url_title = "";
+ }
+ if (dataType == ClipboardDataTypeText) {
+ m_dataObject->plain_text = "";
+ }
+}
+
+void ClipboardChromium::clearAllData()
+{
+ if (policy() != ClipboardWritable)
+ return;
+
+ m_dataObject->clear();
+}
+
+String ClipboardChromium::getData(const String& type, bool& success) const
+{
+ success = false;
+ if (policy() != ClipboardReadable || !m_dataObject) {
+ return "";
+ }
+
+ ClipboardDataType dataType = clipboardTypeFromMIMEType(type);
+ if (dataType == ClipboardDataTypeText) {
+ String text;
+ if (!isForDragging()) {
+#if PLATFORM(WIN_OS)
+ // If this isn't for a drag, it's for a cut/paste event handler.
+ // In this case, we need to use our glue methods to access the
+ // clipboard contents.
+ std::wstring wideStr;
+ // TODO(tc): Once the clipboard methods get moved to the bridge,
+ // we can get rid of our dependency on webkit_glue.
+ webkit_glue::ClipboardReadText(&wideStr);
+ if (wideStr.empty()) {
+ std::string asciiText;
+ webkit_glue::ClipboardReadAsciiText(&asciiText);
+ wideStr = ASCIIToWide(asciiText);
+ }
+ success = !wideStr.empty();
+ text = webkit_glue::StdWStringToString(wideStr);
+#endif
+ } else if (!m_dataObject->plain_text.isEmpty()) {
+ success = true;
+ text = m_dataObject->plain_text;
+ }
+ return text;
+ } else if (dataType == ClipboardDataTypeURL) {
+ if (!m_dataObject->url.isEmpty()) {
+ success = true;
+ return m_dataObject->url.string();
+ }
+ }
+
+ return "";
+}
+
+bool ClipboardChromium::setData(const String& type, const String& data)
+{
+ if (policy() != ClipboardWritable)
+ return false;
+
+ ClipboardDataType winType = clipboardTypeFromMIMEType(type);
+
+ if (winType == ClipboardDataTypeURL) {
+ m_dataObject->url = KURL(data);
+ return m_dataObject->url.isValid();
+ }
+
+ if (winType == ClipboardDataTypeText) {
+ m_dataObject->plain_text = data;
+ return true;
+ }
+ return false;
+}
+
+// extensions beyond IE's API
+HashSet<String> ClipboardChromium::types() const
+{
+ HashSet<String> results;
+ if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable)
+ return results;
+
+ if (!m_dataObject)
+ return results;
+
+ if (m_dataObject->url.isValid()) {
+ results.add("URL");
+ results.add("text/uri-list");
+ }
+
+ if (!m_dataObject->plain_text.isEmpty()) {
+ results.add("Text");
+ results.add("text/plain");
+ }
+
+ return results;
+}
+
+void ClipboardChromium::setDragImage(CachedImage* image, Node *node, const IntPoint &loc)
+{
+ if (policy() != ClipboardImageWritable && policy() != ClipboardWritable)
+ return;
+
+ if (m_dragImage)
+ m_dragImage->removeClient(this);
+ m_dragImage = image;
+ if (m_dragImage)
+ m_dragImage->addClient(this);
+
+ m_dragLoc = loc;
+ m_dragImageElement = node;
+}
+
+void ClipboardChromium::setDragImage(CachedImage* img, const IntPoint &loc)
+{
+ setDragImage(img, 0, loc);
+}
+
+void ClipboardChromium::setDragImageElement(Node *node, const IntPoint &loc)
+{
+ setDragImage(0, node, loc);
+}
+
+DragImageRef ClipboardChromium::createDragImage(IntPoint& loc) const
+{
+ DragImageRef result = 0;
+ if (m_dragImage) {
+ result = createDragImageFromImage(m_dragImage->image());
+ loc = m_dragLoc;
+ }
+ return result;
+}
+
+static String imageToMarkup(const String& url, Element* element)
+{
+ StringBuilder markup;
+ markup.append("<img src=\"");
+ markup.append(url);
+ markup.append("\"");
+ // Copy over attributes. If we are dragging an image, we expect things like
+ // the id to be copied as well.
+ NamedAttrMap* attrs = element->attributes();
+ unsigned int length = attrs->length();
+ for (unsigned int i = 0; i < length; ++i) {
+ Attribute* attr = attrs->attributeItem(i);
+ if (attr->localName() == "src")
+ continue;
+ markup.append(" ");
+ markup.append(attr->localName());
+ markup.append("=\"");
+ String escapedAttr = attr->value();
+ escapedAttr.replace("\"", "&quot;");
+ markup.append(escapedAttr);
+ markup.append("\"");
+ }
+
+ markup.append("/>");
+ return markup.toString();
+}
+
+static CachedImage* getCachedImage(Element* element)
+{
+ // Attempt to pull CachedImage from element
+ ASSERT(element);
+ RenderObject* renderer = element->renderer();
+ if (!renderer || !renderer->isImage())
+ return 0;
+
+ RenderImage* image = static_cast<RenderImage*>(renderer);
+ if (image->cachedImage() && !image->cachedImage()->errorOccurred())
+ return image->cachedImage();
+
+ return 0;
+}
+
+static void writeImageToDataObject(ChromiumDataObject* dataObject, Element* element,
+ const KURL& url)
+{
+ // Shove image data into a DataObject for use as a file
+ CachedImage* cachedImage = getCachedImage(element);
+ if (!cachedImage || !cachedImage->image() || !cachedImage->isLoaded())
+ return;
+
+ SharedBuffer* imageBuffer = cachedImage->image()->data();
+ if (!imageBuffer || !imageBuffer->size())
+ return;
+
+ dataObject->file_content = imageBuffer;
+
+ // Determine the filename for the file contents of the image. We try to
+ // use the alt tag if one exists, otherwise we fall back on the suggested
+ // filename in the http header, and finally we resort to using the filename
+ // in the URL.
+ String extension(".");
+ extension += WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType(
+ cachedImage->response().mimeType());
+ String title = element->getAttribute(altAttr);
+ if (title.isEmpty()) {
+ title = cachedImage->response().suggestedFilename();
+ if (title.isEmpty()) {
+ // TODO(tc): Get the filename from the URL.
+ }
+ }
+ dataObject->file_content_filename = title + extension;
+}
+
+void ClipboardChromium::declareAndWriteDragImage(Element* element, const KURL& url, const String& title, Frame* frame)
+{
+ if (!m_dataObject)
+ return;
+
+ m_dataObject->url = url;
+ m_dataObject->url_title = title;
+
+ // Write the bytes in the image to the file format.
+ writeImageToDataObject(m_dataObject.get(), element, url);
+
+ AtomicString imageURL = element->getAttribute(srcAttr);
+ if (imageURL.isEmpty())
+ return;
+
+ String fullURL = frame->document()->completeURL(parseURL(imageURL));
+ if (fullURL.isEmpty())
+ return;
+
+ // Put img tag on the clipboard referencing the image
+ m_dataObject->text_html = imageToMarkup(fullURL, element);
+}
+
+void ClipboardChromium::writeURL(const KURL& url, const String& title, Frame*)
+{
+ if (!m_dataObject)
+ return;
+ m_dataObject->url = url;
+ m_dataObject->url_title = title;
+
+ // The URL can also be used as plain text.
+ m_dataObject->plain_text = url.string();
+
+ // The URL can also be used as an HTML fragment.
+ String markup("<a href=\"");
+ markup.append(url.string());
+ markup.append("\">");
+ markup.append(title);
+ markup.append("</a>");
+ m_dataObject->text_html = markup;
+}
+
+void ClipboardChromium::writeRange(Range* selectedRange, Frame* frame)
+{
+ ASSERT(selectedRange);
+ if (!m_dataObject)
+ return;
+
+ m_dataObject->text_html = createMarkup(selectedRange, 0,
+ AnnotateForInterchange);
+
+ String str = frame->selectedText();
+#if PLATFORM(WIN_OS)
+ replaceNewlinesWithWindowsStyleNewlines(str);
+#endif
+ replaceNBSPWithSpace(str);
+ m_dataObject->plain_text = str;
+}
+
+bool ClipboardChromium::hasData()
+{
+ if (!m_dataObject)
+ return false;
+
+ return m_dataObject->hasData();
+}
+
+} // namespace WebCore
diff --git a/webkit/port/platform/win/ClipboardWin.h b/webkit/port/platform/chromium/ClipboardChromium.h
index a52c242..9585988 100644
--- a/webkit/port/platform/win/ClipboardWin.h
+++ b/webkit/port/platform/chromium/ClipboardChromium.h
@@ -20,64 +20,61 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef ClipboardWin_h
-#define ClipboardWin_h
+#ifndef ClipboardChromium_h
+#define ClipboardChromium_h
#include "Clipboard.h"
#include "CachedResourceClient.h"
-#include "IntPoint.h"
-#include "COMPtr.h"
-
-struct IDataObject;
namespace WebCore {
class CachedImage;
+ class ChromiumDataObject;
class IntPoint;
- class WCDataObject;
- // State available during IE's events for drag and drop and copy/paste
- class ClipboardWin : public Clipboard, public CachedResourceClient {
+ class ClipboardChromium : public Clipboard, public CachedResourceClient {
public:
- ~ClipboardWin();
+ ~ClipboardChromium() {}
+
+ static PassRefPtr<ClipboardChromium> create(bool, ChromiumDataObject*,
+ ClipboardAccessPolicy);
- static PassRefPtr<ClipboardWin> create(bool isForDragging, IDataObject*, ClipboardAccessPolicy);
- static PassRefPtr<ClipboardWin> create(bool isForDragging, WCDataObject*, ClipboardAccessPolicy);
-
- void clearData(const String& type);
+ virtual void clearData(const String& type);
void clearAllData();
String getData(const String& type, bool& success) const;
bool setData(const String& type, const String& data);
-
+
// extensions beyond IE's API
HashSet<String> types() const;
-
+
void setDragImage(CachedImage*, const IntPoint&);
void setDragImageElement(Node*, const IntPoint&);
+ PassRefPtr<ChromiumDataObject> dataObject() {
+ return m_dataObject;
+ }
+
virtual DragImageRef createDragImage(IntPoint& dragLoc) const;
- virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*);
+ virtual void declareAndWriteDragImage(Element*, const KURL&,
+ const String& title, Frame*);
virtual void writeURL(const KURL&, const String&, Frame*);
virtual void writeRange(Range*, Frame*);
virtual bool hasData();
- COMPtr<IDataObject> dataObject() { return m_dataObject; }
private:
- ClipboardWin(bool isForDragging, IDataObject*, ClipboardAccessPolicy);
- ClipboardWin(bool isForDragging, WCDataObject*, ClipboardAccessPolicy);
+ ClipboardChromium(bool, ChromiumDataObject*, ClipboardAccessPolicy);
void resetFromClipboard();
void setDragImage(CachedImage*, Node*, const IntPoint&);
- COMPtr<IDataObject> m_dataObject;
- COMPtr<WCDataObject> m_writableDataObject;
+ RefPtr<ChromiumDataObject> m_dataObject;
Frame* m_frame;
};
} // namespace WebCore
-#endif // ClipboardWin_h
+#endif // ClipboardChromium_h
diff --git a/webkit/port/platform/chromium/DragDataChromium.cpp b/webkit/port/platform/chromium/DragDataChromium.cpp
index 49c4630..3507739 100644
--- a/webkit/port/platform/chromium/DragDataChromium.cpp
+++ b/webkit/port/platform/chromium/DragDataChromium.cpp
@@ -29,33 +29,18 @@
#include "config.h"
#include "DragData.h"
-#if PLATFORM(WIN_OS)
-#include "ClipboardWin.h"
-#include "ClipboardUtilitiesWin.h"
-#include "WCDataObject.h"
-#else
-#include "Clipboard.h" // This and ClipboardWin.h should be ClipboardChromium.h
-#endif
-
+#include "ChromiumDataObject.h"
+#include "Clipboard.h"
+#include "ClipboardChromium.h"
#include "DocumentFragment.h"
#include "KURL.h"
#include "PlatformString.h"
#include "markup.h"
-#undef LOG
-#include "base/file_util.h"
-#include "base/string_util.h"
-#include "net/base/base64.h"
-#include "webkit/glue/glue_util.h"
-#include "webkit/glue/webdropdata.h"
-#include "webkit/glue/webkit_glue.h"
-
namespace {
-bool containsHTML(const WebDropData& drop_data) {
- std::wstring html;
- return drop_data.cf_html.length() > 0
- || drop_data.text_html.length() > 0;
+bool containsHTML(const WebCore::ChromiumDataObject* drop_data) {
+ return drop_data->text_html.length() > 0;
}
}
@@ -64,57 +49,47 @@ namespace WebCore {
PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) const
{
-// TODO(darin): Invent ClipboardChromium and use that instead.
-#if PLATFORM(WIN_OS)
- WCDataObject* data;
- WCDataObject::createInstance(&data);
- RefPtr<ClipboardWin> clipboard = ClipboardWin::create(true, data, policy);
- // The clipboard keeps a reference to the WCDataObject, so we can release
- // our reference to it.
- data->Release();
+ RefPtr<ClipboardChromium> clipboard = ClipboardChromium::create(true,
+ m_platformDragData, policy);
return clipboard.release();
-#else
- return PassRefPtr<Clipboard>(0);
-#endif
}
bool DragData::containsURL() const
{
- return m_platformDragData->url.is_valid();
+ return m_platformDragData->url.isValid();
}
String DragData::asURL(String* title) const
{
- if (!m_platformDragData->url.is_valid())
+ if (!m_platformDragData->url.isValid())
return String();
// |title| can be NULL
if (title)
- *title = webkit_glue::StdWStringToString(m_platformDragData->url_title);
- return webkit_glue::StdStringToString(m_platformDragData->url.spec());
+ *title = m_platformDragData->url_title;
+ return m_platformDragData->url.string();
}
bool DragData::containsFiles() const
{
- return !m_platformDragData->filenames.empty();
+ return !m_platformDragData->filenames.isEmpty();
}
void DragData::asFilenames(Vector<String>& result) const
{
for (size_t i = 0; i < m_platformDragData->filenames.size(); ++i)
- result.append(webkit_glue::StdWStringToString(m_platformDragData->filenames[i]));
+ result.append(m_platformDragData->filenames[i]);
}
bool DragData::containsPlainText() const
{
- return !m_platformDragData->plain_text.empty();
+ return !m_platformDragData->plain_text.isEmpty();
}
String DragData::asPlainText() const
{
- return webkit_glue::StdWStringToString(
- m_platformDragData->plain_text);
+ return m_platformDragData->plain_text;
}
bool DragData::containsColor() const
@@ -128,15 +103,14 @@ bool DragData::canSmartReplace() const
// This is allowed whenever the drag data contains a 'range' (ie.,
// ClipboardWin::writeRange is called). For example, dragging a link
// should not result in a space being added.
- return !m_platformDragData->cf_html.empty() &&
- !m_platformDragData->plain_text.empty() &&
- !m_platformDragData->url.is_valid();
+ return !m_platformDragData->plain_text.isEmpty() &&
+ !m_platformDragData->url.isValid();
}
bool DragData::containsCompatibleContent() const
{
return containsPlainText() || containsURL()
- || ::containsHTML(*m_platformDragData)
+ || ::containsHTML(m_platformDragData)
|| containsColor();
}
@@ -159,19 +133,10 @@ PassRefPtr<DocumentFragment> DragData::asFragment(Document* doc) const
// if (PassRefPtr<DocumentFragment> fragment = fragmentFromFilenames(doc, m_platformDragData))
// return fragment;
-#if PLATFORM(WIN_OS)
- // fragmentFromCF_HTML comes from ClipboardUtilitiesWin.
- if (!m_platformDragData->cf_html.empty()) {
- RefPtr<DocumentFragment> fragment = fragmentFromCF_HTML(doc,
- webkit_glue::StdWStringToString(m_platformDragData->cf_html));
- return fragment;
- }
-#endif
-
- if (!m_platformDragData->text_html.empty()) {
+ if (!m_platformDragData->text_html.isEmpty()) {
String url;
RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(doc,
- webkit_glue::StdWStringToString(m_platformDragData->text_html), url);
+ m_platformDragData->text_html, url);
return fragment;
}
diff --git a/webkit/port/platform/chromium/DragDataRef.h b/webkit/port/platform/chromium/DragDataRef.h
index c588819..4ddc1ac 100644
--- a/webkit/port/platform/chromium/DragDataRef.h
+++ b/webkit/port/platform/chromium/DragDataRef.h
@@ -30,11 +30,11 @@
#ifndef DragDataRef_h
#define DragDataRef_h
-#include "webkit/glue/webdropdata.h"
+#include "ChromiumDataObject.h"
namespace WebCore {
-typedef WebDropData* DragDataRef;
+typedef ChromiumDataObject* DragDataRef;
}
diff --git a/webkit/port/platform/chromium/EditorLinux.cpp b/webkit/port/platform/chromium/EditorChromium.cpp
index 808d617..8636ed1 100644
--- a/webkit/port/platform/chromium/EditorLinux.cpp
+++ b/webkit/port/platform/chromium/EditorChromium.cpp
@@ -26,15 +26,15 @@
#include "config.h"
#include "Editor.h"
-#include "Clipboard.h"
-#include "NotImplemented.h"
+#include "ChromiumDataObject.h"
+#include "ClipboardChromium.h"
namespace WebCore {
PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy)
{
- notImplemented();
- return NULL;
+ RefPtr<ChromiumDataObject> dataObject = ChromiumDataObject::create();
+ return ClipboardChromium::create(false, dataObject.get(), policy);
}
} // namespace WebCore
diff --git a/webkit/port/platform/win/ClipboardUtilitiesWin.h b/webkit/port/platform/win/ClipboardUtilitiesWin.h
index bc8fb0a..a7669ad 100644
--- a/webkit/port/platform/win/ClipboardUtilitiesWin.h
+++ b/webkit/port/platform/win/ClipboardUtilitiesWin.h
@@ -26,7 +26,10 @@
#ifndef ClipboardUtilitiesWin_h
#define ClipboardUtilitiesWin_h
-#include "DragData.h"
+#include "DocumentFragment.h"
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
#include <windows.h>
#include <objidl.h>
diff --git a/webkit/port/platform/win/ClipboardWin.cpp b/webkit/port/platform/win/ClipboardWin.cpp
deleted file mode 100644
index 0383610..0000000
--- a/webkit/port/platform/win/ClipboardWin.cpp
+++ /dev/null
@@ -1,808 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include <shlwapi.h>
-#include <wininet.h>
-
-#pragma warning(push, 0)
-#include "ClipboardWin.h"
-#include "CachedImage.h"
-#include "ClipboardUtilitiesWin.h"
-#include "csshelper.h"
-#include "CString.h"
-#include "Document.h"
-#include "DragData.h"
-#include "Editor.h"
-#include "Element.h"
-#include "EventHandler.h"
-#include "Frame.h"
-#include "FrameLoader.h"
-#include "FrameView.h"
-#include "HTMLNames.h"
-#include "Image.h"
-#include "MIMETypeRegistry.h"
-#include "markup.h"
-#include "Page.h"
-#include "Pasteboard.h"
-#include "PlatformMouseEvent.h"
-#include "PlatformString.h"
-#include "Range.h"
-#include "RenderImage.h"
-#include "ResourceResponse.h"
-#include "StringBuilder.h"
-#include "StringHash.h"
-#include "WCDataObject.h"
-#include <wtf/RefPtr.h>
-#pragma warning(pop)
-
-#undef LOG
-#include "base/clipboard_util.h"
-#include "base/string_util.h"
-#include "googleurl/src/gurl.h"
-#include "webkit/glue/glue_util.h"
-#include "webkit/glue/webkit_glue.h"
-
-namespace WebCore {
-
-using namespace HTMLNames;
-
-// format string for
-static const char szShellDotUrlTemplate[] = "[InternetShortcut]\r\nURL=%s\r\n";
-
-// We provide the IE clipboard types (URL and Text), and the clipboard types specified in the WHATWG Web Applications 1.0 draft
-// see http://www.whatwg.org/specs/web-apps/current-work/ Section 6.3.5.3
-
-enum ClipboardDataType { ClipboardDataTypeNone, ClipboardDataTypeURL, ClipboardDataTypeText };
-
-static ClipboardDataType clipboardTypeFromMIMEType(const String& type)
-{
- String qType = type.stripWhiteSpace().lower();
-
- // two special cases for IE compatibility
- if (qType == "text" || qType == "text/plain" || qType.startsWith("text/plain;"))
- return ClipboardDataTypeText;
- if (qType == "url" || qType == "text/uri-list")
- return ClipboardDataTypeURL;
-
- return ClipboardDataTypeNone;
-}
-
-static inline void pathRemoveBadFSCharacters(PWSTR psz, size_t length)
-{
- size_t writeTo = 0;
- size_t readFrom = 0;
- while (readFrom < length) {
- UINT type = PathGetCharType(psz[readFrom]);
- if (psz[readFrom] == 0 || type & (GCT_LFNCHAR | GCT_SHORTCHAR)) {
- psz[writeTo++] = psz[readFrom];
- }
-
- readFrom++;
- }
- psz[writeTo] = 0;
-}
-
-static String filesystemPathFromUrlOrTitle(const String& url, const String& title, TCHAR* extension, bool isLink)
-{
- bool usedURL = false;
- WCHAR fsPathBuffer[MAX_PATH];
- fsPathBuffer[0] = 0;
- int extensionLen = extension ? min(MAX_PATH - 1, lstrlen(extension)) : 0;
- String extensionString = extension ? String(extension, extensionLen) : String(L"");
-
- // We make the filename based on the title only if there's an extension.
- if (!title.isEmpty() && extension) {
- size_t len = min<size_t>(title.length(), MAX_PATH - extensionLen - 1);
- CopyMemory(fsPathBuffer, title.characters(), len * sizeof(UChar));
- fsPathBuffer[len] = 0;
- pathRemoveBadFSCharacters(fsPathBuffer, len);
- }
-
- if (!lstrlen(fsPathBuffer)) {
- DWORD len = MAX_PATH - 1;
- String nullTermURL = url;
- usedURL = true;
- if (UrlIsFileUrl((LPCWSTR)nullTermURL.charactersWithNullTermination())
- && SUCCEEDED(PathCreateFromUrl((LPCWSTR)nullTermURL.charactersWithNullTermination(), fsPathBuffer, &len, 0))) {
- // When linking to a file URL we can trivially find the file name
- PWSTR fn = PathFindFileName(fsPathBuffer);
- if (fn && fn != fsPathBuffer)
- lstrcpyn(fsPathBuffer, fn, lstrlen(fn) + 1);
- } else {
- // The filename for any content based drag should be the last element of
- // the path. If we can't find it, or we're coming up with the name for a link
- // we just use the entire url.
- KURL kurl(url);
- String lastComponent;
- if (!isLink && !(lastComponent = kurl.lastPathComponent()).isEmpty()) {
- len = min<DWORD>(MAX_PATH - 1, lastComponent.length());
- CopyMemory(fsPathBuffer, lastComponent.characters(), len * sizeof(UChar));
- } else {
- len = min<DWORD>(MAX_PATH - 1, nullTermURL.length());
- CopyMemory(fsPathBuffer, nullTermURL.characters(), len * sizeof(UChar));
- }
- fsPathBuffer[len] = 0;
- pathRemoveBadFSCharacters(fsPathBuffer, len);
- }
- }
-
- if (!extension)
- return String((UChar*)fsPathBuffer);
-
- if (!isLink && usedURL) {
- PathRenameExtension(fsPathBuffer, extensionString.charactersWithNullTermination());
- return String((UChar*)fsPathBuffer);
- }
-
- String result((UChar*)fsPathBuffer);
- result += extensionString;
- return result.length() >= MAX_PATH ? result.substring(0, MAX_PATH - 1) : result;
-}
-
-static HGLOBAL createGlobalURLContent(const String& url, int estimatedFileSize)
-{
- HRESULT hr = S_OK;
- HGLOBAL memObj = 0;
-
- char* fileContents;
- char ansiUrl[INTERNET_MAX_URL_LENGTH + 1];
- // Used to generate the buffer. This is null terminated whereas the fileContents won't be.
- char contentGenerationBuffer[INTERNET_MAX_URL_LENGTH + ARRAYSIZE(szShellDotUrlTemplate) + 1];
-
- if (estimatedFileSize > 0 && estimatedFileSize > ARRAYSIZE(contentGenerationBuffer))
- return 0;
-
- int ansiUrlSize = ::WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)url.characters(), url.length(), ansiUrl, ARRAYSIZE(ansiUrl) - 1, 0, 0);
- if (!ansiUrlSize)
- return 0;
-
- ansiUrl[ansiUrlSize] = 0;
-
- int fileSize = (int) (ansiUrlSize+strlen(szShellDotUrlTemplate)-2); // -2 to remove the %s
- ASSERT(estimatedFileSize < 0 || fileSize == estimatedFileSize);
-
- memObj = GlobalAlloc(GPTR, fileSize);
- if (!memObj)
- return 0;
-
- fileContents = (PSTR)GlobalLock(memObj);
-
- sprintf_s(contentGenerationBuffer, ARRAYSIZE(contentGenerationBuffer), szShellDotUrlTemplate, ansiUrl);
- CopyMemory(fileContents, contentGenerationBuffer, fileSize);
-
- GlobalUnlock(memObj);
-
- return memObj;
-}
-
-static HGLOBAL createGlobalImageFileContent(SharedBuffer* data)
-{
- HGLOBAL memObj = GlobalAlloc(GPTR, data->size());
- if (!memObj)
- return 0;
-
- char* fileContents = (PSTR)GlobalLock(memObj);
-
- CopyMemory(fileContents, data->data(), data->size());
-
- GlobalUnlock(memObj);
-
- return memObj;
-}
-
-static HGLOBAL createGlobalHDropContent(const KURL& url, String& fileName, SharedBuffer* data)
-{
- if (fileName.isEmpty() || !data )
- return 0;
-
- WCHAR filePath[MAX_PATH];
-
- if (url.isLocalFile()) {
- String localPath = url.path();
- // windows does not enjoy a leading slash on paths
- if (localPath[0] == '/')
- localPath = localPath.substring(1);
- LPCTSTR localPathStr = localPath.charactersWithNullTermination();
- if (wcslen(localPathStr) + 1 < MAX_PATH)
- wcscpy_s(filePath, MAX_PATH, localPathStr);
- else
- return 0;
- } else {
- WCHAR tempPath[MAX_PATH];
- WCHAR extension[MAX_PATH];
- if (!::GetTempPath(ARRAYSIZE(tempPath), tempPath))
- return 0;
- if (!::PathAppend(tempPath, fileName.charactersWithNullTermination()))
- return 0;
- LPCWSTR foundExtension = ::PathFindExtension(tempPath);
- if (foundExtension) {
- if (wcscpy_s(extension, MAX_PATH, foundExtension))
- return 0;
- } else
- *extension = 0;
- ::PathRemoveExtension(tempPath);
- for (int i = 1; i < 10000; i++) {
- if (swprintf_s(filePath, MAX_PATH, TEXT("%s-%d%s"), tempPath, i, extension) == -1)
- return 0;
- if (!::PathFileExists(filePath))
- break;
- }
- HANDLE tempFileHandle = CreateFile(filePath, GENERIC_READ | GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
- if (tempFileHandle == INVALID_HANDLE_VALUE)
- return 0;
-
- // Write the data to this temp file.
- DWORD written;
- BOOL tempWriteSucceeded = WriteFile(tempFileHandle, data->data(), data->size(), &written, 0);
- CloseHandle(tempFileHandle);
- if (!tempWriteSucceeded)
- return 0;
- }
-
- SIZE_T dropFilesSize = sizeof(DROPFILES) + (sizeof(WCHAR) * (wcslen(filePath) + 2));
- HGLOBAL memObj = GlobalAlloc(GHND | GMEM_SHARE, dropFilesSize);
- if (!memObj)
- return 0;
-
- DROPFILES* dropFiles = (DROPFILES*) GlobalLock(memObj);
- dropFiles->pFiles = sizeof(DROPFILES);
- dropFiles->fWide = TRUE;
- wcscpy((LPWSTR)(dropFiles + 1), filePath);
- GlobalUnlock(memObj);
-
- return memObj;
-}
-
-static HGLOBAL createGlobalUrlFileDescriptor(const String& url, const String& title, int& /*out*/ estimatedSize)
-{
- HRESULT hr = S_OK;
- HGLOBAL memObj = 0;
- String fsPath;
- memObj = GlobalAlloc(GPTR, sizeof(FILEGROUPDESCRIPTOR));
- if (!memObj)
- return 0;
-
- FILEGROUPDESCRIPTOR* fgd = (FILEGROUPDESCRIPTOR*)GlobalLock(memObj);
- memset(fgd, 0, sizeof(FILEGROUPDESCRIPTOR));
- fgd->cItems = 1;
- fgd->fgd[0].dwFlags = FD_FILESIZE;
- int fileSize = ::WideCharToMultiByte(CP_ACP, 0, url.characters(), url.length(), 0, 0, 0, 0);
- fileSize += strlen(szShellDotUrlTemplate) - 2; // -2 is for getting rid of %s in the template string
- fgd->fgd[0].nFileSizeLow = fileSize;
- estimatedSize = fileSize;
- fsPath = filesystemPathFromUrlOrTitle(url, title, L".URL", true);
-
- if (fsPath.length() <= 0) {
- GlobalUnlock(memObj);
- GlobalFree(memObj);
- return 0;
- }
-
- int maxSize = min(fsPath.length(), ARRAYSIZE(fgd->fgd[0].cFileName));
- CopyMemory(fgd->fgd[0].cFileName, (LPCWSTR)fsPath.characters(), maxSize * sizeof(UChar));
- GlobalUnlock(memObj);
-
- return memObj;
-}
-
-
-static HGLOBAL createGlobalImageFileDescriptor(const String& url, const String& title, CachedImage* image)
-{
- ASSERT_ARG(image, image);
- ASSERT(image->image()->data());
-
- HRESULT hr = S_OK;
- HGLOBAL memObj = 0;
- String fsPath;
- memObj = GlobalAlloc(GPTR, sizeof(FILEGROUPDESCRIPTOR));
- if (!memObj)
- return 0;
-
- FILEGROUPDESCRIPTOR* fgd = (FILEGROUPDESCRIPTOR*)GlobalLock(memObj);
- memset(fgd, 0, sizeof(FILEGROUPDESCRIPTOR));
- fgd->cItems = 1;
- fgd->fgd[0].dwFlags = FD_FILESIZE;
- fgd->fgd[0].nFileSizeLow = image->image()->data()->size();
-
- String extension(".");
- extension += WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType(image->response().mimeType());
- const String& preferredTitle = title.isEmpty() ? image->response().suggestedFilename() : title;
- fsPath = filesystemPathFromUrlOrTitle(url, preferredTitle, extension.isEmpty() ? 0 : (TCHAR*)extension.charactersWithNullTermination(), false);
-
- if (fsPath.length() <= 0) {
- GlobalUnlock(memObj);
- GlobalFree(memObj);
- return 0;
- }
-
- int maxSize = min(fsPath.length(), ARRAYSIZE(fgd->fgd[0].cFileName));
- CopyMemory(fgd->fgd[0].cFileName, (LPCWSTR)fsPath.characters(), maxSize * sizeof(UChar));
- GlobalUnlock(memObj);
-
- return memObj;
-}
-
-
-// writeFileToDataObject takes ownership of fileDescriptor and fileContent
-static HRESULT writeFileToDataObject(IDataObject* dataObject, HGLOBAL fileDescriptor, HGLOBAL fileContent, HGLOBAL hDropContent)
-{
- HRESULT hr = S_OK;
- FORMATETC* fe;
- STGMEDIUM medium = {0};
- medium.tymed = TYMED_HGLOBAL;
-
- if (!fileDescriptor || !fileContent)
- goto exit;
-
- // Descriptor
- fe = ClipboardUtil::GetFileDescriptorFormat();
-
- medium.hGlobal = fileDescriptor;
-
- if (FAILED(hr = dataObject->SetData(fe, &medium, TRUE)))
- goto exit;
-
- // Contents
- fe = ClipboardUtil::GetFileContentFormatZero();
- medium.hGlobal = fileContent;
- if (FAILED(hr = dataObject->SetData(fe, &medium, TRUE)))
- goto exit;
-
- // HDROP
- if (hDropContent) {
- medium.hGlobal = hDropContent;
- hr = dataObject->SetData(ClipboardUtil::GetCFHDropFormat(), &medium, TRUE);
- }
-
-exit:
- if (FAILED(hr)) {
- if (fileDescriptor)
- GlobalFree(fileDescriptor);
- if (fileContent)
- GlobalFree(fileContent);
- if (hDropContent)
- GlobalFree(hDropContent);
- }
- return hr;
-}
-
-ClipboardWin::ClipboardWin(bool isForDragging, IDataObject* dataObject, ClipboardAccessPolicy policy)
- : Clipboard(policy, isForDragging)
- , m_dataObject(dataObject)
- , m_writableDataObject(0)
-{
-}
-
-ClipboardWin::ClipboardWin(bool isForDragging, WCDataObject* dataObject, ClipboardAccessPolicy policy)
- : Clipboard(policy, isForDragging)
- , m_dataObject(dataObject)
- , m_writableDataObject(dataObject)
-{
-}
-
-ClipboardWin::~ClipboardWin()
-{
-}
-
-PassRefPtr<ClipboardWin> ClipboardWin::create(bool isForDragging, IDataObject* dataObject, ClipboardAccessPolicy policy)
-{
- return adoptRef(new ClipboardWin(isForDragging, dataObject, policy));
-}
-
-PassRefPtr<ClipboardWin> ClipboardWin::create(bool isForDragging, WCDataObject* dataObject, ClipboardAccessPolicy policy)
-{
- return adoptRef(new ClipboardWin(isForDragging, dataObject, policy));
-}
-
-static bool writeURL(WCDataObject *data, const KURL& url, String title, bool withPlainText, bool withHTML)
-{
- ASSERT(data);
-
- if (url.isEmpty())
- return false;
-
- if (title.isEmpty()) {
- title = url.lastPathComponent();
- if (title.isEmpty())
- title = url.host();
- }
-
- STGMEDIUM medium = {0};
- medium.tymed = TYMED_HGLOBAL;
-
- medium.hGlobal = createGlobalData(url, title);
- bool success = false;
- if (medium.hGlobal && FAILED(data->SetData(ClipboardUtil::GetUrlWFormat(), &medium, TRUE)))
- ::GlobalFree(medium.hGlobal);
- else
- success = true;
-
- if (withHTML) {
- Vector<char> cfhtmlData;
- markupToCF_HTML(urlToMarkup(url, title), "", cfhtmlData);
- medium.hGlobal = createGlobalData(cfhtmlData);
- if (medium.hGlobal && FAILED(data->SetData(htmlFormat(), &medium, TRUE)))
- ::GlobalFree(medium.hGlobal);
- else
- success = true;
- }
-
- if (withPlainText) {
- medium.hGlobal = createGlobalData(url.string());
- if (medium.hGlobal && FAILED(data->SetData(ClipboardUtil::GetPlainTextWFormat(), &medium, TRUE)))
- ::GlobalFree(medium.hGlobal);
- else
- success = true;
- }
-
- return success;
-}
-
-void ClipboardWin::clearData(const String& type)
-{
- //FIXME: Need to be able to write to the system clipboard <rdar://problem/5015941>
- ASSERT(isForDragging());
- if (policy() != ClipboardWritable || !m_writableDataObject)
- return;
-
- ClipboardDataType dataType = clipboardTypeFromMIMEType(type);
-
- if (dataType == ClipboardDataTypeURL) {
- m_writableDataObject->clearData(ClipboardUtil::GetUrlWFormat()->cfFormat);
- m_writableDataObject->clearData(ClipboardUtil::GetUrlFormat()->cfFormat);
- }
- if (dataType == ClipboardDataTypeText) {
- m_writableDataObject->clearData(ClipboardUtil::GetPlainTextFormat()->cfFormat);
- m_writableDataObject->clearData(ClipboardUtil::GetPlainTextWFormat()->cfFormat);
- }
-
-}
-
-void ClipboardWin::clearAllData()
-{
- //FIXME: Need to be able to write to the system clipboard <rdar://problem/5015941>
- ASSERT(isForDragging());
- if (policy() != ClipboardWritable)
- return;
-
- m_writableDataObject = 0;
- WCDataObject::createInstance(&m_writableDataObject);
- m_dataObject = m_writableDataObject;
-}
-
-String ClipboardWin::getData(const String& type, bool& success) const
-{
- success = false;
- if (policy() != ClipboardReadable || !m_dataObject) {
- return "";
- }
-
- ClipboardDataType dataType = clipboardTypeFromMIMEType(type);
- if (dataType == ClipboardDataTypeText) {
- std::wstring text;
- if (!isForDragging()) {
- // If this isn't for a drag, it's for a cut/paste event handler.
- // In this case, we need to use our glue methods to access the
- // clipboard contents.
- webkit_glue::ClipboardReadText(&text);
- if (text.empty()) {
- std::string asciiText;
- webkit_glue::ClipboardReadAsciiText(&asciiText);
- text = ASCIIToWide(asciiText);
- }
- success = !text.empty();
- } else {
- success = ClipboardUtil::GetPlainText(m_dataObject.get(), &text);
- }
- return webkit_glue::StdWStringToString(text);
- } else if (dataType == ClipboardDataTypeURL) {
- std::wstring url;
- std::wstring title;
- success = ClipboardUtil::GetUrl(m_dataObject.get(), &url, &title);
- return webkit_glue::StdWStringToString(url);
- }
-
- return "";
-}
-
-bool ClipboardWin::setData(const String& type, const String& data)
-{
- // FIXME: Need to be able to write to the system clipboard <rdar://problem/5015941>
- ASSERT(isForDragging());
- if (policy() != ClipboardWritable || !m_writableDataObject)
- return false;
-
- ClipboardDataType winType = clipboardTypeFromMIMEType(type);
-
- if (winType == ClipboardDataTypeURL)
- return WebCore::writeURL(m_writableDataObject.get(), KURL(data), String(), false, true);
-
- if (winType == ClipboardDataTypeText) {
- STGMEDIUM medium = {0};
- medium.tymed = TYMED_HGLOBAL;
- medium.hGlobal = createGlobalData(data);
- if (!medium.hGlobal)
- return false;
-
- if (FAILED(m_writableDataObject->SetData(ClipboardUtil::GetPlainTextWFormat(), &medium, TRUE))) {
- ::GlobalFree(medium.hGlobal);
- return false;
- }
- return true;
- }
- return false;
-}
-
-static void addMimeTypesForFormat(HashSet<String>& results, FORMATETC& format)
-{
- // URL and Text are provided for compatibility with IE's model
- if (format.cfFormat == ClipboardUtil::GetUrlFormat()->cfFormat ||
- format.cfFormat == ClipboardUtil::GetUrlWFormat()->cfFormat) {
- results.add("URL");
- results.add("text/uri-list");
- }
-
- if (format.cfFormat == ClipboardUtil::GetPlainTextWFormat()->cfFormat ||
- format.cfFormat == ClipboardUtil::GetPlainTextFormat()->cfFormat) {
- results.add("Text");
- results.add("text/plain");
- }
-}
-
-// extensions beyond IE's API
-HashSet<String> ClipboardWin::types() const
-{
- HashSet<String> results;
- if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable)
- return results;
-
- if (!m_dataObject)
- return results;
-
- COMPtr<IEnumFORMATETC> itr;
-
- if (FAILED(m_dataObject->EnumFormatEtc(0, &itr)))
- return results;
-
- if (!itr)
- return results;
-
- FORMATETC data;
-
- while (SUCCEEDED(itr->Next(1, &data, 0))) {
- addMimeTypesForFormat(results, data);
- }
-
- return results;
-}
-
-void ClipboardWin::setDragImage(CachedImage* image, Node *node, const IntPoint &loc)
-{
- if (policy() != ClipboardImageWritable && policy() != ClipboardWritable)
- return;
-
- if (m_dragImage)
- m_dragImage->removeClient(this);
- m_dragImage = image;
- if (m_dragImage)
- m_dragImage->addClient(this);
-
- m_dragLoc = loc;
- m_dragImageElement = node;
-}
-
-void ClipboardWin::setDragImage(CachedImage* img, const IntPoint &loc)
-{
- setDragImage(img, 0, loc);
-}
-
-void ClipboardWin::setDragImageElement(Node *node, const IntPoint &loc)
-{
- setDragImage(0, node, loc);
-}
-
-DragImageRef ClipboardWin::createDragImage(IntPoint& loc) const
-{
- HBITMAP result = 0;
- //FIXME: Need to be able to draw element <rdar://problem/5015942>
- if (m_dragImage) {
- result = createDragImageFromImage(m_dragImage->image());
- loc = m_dragLoc;
- }
- return result;
-}
-
-static String imageToMarkup(const String& url, Element* element)
-{
- StringBuilder markup;
- markup.append("<img src=\"");
- markup.append(url);
- markup.append("\"");
- // Copy over attributes. If we are dragging an image, we expect things like
- // the id to be copied as well.
- NamedAttrMap* attrs = element->attributes();
- unsigned int length = attrs->length();
- for (unsigned int i = 0; i < length; ++i) {
- Attribute* attr = attrs->attributeItem(i);
- if (attr->localName() == "src")
- continue;
- markup.append(" ");
- markup.append(attr->localName());
- markup.append("=\"");
- String escapedAttr = attr->value();
- escapedAttr.replace("\"", "&quot;");
- markup.append(escapedAttr);
- markup.append("\"");
- }
-
- markup.append("/>");
- return markup.toString();
-}
-
-static CachedImage* getCachedImage(Element* element)
-{
- // Attempt to pull CachedImage from element
- ASSERT(element);
- RenderObject* renderer = element->renderer();
- if (!renderer || !renderer->isImage())
- return 0;
-
- RenderImage* image = static_cast<RenderImage*>(renderer);
- if (image->cachedImage() && !image->cachedImage()->errorOccurred())
- return image->cachedImage();
-
- return 0;
-}
-
-static void writeImageToDataObject(IDataObject* dataObject, Element* element, const KURL& url)
-{
- // Shove image data into a DataObject for use as a file
- CachedImage* cachedImage = getCachedImage(element);
- if (!cachedImage || !cachedImage->image() || !cachedImage->isLoaded())
- return;
-
- SharedBuffer* imageBuffer = cachedImage->image()->data();
- if (!imageBuffer || !imageBuffer->size())
- return;
-
- HGLOBAL imageFileDescriptor = createGlobalImageFileDescriptor(url.string(), element->getAttribute(altAttr), cachedImage);
- if (!imageFileDescriptor)
- return;
-
- HGLOBAL imageFileContent = createGlobalImageFileContent(imageBuffer);
- if (!imageFileContent) {
- GlobalFree(imageFileDescriptor);
- return;
- }
-
- // When running in the sandbox, it's possible that hDropContent is NULL.
- // That's ok, we should keep going anyway.
- String fileName = cachedImage->response().suggestedFilename();
- HGLOBAL hDropContent = createGlobalHDropContent(url, fileName, imageBuffer);
-
- writeFileToDataObject(dataObject, imageFileDescriptor, imageFileContent, hDropContent);
-}
-
-void ClipboardWin::declareAndWriteDragImage(Element* element, const KURL& url, const String& title, Frame* frame)
-{
- // Order is important here for Explorer's sake
- if (!m_writableDataObject)
- return;
- WebCore::writeURL(m_writableDataObject.get(), url, title, true, false);
-
- writeImageToDataObject(m_writableDataObject.get(), element, url);
-
- AtomicString imageURL = element->getAttribute(srcAttr);
- if (imageURL.isEmpty())
- return;
-
- String fullURL = frame->document()->completeURL(parseURL(imageURL));
- if (fullURL.isEmpty())
- return;
- STGMEDIUM medium = {0};
- medium.tymed = TYMED_HGLOBAL;
- ExceptionCode ec = 0;
-
- // Put img tag on the clipboard referencing the image
- Vector<char> data;
- markupToCF_HTML(imageToMarkup(fullURL, element), "", data);
- medium.hGlobal = createGlobalData(data);
- if (medium.hGlobal && FAILED(m_writableDataObject->SetData(htmlFormat(), &medium, TRUE)))
- ::GlobalFree(medium.hGlobal);
-}
-
-void ClipboardWin::writeURL(const KURL& kurl, const String& titleStr, Frame*)
-{
- if (!m_writableDataObject)
- return;
- WebCore::writeURL(m_writableDataObject.get(), kurl, titleStr, true, true);
-
- int estimatedSize = 0;
- String url = kurl.string();
-
- HGLOBAL urlFileDescriptor = createGlobalUrlFileDescriptor(url, titleStr, estimatedSize);
- if (!urlFileDescriptor)
- return;
- HGLOBAL urlFileContent = createGlobalURLContent(url, estimatedSize);
- if (!urlFileContent) {
- GlobalFree(urlFileDescriptor);
- return;
- }
- writeFileToDataObject(m_writableDataObject.get(), urlFileDescriptor, urlFileContent, 0);
-}
-
-void ClipboardWin::writeRange(Range* selectedRange, Frame* frame)
-{
- ASSERT(selectedRange);
- if (!m_writableDataObject)
- return;
-
- STGMEDIUM medium = {0};
- medium.tymed = TYMED_HGLOBAL;
- ExceptionCode ec = 0;
-
- Vector<char> data;
- markupToCF_HTML(createMarkup(selectedRange, 0, AnnotateForInterchange),
- selectedRange->startContainer(ec)->document()->url().string(), data);
- medium.hGlobal = createGlobalData(data);
- if (medium.hGlobal && FAILED(m_writableDataObject->SetData(htmlFormat(), &medium, TRUE)))
- ::GlobalFree(medium.hGlobal);
-
- String str = frame->selectedText();
- replaceNewlinesWithWindowsStyleNewlines(str);
- replaceNBSPWithSpace(str);
- medium.hGlobal = createGlobalData(str);
- if (medium.hGlobal && FAILED(m_writableDataObject->SetData(plainTextWFormat(), &medium, TRUE)))
- ::GlobalFree(medium.hGlobal);
-
- medium.hGlobal = 0;
- if (frame->editor()->canSmartCopyOrDelete())
- m_writableDataObject->SetData(smartPasteFormat(), &medium, TRUE);
-}
-
-bool ClipboardWin::hasData()
-{
- if (!m_dataObject)
- return false;
-
- COMPtr<IEnumFORMATETC> itr;
- if (FAILED(m_dataObject->EnumFormatEtc(0, &itr)))
- return false;
-
- if (!itr)
- return false;
-
- FORMATETC data;
-
- if (SUCCEEDED(itr->Next(1, &data, 0))) {
- // There is at least one item in the IDataObject
- return true;
- }
-
- return false;
-}
-
-} // namespace WebCore
diff --git a/webkit/port/platform/win/EditorWin.cpp b/webkit/port/platform/win/EditorWin.cpp
deleted file mode 100644
index 8ffcf9a..0000000
--- a/webkit/port/platform/win/EditorWin.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include <windows.h>
-#include <ole2.h>
-
-#pragma warning(push, 0)
-#include "Editor.h"
-#include "EditorClient.h"
-#include "ClipboardWin.h"
-#include "Document.h"
-#include "Element.h"
-#include "htmlediting.h"
-#include "TextIterator.h"
-#include "visible_units.h"
-#pragma warning(pop)
-
-namespace WebCore {
-
-PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy)
-{
- COMPtr<IDataObject> clipboardData;
- if (!SUCCEEDED(OleGetClipboard(&clipboardData)))
- clipboardData = 0;
-
- return ClipboardWin::create(false, clipboardData.get(), policy);
-}
-
-} // namespace WebCore
diff --git a/webkit/port/platform/win/WCDataObject.cpp b/webkit/port/platform/win/WCDataObject.cpp
deleted file mode 100644
index 57e062a..0000000
--- a/webkit/port/platform/win/WCDataObject.cpp
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include "WCDataObject.h"
-
-#include "PlatformString.h"
-
-namespace WebCore {
-
-class WCEnumFormatEtc : public IEnumFORMATETC
-{
-public:
- WCEnumFormatEtc(const Vector<FORMATETC>& formats);
- WCEnumFormatEtc(const Vector<FORMATETC*>& formats);
-
- //IUnknown members
- STDMETHOD(QueryInterface)(REFIID, void**);
- STDMETHOD_(ULONG, AddRef)(void);
- STDMETHOD_(ULONG, Release)(void);
-
- //IEnumFORMATETC members
- STDMETHOD(Next)(ULONG, LPFORMATETC, ULONG*);
- STDMETHOD(Skip)(ULONG);
- STDMETHOD(Reset)(void);
- STDMETHOD(Clone)(IEnumFORMATETC**);
-
-private:
- long m_ref;
- Vector<FORMATETC> m_formats;
- size_t m_current;
-};
-
-
-
-WCEnumFormatEtc::WCEnumFormatEtc(const Vector<FORMATETC>& formats)
-: m_ref(1)
-, m_current(0)
-{
- for(size_t i = 0; i < formats.size(); ++i)
- m_formats.append(formats[i]);
-}
-
-WCEnumFormatEtc::WCEnumFormatEtc(const Vector<FORMATETC*>& formats)
-: m_ref(1)
-, m_current(0)
-{
- for(size_t i = 0; i < formats.size(); ++i)
- m_formats.append(*formats[i]);
-}
-
-STDMETHODIMP WCEnumFormatEtc::QueryInterface(REFIID riid, void** ppvObject)
-{
- *ppvObject = 0;
- if (IsEqualIID(riid, IID_IUnknown) ||
- IsEqualIID(riid, IID_IEnumFORMATETC)) {
- *ppvObject = this;
- AddRef();
- return S_OK;
- }
-
- return E_NOINTERFACE;
-}
-
-STDMETHODIMP_(ULONG) WCEnumFormatEtc::AddRef(void)
-{
- return InterlockedIncrement(&m_ref);
-}
-
-STDMETHODIMP_(ULONG) WCEnumFormatEtc::Release(void)
-{
- long c = InterlockedDecrement(&m_ref);
- if (c == 0)
- delete this;
- return c;
-}
-
-STDMETHODIMP WCEnumFormatEtc::Next(ULONG celt, LPFORMATETC lpFormatEtc, ULONG* pceltFetched)
-{
- if(pceltFetched != 0)
- *pceltFetched=0;
-
- ULONG cReturn = celt;
-
- if(celt <= 0 || lpFormatEtc == 0 || m_current >= m_formats.size())
- return S_FALSE;
-
- if(pceltFetched == 0 && celt != 1) // pceltFetched can be 0 only for 1 item request
- return S_FALSE;
-
- while (m_current < m_formats.size() && cReturn > 0) {
- *lpFormatEtc++ = m_formats[m_current++];
- --cReturn;
- }
- if (pceltFetched != 0)
- *pceltFetched = celt - cReturn;
-
- return (cReturn == 0) ? S_OK : S_FALSE;
-}
-
-STDMETHODIMP WCEnumFormatEtc::Skip(ULONG celt)
-{
- if((m_current + int(celt)) >= m_formats.size())
- return S_FALSE;
- m_current += celt;
- return S_OK;
-}
-
-STDMETHODIMP WCEnumFormatEtc::Reset(void)
-{
- m_current = 0;
- return S_OK;
-}
-
-STDMETHODIMP WCEnumFormatEtc::Clone(IEnumFORMATETC** ppCloneEnumFormatEtc)
-{
- if(!ppCloneEnumFormatEtc)
- return E_POINTER;
-
- WCEnumFormatEtc *newEnum = new WCEnumFormatEtc(m_formats);
- if(!newEnum)
- return E_OUTOFMEMORY;
-
- newEnum->AddRef();
- newEnum->m_current = m_current;
- *ppCloneEnumFormatEtc = newEnum;
- return S_OK;
-}
-
-
-
-//////////////////////////////////////////////////////////////////////////
-
-HRESULT WCDataObject::createInstance(WCDataObject** result)
-{
- if (!result)
- return E_POINTER;
- *result = new WCDataObject();
- return S_OK;
-}
-
-WCDataObject::WCDataObject()
-: m_ref(1)
-{
-}
-
-WCDataObject::~WCDataObject()
-{
- for(size_t i = 0; i < m_medium.size(); ++i) {
- ReleaseStgMedium(m_medium[i]);
- delete m_medium[i];
- }
- WTF::deleteAllValues(m_formats);
-}
-
-STDMETHODIMP WCDataObject::QueryInterface(REFIID riid,void** ppvObject)
-{
- *ppvObject = 0;
- if (IID_IUnknown==riid || IID_IDataObject==riid)
- *ppvObject=this;
- if (*ppvObject) {
- AddRef();
- return S_OK;
- }
- return E_NOINTERFACE;
-}
-
-STDMETHODIMP_(ULONG) WCDataObject::AddRef( void)
-{
- return InterlockedIncrement(&m_ref);
-}
-
-STDMETHODIMP_(ULONG) WCDataObject::Release( void)
-{
- long c = InterlockedDecrement(&m_ref);
- if (c == 0)
- delete this;
- return c;
-}
-
-STDMETHODIMP WCDataObject::GetData(FORMATETC* pformatetcIn, STGMEDIUM* pmedium)
-{
- if(!pformatetcIn || !pmedium)
- return E_POINTER;
- pmedium->hGlobal = 0;
-
- for(size_t i=0; i < m_formats.size(); ++i) {
- if(/*pformatetcIn->tymed & m_formats[i]->tymed &&*/ // tymed can be 0 (TYMED_NULL) - but it can have a medium that contains an pUnkForRelease
- pformatetcIn->lindex == m_formats[i]->lindex &&
- pformatetcIn->dwAspect == m_formats[i]->dwAspect &&
- pformatetcIn->cfFormat == m_formats[i]->cfFormat) {
- CopyMedium(pmedium, m_medium[i], m_formats[i]);
- return S_OK;
- }
- }
- return DV_E_FORMATETC;
-}
-
-STDMETHODIMP WCDataObject::GetDataHere(FORMATETC*, STGMEDIUM*)
-{
- return E_NOTIMPL;
-}
-
-STDMETHODIMP WCDataObject::QueryGetData(FORMATETC* pformatetc)
-{
- if(!pformatetc)
- return E_POINTER;
-
- if (!(DVASPECT_CONTENT & pformatetc->dwAspect))
- return (DV_E_DVASPECT);
- HRESULT hr = DV_E_TYMED;
- for(size_t i = 0; i < m_formats.size(); ++i) {
- if(pformatetc->tymed & m_formats[i]->tymed) {
- if(pformatetc->cfFormat == m_formats[i]->cfFormat)
- return S_OK;
- else
- hr = DV_E_CLIPFORMAT;
- }
- else
- hr = DV_E_TYMED;
- }
- return hr;
-}
-
-STDMETHODIMP WCDataObject::GetCanonicalFormatEtc(FORMATETC*, FORMATETC*)
-{
- return DATA_S_SAMEFORMATETC;
-}
-
-STDMETHODIMP WCDataObject::SetData(FORMATETC* pformatetc, STGMEDIUM* pmedium, BOOL fRelease)
-{
- if(!pformatetc || !pmedium)
- return E_POINTER;
-
- FORMATETC* fetc=new FORMATETC;
- if (!fetc)
- return E_OUTOFMEMORY;
-
- STGMEDIUM* pStgMed = new STGMEDIUM;
-
- if(!pStgMed) {
- delete fetc;
- return E_OUTOFMEMORY;
- }
-
- ZeroMemory(fetc,sizeof(FORMATETC));
- ZeroMemory(pStgMed,sizeof(STGMEDIUM));
-
- *fetc = *pformatetc;
- m_formats.append(fetc);
-
- if(fRelease)
- *pStgMed = *pmedium;
- else
- CopyMedium(pStgMed, pmedium, pformatetc);
- m_medium.append(pStgMed);
-
- return S_OK;
-}
-
-void WCDataObject::CopyMedium(STGMEDIUM* pMedDest, STGMEDIUM* pMedSrc, FORMATETC* pFmtSrc)
-{
- switch(pMedSrc->tymed)
- {
- case TYMED_HGLOBAL:
- pMedDest->hGlobal = (HGLOBAL)OleDuplicateData(pMedSrc->hGlobal,pFmtSrc->cfFormat, 0);
- break;
- case TYMED_GDI:
- pMedDest->hBitmap = (HBITMAP)OleDuplicateData(pMedSrc->hBitmap,pFmtSrc->cfFormat, 0);
- break;
- case TYMED_MFPICT:
- pMedDest->hMetaFilePict = (HMETAFILEPICT)OleDuplicateData(pMedSrc->hMetaFilePict,pFmtSrc->cfFormat, 0);
- break;
- case TYMED_ENHMF:
- pMedDest->hEnhMetaFile = (HENHMETAFILE)OleDuplicateData(pMedSrc->hEnhMetaFile,pFmtSrc->cfFormat, 0);
- break;
- case TYMED_FILE:
- pMedSrc->lpszFileName = (LPOLESTR)OleDuplicateData(pMedSrc->lpszFileName,pFmtSrc->cfFormat, 0);
- break;
- case TYMED_ISTREAM:
- pMedDest->pstm = pMedSrc->pstm;
- pMedSrc->pstm->AddRef();
- break;
- case TYMED_ISTORAGE:
- pMedDest->pstg = pMedSrc->pstg;
- pMedSrc->pstg->AddRef();
- break;
- default:
- break;
- }
- pMedDest->tymed = pMedSrc->tymed;
- pMedDest->pUnkForRelease = 0;
- if(pMedSrc->pUnkForRelease != 0) {
- pMedDest->pUnkForRelease = pMedSrc->pUnkForRelease;
- pMedSrc->pUnkForRelease->AddRef();
- }
-}
-STDMETHODIMP WCDataObject::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC** ppenumFormatEtc)
-{
- if(!ppenumFormatEtc)
- return E_POINTER;
-
- *ppenumFormatEtc=0;
- switch (dwDirection)
- {
- case DATADIR_GET:
- *ppenumFormatEtc= new WCEnumFormatEtc(m_formats);
- if(!(*ppenumFormatEtc))
- return E_OUTOFMEMORY;
- break;
-
- case DATADIR_SET:
- default:
- return E_NOTIMPL;
- break;
- }
-
- return S_OK;
-}
-
-STDMETHODIMP WCDataObject::DAdvise(FORMATETC*, DWORD, IAdviseSink*,DWORD*)
-{
- return OLE_E_ADVISENOTSUPPORTED;
-}
-
-STDMETHODIMP WCDataObject::DUnadvise(DWORD)
-{
- return E_NOTIMPL;
-}
-
-HRESULT STDMETHODCALLTYPE WCDataObject::EnumDAdvise(IEnumSTATDATA**)
-{
- return OLE_E_ADVISENOTSUPPORTED;
-}
-
-void WCDataObject::clearData(CLIPFORMAT format)
-{
- size_t ptr = 0;
- while (ptr < m_formats.size()) {
- if (m_formats[ptr]->cfFormat == format) {
- FORMATETC* current = m_formats[ptr];
- m_formats[ptr] = m_formats[m_formats.size() - 1];
- m_formats[m_formats.size() - 1] = 0;
- m_formats.removeLast();
- delete current;
- STGMEDIUM* medium = m_medium[ptr];
- m_medium[ptr] = m_medium[m_medium.size() - 1];
- m_medium[m_medium.size() - 1] = 0;
- m_medium.removeLast();
- ReleaseStgMedium(medium);
- delete medium;
- continue;
- }
- ptr++;
- }
-}
-
-
-}
diff --git a/webkit/port/platform/win/WCDataObject.h b/webkit/port/platform/win/WCDataObject.h
deleted file mode 100644
index 51e37a0..0000000
--- a/webkit/port/platform/win/WCDataObject.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WCDataObject_h
-#define WCDataObject_h
-
-#include "COMPtr.h"
-#include <wtf/Vector.h>
-
-using namespace std;
-
-#include <ShlObj.h>
-#include <objidl.h>
-
-namespace WebCore {
-
-class String;
-
-class WCDataObject : public IDataObject {
-public:
- void CopyMedium(STGMEDIUM* pMedDest, STGMEDIUM* pMedSrc, FORMATETC* pFmtSrc);
-
- //IUnknown
- virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
- virtual ULONG STDMETHODCALLTYPE AddRef(void);
- virtual ULONG STDMETHODCALLTYPE Release(void);
-
- //IDataObject
- virtual HRESULT STDMETHODCALLTYPE GetData(FORMATETC* pformatIn, STGMEDIUM* pmedium);
- virtual HRESULT STDMETHODCALLTYPE GetDataHere(FORMATETC* pformat, STGMEDIUM* pmedium);
- virtual HRESULT STDMETHODCALLTYPE QueryGetData(FORMATETC* pformat);
- virtual HRESULT STDMETHODCALLTYPE GetCanonicalFormatEtc(FORMATETC* pformatectIn,FORMATETC* pformatOut);
- virtual HRESULT STDMETHODCALLTYPE SetData(FORMATETC* pformat, STGMEDIUM*pmedium, BOOL release);
- virtual HRESULT STDMETHODCALLTYPE EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC** ppenumFormatEtc);
- virtual HRESULT STDMETHODCALLTYPE DAdvise(FORMATETC*, DWORD, IAdviseSink*, DWORD*);
- virtual HRESULT STDMETHODCALLTYPE DUnadvise(DWORD);
- virtual HRESULT STDMETHODCALLTYPE EnumDAdvise(IEnumSTATDATA**);
-
- void clearData(CLIPFORMAT);
-
- static HRESULT createInstance(WCDataObject**);
-private:
- WCDataObject();
- virtual ~WCDataObject();
- long m_ref;
- Vector<FORMATETC*> m_formats;
- Vector<STGMEDIUM*> m_medium;
-};
-
-}
-
-#endif //!WCDataObject_h
diff --git a/webkit/tools/test_shell/drag_delegate.cc b/webkit/tools/test_shell/drag_delegate.cc
index 2d558f1..eeb5522 100644
--- a/webkit/tools/test_shell/drag_delegate.cc
+++ b/webkit/tools/test_shell/drag_delegate.cc
@@ -32,10 +32,10 @@ void TestDragDelegate::OnDragSourceDrop() {
GetCursorPositions(source_hwnd_, &client, &screen);
webview_->DragSourceEndedAt(client.x, client.y, screen.x, screen.y);
}
+
void TestDragDelegate::OnDragSourceMove() {
CPoint client;
CPoint screen;
GetCursorPositions(source_hwnd_, &client, &screen);
webview_->DragSourceMovedTo(client.x, client.y, screen.x, screen.y);
}
-
diff --git a/webkit/tools/test_shell/event_sending_controller.cc b/webkit/tools/test_shell/event_sending_controller.cc
index ac10803..aea9aed 100644
--- a/webkit/tools/test_shell/event_sending_controller.cc
+++ b/webkit/tools/test_shell/event_sending_controller.cc
@@ -16,9 +16,6 @@
#include "webkit/tools/test_shell/event_sending_controller.h"
-#if defined(OS_WIN)
-#include <objidl.h>
-#endif
#include <queue>
#include "base/logging.h"
@@ -43,12 +40,7 @@ int EventSendingController::last_button_number_ = -1;
namespace {
-#if defined(OS_WIN)
-static scoped_refptr<IDataObject> drag_data_object;
-#elif defined(OS_MACOSX)
-// Throughout this file, drag support is #ifdef-ed out. TODO(port): Add it in
-// for the Mac.
-#endif
+static scoped_ptr<WebDropData> drag_data_object;
static bool replaying_saved_events = false;
static std::queue<WebMouseEvent> mouse_event_queue;
@@ -155,10 +147,8 @@ EventSendingController::EventSendingController(TestShell* shell) {
void EventSendingController::Reset() {
// The test should have finished a drag and the mouse button state.
-#if defined(OS_WIN)
- DCHECK(!drag_data_object);
- drag_data_object = NULL;
-#endif
+ DCHECK(!drag_data_object.get());
+ drag_data_object.reset();
pressed_button_ = WebMouseEvent::BUTTON_NONE;
dragMode.Set(true);
last_click_time_sec = 0;
@@ -170,20 +160,16 @@ void EventSendingController::Reset() {
return shell_->webView();
}
-#if defined(OS_WIN)
-/* static */ void EventSendingController::DoDragDrop(IDataObject* data_obj) {
- drag_data_object = data_obj;
+/* static */ void EventSendingController::DoDragDrop(const WebDropData& data_obj) {
+ WebDropData* drop_data_copy = new WebDropData;
+ *drop_data_copy = data_obj;
+ drag_data_object.reset(drop_data_copy);
- DWORD effect = 0;
- POINTL screen_ptl = {0, 0};
- TestWebViewDelegate* delegate = shell_->delegate();
- delegate->drop_delegate()->DragEnter(drag_data_object, MK_LBUTTON,
- screen_ptl, &effect);
+ webview()->DragTargetDragEnter(data_obj, 0, 0, 0, 0);
// Finish processing events.
ReplaySavedEvents();
}
-#endif
WebMouseEvent::Button EventSendingController::GetButtonTypeFromButtonNumber(
int button_code) {
@@ -271,29 +257,19 @@ int EventSendingController::GetButtonNumberFromSingleArg(
webview()->HandleInputEvent(&e);
pressed_button_ = WebMouseEvent::BUTTON_NONE;
-#if defined(OS_WIN)
// If we're in a drag operation, complete it.
- if (drag_data_object) {
- TestWebViewDelegate* delegate = shell_->delegate();
- // Get screen mouse position.
- POINT screen_pt = { static_cast<LONG>(e.x),
- static_cast<LONG>(e.y) };
- ClientToScreen(shell_->webViewWnd(), &screen_pt);
- POINTL screen_ptl = { screen_pt.x, screen_pt.y };
-
- DWORD effect = 0;
- delegate->drop_delegate()->DragOver(0, screen_ptl, &effect);
- HRESULT hr = delegate->drag_delegate()->QueryContinueDrag(0, 0);
- if (hr == DRAGDROP_S_DROP && effect != DROPEFFECT_NONE) {
- DWORD effect = 0;
- delegate->drop_delegate()->Drop(drag_data_object.get(), 0, screen_ptl,
- &effect);
+ if (drag_data_object.get()) {
+ bool valid = webview()->DragTargetDragOver(e.x, e.y, e.global_x,
+ e.global_y);
+ if (valid) {
+ webview()->DragSourceEndedAt(e.x, e.y, e.global_x, e.global_y);
+ webview()->DragTargetDrop(e.x, e.y, e.global_x, e.global_y);
} else {
- delegate->drop_delegate()->DragLeave();
+ webview()->DragSourceEndedAt(e.x, e.y, e.global_x, e.global_y);
+ webview()->DragTargetDragLeave();
}
- drag_data_object = NULL;
+ drag_data_object.reset();
}
-#endif
}
void EventSendingController::mouseMoveTo(
@@ -320,22 +296,10 @@ int EventSendingController::GetButtonNumberFromSingleArg(
/* static */ void EventSendingController::DoMouseMove(const WebMouseEvent& e) {
webview()->HandleInputEvent(&e);
-#if defined(OS_WIN)
- if (pressed_button_ != WebMouseEvent::BUTTON_NONE && drag_data_object) {
- TestWebViewDelegate* delegate = shell_->delegate();
- // Get screen mouse position.
- POINT screen_pt = { static_cast<LONG>(e.x),
- static_cast<LONG>(e.y) };
- ClientToScreen(shell_->webViewWnd(), &screen_pt);
- POINTL screen_ptl = { screen_pt.x, screen_pt.y };
-
- HRESULT hr = delegate->drag_delegate()->QueryContinueDrag(0, MK_LBUTTON);
- DWORD effect = 0;
- delegate->drop_delegate()->DragOver(MK_LBUTTON, screen_ptl, &effect);
-
- delegate->drag_delegate()->GiveFeedback(effect);
+ if (pressed_button_ != WebMouseEvent::BUTTON_NONE && drag_data_object.get()) {
+ webview()->DragSourceMovedTo(e.x, e.y, e.global_x, e.global_y);
+ webview()->DragTargetDragOver(e.x, e.y, e.global_x, e.global_y);
}
-#endif
}
void EventSendingController::keyDown(
diff --git a/webkit/tools/test_shell/event_sending_controller.h b/webkit/tools/test_shell/event_sending_controller.h
index e544732..004cc82 100644
--- a/webkit/tools/test_shell/event_sending_controller.h
+++ b/webkit/tools/test_shell/event_sending_controller.h
@@ -19,12 +19,9 @@
#include "build/build_config.h"
#include "base/gfx/point.h"
#include "webkit/glue/cpp_bound_class.h"
+#include "webkit/glue/webdropdata.h"
#include "webkit/glue/webinputevent.h"
-#if defined(OS_WIN)
-struct IDataObject;
-struct IDropSource;
-#endif
class TestShell;
class WebView;
@@ -37,10 +34,8 @@ class EventSendingController : public CppBoundClass {
// Resets some static variable state.
void Reset();
-#if defined(OS_WIN)
- // Simulate Windows' drag&drop system call.
- static void DoDragDrop(IDataObject* drag_data);
-#endif
+ // Simulate drag&drop system call.
+ static void DoDragDrop(const WebDropData& drag_data);
// JS callback methods.
void mouseDown(const CppArgumentList& args, CppVariant* result);
diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc
index 475289ca..7592f06 100644
--- a/webkit/tools/test_shell/test_webview_delegate.cc
+++ b/webkit/tools/test_shell/test_webview_delegate.cc
@@ -48,25 +48,8 @@ std::wstring UrlSuitableForTestResult(const std::wstring& url) {
// Adds a file called "DRTFakeFile" to |data_object| (CF_HDROP). Use to fake
// dragging a file.
-void AddDRTFakeFileToDataObject(IDataObject* data_object) {
- STGMEDIUM medium = {0};
- medium.tymed = TYMED_HGLOBAL;
-
- const char filename[] = "DRTFakeFile";
- const int filename_len = arraysize(filename);
-
- // Allocate space for the DROPFILES struct, filename, and 2 null characters.
- medium.hGlobal = GlobalAlloc(GPTR, sizeof(DROPFILES) + filename_len + 2);
- DCHECK(medium.hGlobal);
- DROPFILES* drop_files = static_cast<DROPFILES*>(GlobalLock(medium.hGlobal));
- drop_files->pFiles = sizeof(DROPFILES);
- drop_files->fWide = 0; // Filenames are ascii
- strcpy_s(reinterpret_cast<char*>(drop_files) + sizeof(DROPFILES),
- filename_len, filename);
- GlobalUnlock(medium.hGlobal);
-
- FORMATETC file_desc_fmt = {CF_HDROP, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
- data_object->SetData(&file_desc_fmt, &medium, TRUE);
+void AddDRTFakeFileToDataObject(WebDropData* drop_data) {
+ drop_data->filenames.push_back(L"DRTFakeFile");
}
} // namespace
@@ -466,20 +449,23 @@ void TestWebViewDelegate::StartDragging(WebView* webview,
drag_delegate_ = new TestDragDelegate(shell_->webViewWnd(),
shell_->webView());
if (webkit_glue::IsLayoutTestMode()) {
+ WebDropData mutable_drop_data = drop_data;
if (shell_->layout_test_controller()->ShouldAddFileToPasteboard()) {
// Add a file called DRTFakeFile to the drag&drop clipboard.
- AddDRTFakeFileToDataObject(drop_data.data_object);
+ AddDRTFakeFileToDataObject(&mutable_drop_data);
}
// When running a test, we need to fake a drag drop operation otherwise
// Windows waits for real mouse events to know when the drag is over.
- EventSendingController::DoDragDrop(drop_data.data_object);
+ EventSendingController::DoDragDrop(mutable_drop_data);
} else {
- const DWORD ok_effect = DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOVE;
- DWORD effect;
- HRESULT res = DoDragDrop(drop_data.data_object, drag_delegate_.get(),
- ok_effect, &effect);
- DCHECK(DRAGDROP_S_DROP == res || DRAGDROP_S_CANCEL == res);
+ // TODO(tc): Drag and drop is disabled in the test shell because we need
+ // to be able to convert from WebDragData to an IDataObject.
+ //const DWORD ok_effect = DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOVE;
+ //DWORD effect;
+ //HRESULT res = DoDragDrop(drop_data.data_object, drag_delegate_.get(),
+ // ok_effect, &effect);
+ //DCHECK(DRAGDROP_S_DROP == res || DRAGDROP_S_CANCEL == res);
}
webview->DragSourceSystemDragEnded();
}
diff --git a/webkit/webkit.xcodeproj/project.pbxproj b/webkit/webkit.xcodeproj/project.pbxproj
index 77e4813..18243184 100644
--- a/webkit/webkit.xcodeproj/project.pbxproj
+++ b/webkit/webkit.xcodeproj/project.pbxproj
@@ -159,7 +159,11 @@
4DDC62B70EAD142D00FB5EBE /* MimeTypeArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DDC62B00EAD142D00FB5EBE /* MimeTypeArray.cpp */; };
4DDC62B80EAD142D00FB5EBE /* Plugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DDC62B20EAD142D00FB5EBE /* Plugin.cpp */; };
4DDC62B90EAD142D00FB5EBE /* PluginArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DDC62B40EAD142D00FB5EBE /* PluginArray.cpp */; };
+ 535EE0B60EC4CDEE00939D54 /* ClipboardChromium.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 535EE0B40EC4CDEE00939D54 /* ClipboardChromium.cpp */; };
+ 535EE0B80EC4CE0300939D54 /* EditorChromium.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 535EE0B70EC4CE0300939D54 /* EditorChromium.cpp */; };
+ 535EE0C00EC4D10E00939D54 /* clipboard_conversion.cc in Sources */ = {isa = PBXBuildFile; fileRef = 535EE0BE0EC4D10E00939D54 /* clipboard_conversion.cc */; };
538D819B0EC371EA00278C31 /* password_autocomplete_listener.cc in Sources */ = {isa = PBXBuildFile; fileRef = 538D81990EC371EA00278C31 /* password_autocomplete_listener.cc */; };
+ 53BECCC80EC4FF0500DC1DCD /* ChromiumDataObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53BECCC60EC4FF0500DC1DCD /* ChromiumDataObject.cpp */; };
53E8BE100EC36A4E00B3F8B0 /* dom_operations.cc in Sources */ = {isa = PBXBuildFile; fileRef = 825405050D92E3DA0006B936 /* dom_operations.cc */; };
53E8BE480EC36DD700B3F8B0 /* autocomplete_input_listener.cc in Sources */ = {isa = PBXBuildFile; fileRef = 53E8BE470EC36DD700B3F8B0 /* autocomplete_input_listener.cc */; };
7B0091350DAFEFBE00F72082 /* CSSGrammar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B00912B0DAFEFBE00F72082 /* CSSGrammar.cpp */; };
@@ -1279,7 +1283,6 @@
E48A07280E3F95A000172919 /* NativeImageSkia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E48A07220E3F95A000172919 /* NativeImageSkia.cpp */; };
E4A134090E37C47E00110AA2 /* v8_proxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B0095EA0DAFF0DD00F72082 /* v8_proxy.cpp */; };
E4A238C70E3FA19C002BDE14 /* image_decoder.cc in Sources */ = {isa = PBXBuildFile; fileRef = E4A238C50E3FA19C002BDE14 /* image_decoder.cc */; };
- E4D08FDB0EAE7A5F0022CE54 /* EditorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4D08FDA0EAE7A5F0022CE54 /* EditorMac.mm */; };
E4E4C7F90E781B5B009A687C /* webplugin_impl_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4E4C7F80E781B5B009A687C /* webplugin_impl_mac.mm */; };
E4E4C8560E7832E2009A687C /* PlatformContextSkia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4E4C8530E7832DC009A687C /* PlatformContextSkia.cpp */; };
E4E4C94A0E797648009A687C /* ImageSourceCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B5E8FBD0D7F3CC1001ECF42 /* ImageSourceCG.cpp */; };
@@ -1692,8 +1695,15 @@
4DDC62B30EAD142D00FB5EBE /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Plugin.h; sourceTree = "<group>"; };
4DDC62B40EAD142D00FB5EBE /* PluginArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginArray.cpp; sourceTree = "<group>"; };
4DDC62B50EAD142D00FB5EBE /* PluginArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginArray.h; sourceTree = "<group>"; };
+ 535EE0B40EC4CDEE00939D54 /* ClipboardChromium.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClipboardChromium.cpp; sourceTree = "<group>"; };
+ 535EE0B50EC4CDEE00939D54 /* ClipboardChromium.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClipboardChromium.h; sourceTree = "<group>"; };
+ 535EE0B70EC4CE0300939D54 /* EditorChromium.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EditorChromium.cpp; sourceTree = "<group>"; };
+ 535EE0BE0EC4D10E00939D54 /* clipboard_conversion.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = clipboard_conversion.cc; sourceTree = "<group>"; };
+ 535EE0BF0EC4D10E00939D54 /* clipboard_conversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = clipboard_conversion.h; sourceTree = "<group>"; };
538D81990EC371EA00278C31 /* password_autocomplete_listener.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = password_autocomplete_listener.cc; sourceTree = "<group>"; };
538D819A0EC371EA00278C31 /* password_autocomplete_listener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = password_autocomplete_listener.h; sourceTree = "<group>"; };
+ 53BECCC60EC4FF0500DC1DCD /* ChromiumDataObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChromiumDataObject.cpp; sourceTree = "<group>"; };
+ 53BECCC70EC4FF0500DC1DCD /* ChromiumDataObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChromiumDataObject.h; sourceTree = "<group>"; };
53E8BE470EC36DD700B3F8B0 /* autocomplete_input_listener.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = autocomplete_input_listener.cc; sourceTree = "<group>"; };
53E8BE8D0EC36F4B00B3F8B0 /* autocomplete_input_listener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = autocomplete_input_listener.h; sourceTree = "<group>"; };
7B00912B0DAFEFBE00F72082 /* CSSGrammar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSGrammar.cpp; sourceTree = "<group>"; };
@@ -4242,7 +4252,6 @@
E4A238C50E3FA19C002BDE14 /* image_decoder.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = image_decoder.cc; sourceTree = "<group>"; };
E4A238C60E3FA19C002BDE14 /* image_decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = image_decoder.h; sourceTree = "<group>"; };
E4A9708A0E36150500E8EF3B /* ChromeClientChromium.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChromeClientChromium.h; path = chromium/ChromeClientChromium.h; sourceTree = "<group>"; };
- E4D08FDA0EAE7A5F0022CE54 /* EditorMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = EditorMac.mm; path = mac/EditorMac.mm; sourceTree = "<group>"; };
E4E4C7F80E781B5B009A687C /* webplugin_impl_mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = webplugin_impl_mac.mm; sourceTree = "<group>"; };
E4E4C8530E7832DC009A687C /* PlatformContextSkia.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformContextSkia.cpp; sourceTree = "<group>"; };
E4E4CA190E80208A009A687C /* FontCacheMacPending.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontCacheMacPending.cpp; sourceTree = "<group>"; };
@@ -7374,7 +7383,6 @@
82C260620DCB9FFE005CFE91 /* image-decoders */,
822B1BE70DC77910005C9A96 /* graphics */,
E45628270E269688005E4685 /* network */,
- E4D08FDA0EAE7A5F0022CE54 /* EditorMac.mm */,
AB8FE8A40E9BCD3E0051E7B4 /* GKURL.cpp */,
E40FB28E0EAFF0BC006F380A /* PlatformScreenMac.mm */,
B507F51B0E9BE98B00D16D77 /* PluginStubsMac.cpp */,
@@ -7421,6 +7429,8 @@
825404F10D92E3DA0006B936 /* chrome_client_impl.cc */,
825404F20D92E3DA0006B936 /* chrome_client_impl.h */,
934CC0030EBFE0E000A658F2 /* chromium_bridge_impl.cc */,
+ 535EE0BE0EC4D10E00939D54 /* clipboard_conversion.cc */,
+ 535EE0BF0EC4D10E00939D54 /* clipboard_conversion.h */,
825404F30D92E3DA0006B936 /* context_menu_client_impl.cc */,
825404F40D92E3DA0006B936 /* context_menu_client_impl.h */,
825404F50D92E3DA0006B936 /* context_menu_unittest.cc */,
@@ -7768,6 +7778,10 @@
E473F6310EADFEBC006C2098 /* chromium */ = {
isa = PBXGroup;
children = (
+ 53BECCC60EC4FF0500DC1DCD /* ChromiumDataObject.cpp */,
+ 53BECCC70EC4FF0500DC1DCD /* ChromiumDataObject.h */,
+ 535EE0B40EC4CDEE00939D54 /* ClipboardChromium.cpp */,
+ 535EE0B50EC4CDEE00939D54 /* ClipboardChromium.h */,
E473F6320EADFF61006C2098 /* ContextMenuItemChromium.cpp */,
E473F6330EADFF61006C2098 /* ContextMenuChromium.cpp */,
E473F6360EADFF84006C2098 /* CursorChromium.cpp */,
@@ -7775,6 +7789,7 @@
E473F6390EADFF8E006C2098 /* DragDataChromium.cpp */,
E473F63A0EADFF8E006C2098 /* DragDataRef.h */,
E473F63B0EADFF8E006C2098 /* DragImageChromium.cpp */,
+ 535EE0B70EC4CE0300939D54 /* EditorChromium.cpp */,
E473F63E0EADFFB5006C2098 /* FileChooserChromium.cpp */,
B556C33C0EB9035B00418C57 /* FileSystemChromium.cpp */,
B556C24E0EB8FCD800418C57 /* FileSystemChromiumMac.mm */,
@@ -9260,6 +9275,7 @@
53E8BE480EC36DD700B3F8B0 /* autocomplete_input_listener.cc in Sources */,
E456270D0E268F03005E4685 /* chrome_client_impl.cc in Sources */,
934CC0040EBFE0E000A658F2 /* chromium_bridge_impl.cc in Sources */,
+ 535EE0C00EC4D10E00939D54 /* clipboard_conversion.cc in Sources */,
E45626FD0E268F03005E4685 /* context_menu_client_impl.cc in Sources */,
E45627070E268F03005E4685 /* cpp_bound_class.cc in Sources */,
E45627060E268F03005E4685 /* cpp_variant.cc in Sources */,
@@ -9309,6 +9325,8 @@
E45627EA0E2694B8005E4685 /* BMPImageDecoder.cpp in Sources */,
E45627E90E2694B8005E4685 /* BMPImageReader.cpp in Sources */,
E45627EE0E2694B8005E4685 /* CachedPage.cpp in Sources */,
+ 53BECCC80EC4FF0500DC1DCD /* ChromiumDataObject.cpp in Sources */,
+ 535EE0B60EC4CDEE00939D54 /* ClipboardChromium.cpp in Sources */,
E473F6350EADFF61006C2098 /* ContextMenuChromium.cpp in Sources */,
E473F6340EADFF61006C2098 /* ContextMenuItemChromium.cpp in Sources */,
93BF8E9A0EA6B0EA0030F05C /* CookieJarChromium.cpp in Sources */,
@@ -9317,7 +9335,7 @@
E473F68A0EAE0230006C2098 /* DragControllerChromium.cpp in Sources */,
E473F63C0EADFF8E006C2098 /* DragDataChromium.cpp in Sources */,
E473F63D0EADFF8E006C2098 /* DragImageChromium.cpp in Sources */,
- E4D08FDB0EAE7A5F0022CE54 /* EditorMac.mm in Sources */,
+ 535EE0B80EC4CE0300939D54 /* EditorChromium.cpp in Sources */,
E473F6860EAE01F5006C2098 /* EventHandlerChromium.cpp in Sources */,
4D11C4E10E9ABEA900EF7617 /* ExceptionContextV8.cpp in Sources */,
E473F63F0EADFFB5006C2098 /* FileChooserChromium.cpp in Sources */,