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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // for endianess reasons, it will be BGRA8888 on Windows. | 95 // for endianess reasons, it will be BGRA8888 on Windows. |
96 const SkBitmap& bitmap = m_image.getSkBitmap(); | 96 const SkBitmap& bitmap = m_image.getSkBitmap(); |
97 SkAutoLockPixels lock(bitmap); | 97 SkAutoLockPixels lock(bitmap); |
98 gfx::PNGCodec::Encode(static_cast<unsigned char*>(bitmap.getPixels()), | 98 gfx::PNGCodec::Encode(static_cast<unsigned char*>(bitmap.getPixels()), |
99 #if defined(OS_ANDROID) | 99 #if defined(OS_ANDROID) |
100 gfx::PNGCodec::FORMAT_RGBA, | 100 gfx::PNGCodec::FORMAT_RGBA, |
101 #else | 101 #else |
102 gfx::PNGCodec::FORMAT_BGRA, | 102 gfx::PNGCodec::FORMAT_BGRA, |
103 #endif | 103 #endif |
104 gfx::Size(bitmap.width(), bitmap.height()), | 104 gfx::Size(bitmap.width(), bitmap.height()), |
105 static_cast<int>(bitmap.rowBytes()), | 105 bitmap.rowBytes(), |
106 false /* discard_transparency */, | 106 false /* discard_transparency */, |
107 std::vector<gfx::PNGCodec::Comment>(), | 107 std::vector<gfx::PNGCodec::Comment>(), |
108 &encoded_image); | 108 &encoded_image); |
109 data.assign(reinterpret_cast<char*>(vector_as_array(&encoded_image)), | 109 data.assign(reinterpret_cast<char*>(vector_as_array(&encoded_image)), |
110 encoded_image.size()); | 110 encoded_image.size()); |
111 return data; | 111 return data; |
112 } | 112 } |
113 | 113 |
114 blink::WebString MockWebClipboardImpl::readCustomData( | 114 blink::WebString MockWebClipboardImpl::readCustomData( |
115 blink::WebClipboard::Buffer buffer, | 115 blink::WebClipboard::Buffer buffer, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 void MockWebClipboardImpl::clear() { | 187 void MockWebClipboardImpl::clear() { |
188 m_plainText = base::NullableString16(); | 188 m_plainText = base::NullableString16(); |
189 m_htmlText = base::NullableString16(); | 189 m_htmlText = base::NullableString16(); |
190 m_image.reset(); | 190 m_image.reset(); |
191 m_customData.clear(); | 191 m_customData.clear(); |
192 m_writeSmartPaste = false; | 192 m_writeSmartPaste = false; |
193 } | 193 } |
194 | 194 |
195 } // namespace content | 195 } // namespace content |
OLD | NEW |