Chromium Code Reviews| Index: components/suggestions/image_manager.cc |
| diff --git a/components/suggestions/image_manager.cc b/components/suggestions/image_manager.cc |
| index 9e4338127d35e4fcce065d010f06a66a5fe01ecb..b27a4c41d5d142b366968cbfbc5c0a752f3c25a4 100644 |
| --- a/components/suggestions/image_manager.cc |
| +++ b/components/suggestions/image_manager.cc |
| @@ -6,15 +6,24 @@ |
| #include "base/bind.h" |
| #include "components/suggestions/image_fetcher.h" |
| + |
| +#if defined(OS_IOS) |
| +#include "components/suggestions/image_manager_utils_ios.h" |
| +#else |
| #include "ui/gfx/codec/jpeg_codec.h" |
| +#endif |
| using leveldb_proto::ProtoDatabase; |
| namespace { |
| -// From JPEG-encoded bytes to SkBitmap. |
| +// From encoded bytes to SkBitmap. |
| SkBitmap* DecodeImage(const std::vector<unsigned char>& encoded_data) { |
| +#if defined(OS_IOS) |
| + return suggestions::DecodeJPEGToSkBitmap(encoded_data); |
|
blundell
2014/10/10 06:01:05
nit: this should be in the suggestions namespace,
Mathieu
2014/10/10 18:06:10
Done.
|
| +#else |
| return gfx::JPEGCodec::Decode(&encoded_data[0], encoded_data.size()); |
| +#endif |
| } |
| } // namespace |
| @@ -215,6 +224,9 @@ void ImageManager::ServePendingCacheRequests() { |
| // static |
| bool ImageManager::EncodeImage(const SkBitmap& bitmap, |
| std::vector<unsigned char>* dest) { |
| +#if defined(OS_IOS) |
| + return suggestions::EncodeSkBitmapToJPEG(bitmap, dest); |
|
blundell
2014/10/10 06:01:05
this is in the suggestions namespace.
Mathieu
2014/10/10 18:06:10
Done.
|
| +#else |
| SkAutoLockPixels bitmap_lock(bitmap); |
| if (!bitmap.readyToDraw() || bitmap.isNull()) { |
| return false; |
| @@ -223,6 +235,7 @@ bool ImageManager::EncodeImage(const SkBitmap& bitmap, |
| reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)), |
| gfx::JPEGCodec::FORMAT_SkBitmap, bitmap.width(), bitmap.height(), |
| bitmap.rowBytes(), 100, dest); |
| +#endif |
| } |
| } // namespace suggestions |