OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/test/mock_webclipboard_impl.h" | 5 #include "content/test/mock_webclipboard_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 blink::WebBlobInfo MockWebClipboardImpl::readImage( | 101 blink::WebBlobInfo MockWebClipboardImpl::readImage( |
102 blink::WebClipboard::Buffer buffer) { | 102 blink::WebClipboard::Buffer buffer) { |
103 std::vector<unsigned char> output; | 103 std::vector<unsigned char> output; |
104 const SkBitmap& bitmap = m_image.getSkBitmap(); | 104 const SkBitmap& bitmap = m_image.getSkBitmap(); |
105 if (!gfx::PNGCodec::FastEncodeBGRASkBitmap( | 105 if (!gfx::PNGCodec::FastEncodeBGRASkBitmap( |
106 bitmap, false /* discard_transparency */, &output)) { | 106 bitmap, false /* discard_transparency */, &output)) { |
107 return blink::WebBlobInfo(); | 107 return blink::WebBlobInfo(); |
108 } | 108 } |
109 const WebString& uuid = base::ASCIIToUTF16(base::GenerateGUID()); | 109 const WebString& uuid = base::ASCIIToUTF16(base::GenerateGUID()); |
110 std::unique_ptr<blink::WebBlobRegistry::Builder> blob_builder( | 110 std::unique_ptr<blink::WebBlobRegistry::Builder> blob_builder( |
111 blink::Platform::current()->blobRegistry()->createBuilder( | 111 blink::Platform::current()->getBlobRegistry()->createBuilder( |
112 uuid, blink::WebString())); | 112 uuid, blink::WebString())); |
113 blob_builder->appendData(blink::WebThreadSafeData( | 113 blob_builder->appendData(blink::WebThreadSafeData( |
114 reinterpret_cast<char*>(output.data()), output.size())); | 114 reinterpret_cast<char*>(output.data()), output.size())); |
115 blob_builder->build(); | 115 blob_builder->build(); |
116 return blink::WebBlobInfo( | 116 return blink::WebBlobInfo( |
117 uuid, base::ASCIIToUTF16(ui::Clipboard::kMimeTypePNG), output.size()); | 117 uuid, base::ASCIIToUTF16(ui::Clipboard::kMimeTypePNG), output.size()); |
118 } | 118 } |
119 | 119 |
120 blink::WebImage MockWebClipboardImpl::readRawImage( | 120 blink::WebImage MockWebClipboardImpl::readRawImage( |
121 blink::WebClipboard::Buffer buffer) { | 121 blink::WebClipboard::Buffer buffer) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 void MockWebClipboardImpl::clear() { | 204 void MockWebClipboardImpl::clear() { |
205 m_plainText = base::NullableString16(); | 205 m_plainText = base::NullableString16(); |
206 m_htmlText = base::NullableString16(); | 206 m_htmlText = base::NullableString16(); |
207 m_image.reset(); | 207 m_image.reset(); |
208 m_customData.clear(); | 208 m_customData.clear(); |
209 m_writeSmartPaste = false; | 209 m_writeSmartPaste = false; |
210 } | 210 } |
211 | 211 |
212 } // namespace content | 212 } // namespace content |
OLD | NEW |