| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, 2009, Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/clipboard/Pasteboard.h" | 32 #include "core/clipboard/Pasteboard.h" |
| 33 | 33 |
| 34 #include "core/clipboard/DataObject.h" | 34 #include "core/clipboard/DataObject.h" |
| 35 #include "platform/clipboard/ClipboardUtilities.h" | 35 #include "platform/clipboard/ClipboardUtilities.h" |
| 36 #include "platform/graphics/Image.h" | 36 #include "platform/graphics/Image.h" |
| 37 #include "platform/graphics/skia/NativeImageSkia.h" | |
| 38 #include "platform/weborigin/KURL.h" | 37 #include "platform/weborigin/KURL.h" |
| 39 #include "public/platform/Platform.h" | 38 #include "public/platform/Platform.h" |
| 40 #include "public/platform/WebDragData.h" | 39 #include "public/platform/WebDragData.h" |
| 41 #include "public/platform/WebString.h" | 40 #include "public/platform/WebString.h" |
| 42 #include "public/platform/WebURL.h" | 41 #include "public/platform/WebURL.h" |
| 43 #include "wtf/PassRefPtr.h" | 42 #include "wtf/PassRefPtr.h" |
| 44 #include "wtf/RefPtr.h" | 43 #include "wtf/RefPtr.h" |
| 45 | 44 |
| 46 namespace blink { | 45 namespace blink { |
| 47 | 46 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 75 blink::Platform::current()->clipboard()->writePlainText(plainText); | 74 blink::Platform::current()->clipboard()->writePlainText(plainText); |
| 76 #else | 75 #else |
| 77 blink::Platform::current()->clipboard()->writePlainText(text); | 76 blink::Platform::current()->clipboard()->writePlainText(text); |
| 78 #endif | 77 #endif |
| 79 } | 78 } |
| 80 | 79 |
| 81 void Pasteboard::writeImage(Image* image, const KURL& url, const String& title) | 80 void Pasteboard::writeImage(Image* image, const KURL& url, const String& title) |
| 82 { | 81 { |
| 83 ASSERT(image); | 82 ASSERT(image); |
| 84 | 83 |
| 85 RefPtr<NativeImageSkia> bitmap = image->nativeImageForCurrentFrame(); | 84 SkBitmap bitmap; |
| 86 if (!bitmap) | 85 if (!image->bitmapForCurrentFrame(&bitmap)) |
| 87 return; | 86 return; |
| 88 | 87 |
| 89 blink::WebImage webImage = bitmap->bitmap(); | 88 blink::WebImage webImage = bitmap; |
| 90 blink::Platform::current()->clipboard()->writeImage(webImage, blink::WebURL(
url), blink::WebString(title)); | 89 blink::Platform::current()->clipboard()->writeImage(webImage, blink::WebURL(
url), blink::WebString(title)); |
| 91 } | 90 } |
| 92 | 91 |
| 93 void Pasteboard::writeDataObject(PassRefPtrWillBeRawPtr<DataObject> dataObject) | 92 void Pasteboard::writeDataObject(PassRefPtrWillBeRawPtr<DataObject> dataObject) |
| 94 { | 93 { |
| 95 blink::Platform::current()->clipboard()->writeDataObject(dataObject->toWebDr
agData()); | 94 blink::Platform::current()->clipboard()->writeDataObject(dataObject->toWebDr
agData()); |
| 96 } | 95 } |
| 97 | 96 |
| 98 bool Pasteboard::canSmartReplace() | 97 bool Pasteboard::canSmartReplace() |
| 99 { | 98 { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 130 String text = plainText; | 129 String text = plainText; |
| 131 #if OS(WIN) | 130 #if OS(WIN) |
| 132 replaceNewlinesWithWindowsStyleNewlines(text); | 131 replaceNewlinesWithWindowsStyleNewlines(text); |
| 133 #endif | 132 #endif |
| 134 replaceNBSPWithSpace(text); | 133 replaceNBSPWithSpace(text); |
| 135 | 134 |
| 136 blink::Platform::current()->clipboard()->writeHTML(markup, documentURL, text
, canSmartCopyOrDelete); | 135 blink::Platform::current()->clipboard()->writeHTML(markup, documentURL, text
, canSmartCopyOrDelete); |
| 137 } | 136 } |
| 138 | 137 |
| 139 } // namespace blink | 138 } // namespace blink |
| OLD | NEW |