| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 // Modified from Apple's version to not directly call any windows methods as | 26 // Modified from Apple's version to not directly call any windows methods as |
| 27 // they may not be available to us in the multiprocess | 27 // they may not be available to us in the multiprocess |
| 28 | 28 |
| 29 #include "config.h" | 29 #include "config.h" |
| 30 #include "DragData.h" | 30 #include "DragData.h" |
| 31 | 31 |
| 32 #if PLATFORM(WIN) |
| 32 #include "ClipboardWin.h" | 33 #include "ClipboardWin.h" |
| 33 #include "ClipboardUtilitiesWin.h" | 34 #include "ClipboardUtilitiesWin.h" |
| 35 #include "WCDataObject.h" |
| 36 #endif |
| 37 |
| 34 #include "DocumentFragment.h" | 38 #include "DocumentFragment.h" |
| 35 #include "KURL.h" | 39 #include "KURL.h" |
| 36 #include "PlatformString.h" | 40 #include "PlatformString.h" |
| 37 #include "Markup.h" | 41 #include "Markup.h" |
| 38 #include "WCDataObject.h" | |
| 39 | 42 |
| 40 #undef LOG | 43 #undef LOG |
| 41 #include "base/file_util.h" | 44 #include "base/file_util.h" |
| 42 #include "base/string_util.h" | 45 #include "base/string_util.h" |
| 43 #include "net/base/base64.h" | 46 #include "net/base/base64.h" |
| 44 #include "webkit/glue/glue_util.h" | 47 #include "webkit/glue/glue_util.h" |
| 45 #include "webkit/glue/webdropdata.h" | 48 #include "webkit/glue/webdropdata.h" |
| 46 #include "webkit/glue/webkit_glue.h" | 49 #include "webkit/glue/webkit_glue.h" |
| 47 | 50 |
| 48 namespace { | 51 namespace { |
| 49 | 52 |
| 50 bool containsHTML(const WebDropData& drop_data) { | 53 bool containsHTML(const WebDropData& drop_data) { |
| 51 std::wstring html; | 54 std::wstring html; |
| 52 return drop_data.cf_html.length() > 0 | 55 return drop_data.cf_html.length() > 0 |
| 53 || drop_data.text_html.length() > 0; | 56 || drop_data.text_html.length() > 0; |
| 54 } | 57 } |
| 55 | 58 |
| 56 // Our DragDataRef is actually a WebDropData* instead of a IDataObject*. | 59 // Our DragDataRef is actually a WebDropData* instead of a IDataObject*. |
| 57 // Provide a helper method for converting back. | 60 // Provide a helper method for converting back. |
| 58 WebDropData* dropData(DragDataRef dragData) { | 61 WebDropData* dropData(DragDataRef dragData) { |
| 59 return reinterpret_cast<WebDropData*>(dragData); | 62 return reinterpret_cast<WebDropData*>(dragData); |
| 60 } | 63 } |
| 61 | 64 |
| 62 } | 65 } |
| 63 | 66 |
| 64 namespace WebCore { | 67 namespace WebCore { |
| 65 | 68 |
| 66 PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) co
nst | 69 PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) co
nst |
| 67 { | 70 { |
| 71 // TODO(darin): Invent ClipboardChromium and use that instead. |
| 72 #if PLATFORM(WIN) |
| 68 WCDataObject* data; | 73 WCDataObject* data; |
| 69 WCDataObject::createInstance(&data); | 74 WCDataObject::createInstance(&data); |
| 70 RefPtr<ClipboardWin> clipboard = ClipboardWin::create(true, data, policy); | 75 RefPtr<ClipboardWin> clipboard = ClipboardWin::create(true, data, policy); |
| 71 // The clipboard keeps a reference to the WCDataObject, so we can release | 76 // The clipboard keeps a reference to the WCDataObject, so we can release |
| 72 // our reference to it. | 77 // our reference to it. |
| 73 data->Release(); | 78 data->Release(); |
| 74 | 79 |
| 75 return clipboard.release(); | 80 return clipboard.release(); |
| 81 #else |
| 82 return PassRefPtr<Clipboard>(0); |
| 83 #endif |
| 76 } | 84 } |
| 77 | 85 |
| 78 bool DragData::containsURL() const | 86 bool DragData::containsURL() const |
| 79 { | 87 { |
| 80 return dropData(m_platformDragData)->url.is_valid(); | 88 return dropData(m_platformDragData)->url.is_valid(); |
| 81 } | 89 } |
| 82 | 90 |
| 83 String DragData::asURL(String* title) const | 91 String DragData::asURL(String* title) const |
| 84 { | 92 { |
| 85 WebDropData* data = dropData(m_platformDragData); | 93 WebDropData* data = dropData(m_platformDragData); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 182 |
| 175 return 0; | 183 return 0; |
| 176 } | 184 } |
| 177 | 185 |
| 178 Color DragData::asColor() const | 186 Color DragData::asColor() const |
| 179 { | 187 { |
| 180 return Color(); | 188 return Color(); |
| 181 } | 189 } |
| 182 | 190 |
| 183 } | 191 } |
| OLD | NEW |