Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Unified Diff: ios/web/public/image_fetcher/webp_decoder.h

Issue 2689213010: Add a static method to WebPDecoder to decode WebP (Closed)
Patch Set: Address comment Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/web/public/image_fetcher/webp_decoder.h
diff --git a/ios/web/public/image_fetcher/webp_decoder.h b/ios/web/public/image_fetcher/webp_decoder.h
index 46fdb23200c4c22d480dd67b93fbb8ea03c3e3fb..f11c70a34392a8cdf6a0d726816fcb5f4c32707e 100644
--- a/ios/web/public/image_fetcher/webp_decoder.h
+++ b/ios/web/public/image_fetcher/webp_decoder.h
@@ -40,6 +40,27 @@ class WebpDecoder : public base::RefCountedThreadSafe<WebpDecoder> {
explicit WebpDecoder(WebpDecoder::Delegate* delegate);
+ // Returns an NSData object containing the decoded image data of the given
+ // webp_image. Returns nil in case of failure.
+ static NSData* DecodeWebpImage(NSData* webp_image);
+
+ // Returns true if the given image_data is a WebP image.
+ //
+ // Every WebP file contains a 12 byte file header in the beginning of the
+ // file.
+ // A WebP file header starts with the four ASCII characters "RIFF". The next
+ // four bytes contain the image size and the last four header bytes contain
+ // the four ASCII characters "WEBP".
+ //
+ // WebP file header:
+ // 1 1
+ // Byte Nr. 0 1 2 3 4 5 6 7 8 9 0 1
+ // Byte value [ R I F F ? ? ? ? W E B P ]
+ //
+ // For more information see:
+ // https://developers.google.com/speed/webp/docs/riff_container#webp_file_header
+ static bool IsWebpImage(const std::string& image_data);
+
// For tests.
static size_t GetHeaderSize();
« no previous file with comments | « ios/chrome/browser/suggestions/ios_image_decoder_impl.mm ('k') | ios/web/public/image_fetcher/webp_decoder.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698