| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/renderer/webclipboard_impl.h" | 5 #include "content/renderer/webclipboard_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 } | 149 } |
| 150 | 150 |
| 151 void WebClipboardImpl::writeImage(const WebImage& image, | 151 void WebClipboardImpl::writeImage(const WebImage& image, |
| 152 const WebURL& url, | 152 const WebURL& url, |
| 153 const WebString& title) { | 153 const WebString& title) { |
| 154 ScopedClipboardWriterGlue scw(client_); | 154 ScopedClipboardWriterGlue scw(client_); |
| 155 | 155 |
| 156 if (!image.isNull()) { | 156 if (!image.isNull()) { |
| 157 const SkBitmap& bitmap = image.getSkBitmap(); | 157 const SkBitmap& bitmap = image.getSkBitmap(); |
| 158 // WriteBitmapFromPixels expects 32-bit data. | 158 // WriteBitmapFromPixels expects 32-bit data. |
| 159 DCHECK_EQ(bitmap.config(), SkBitmap::kARGB_8888_Config); | 159 DCHECK_EQ(bitmap.colorType(), kN32_SkColorType); |
| 160 | 160 |
| 161 SkAutoLockPixels locked(bitmap); | 161 SkAutoLockPixels locked(bitmap); |
| 162 void *pixels = bitmap.getPixels(); | 162 void *pixels = bitmap.getPixels(); |
| 163 // TODO(piman): this should not be NULL, but it is. crbug.com/369621 | 163 // TODO(piman): this should not be NULL, but it is. crbug.com/369621 |
| 164 if (!pixels) | 164 if (!pixels) |
| 165 return; | 165 return; |
| 166 scw.WriteBitmapFromPixels(pixels, image.size()); | 166 scw.WriteBitmapFromPixels(pixels, image.size()); |
| 167 } | 167 } |
| 168 | 168 |
| 169 if (!url.isEmpty()) { | 169 if (!url.isEmpty()) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 return false; | 220 return false; |
| 221 #endif | 221 #endif |
| 222 default: | 222 default: |
| 223 NOTREACHED(); | 223 NOTREACHED(); |
| 224 return false; | 224 return false; |
| 225 } | 225 } |
| 226 return true; | 226 return true; |
| 227 } | 227 } |
| 228 | 228 |
| 229 } // namespace content | 229 } // namespace content |
| OLD | NEW |