OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_IMAGE_FETCHER_IMAGE_DECODER_H_ |
| 6 #define COMPONENTS_IMAGE_FETCHER_IMAGE_DECODER_H_ |
| 7 |
| 8 #include <string> |
| 9 #include "base/callback_forward.h" |
| 10 |
| 11 namespace gfx { |
| 12 class Image; |
| 13 } // namespace gfx |
| 14 |
| 15 namespace image_fetcher { |
| 16 |
| 17 using ImageDecodedCallback = base::Callback<void(const gfx::Image&)>; |
| 18 |
| 19 // ImageDecoder defines the common interface for decoding images. |
| 20 class ImageDecoder { |
| 21 public: |
| 22 ImageDecoder() {} |
| 23 virtual ~ImageDecoder() {} |
| 24 |
| 25 // Decodes the passed |image_data| and runs the given callback. The callback |
| 26 // is run even if decoding the image fails. In case an error occured during |
| 27 // decoding the image an empty image is passed to the callback. |
| 28 virtual void DecodeImage(const std::string& image_data, |
| 29 const ImageDecodedCallback& callback) = 0; |
| 30 |
| 31 private: |
| 32 DISALLOW_COPY_AND_ASSIGN(ImageDecoder); |
| 33 }; |
| 34 |
| 35 } // namespace image_fetcher |
| 36 |
| 37 #endif // COMPONENTS_IMAGE_FETCHER_IMAGE_DECODER_H_ |
OLD | NEW |