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

Side by Side Diff: components/image_fetcher/image_decoder.h

Issue 2715153006: Set desired_image_size when decoding images for NTP Tile icons. (Closed)
Patch Set: fix dependencies Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « components/image_fetcher/DEPS ('k') | components/image_fetcher/image_fetcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 #ifndef COMPONENTS_IMAGE_FETCHER_IMAGE_DECODER_H_ 5 #ifndef COMPONENTS_IMAGE_FETCHER_IMAGE_DECODER_H_
6 #define COMPONENTS_IMAGE_FETCHER_IMAGE_DECODER_H_ 6 #define COMPONENTS_IMAGE_FETCHER_IMAGE_DECODER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 12
13 namespace gfx { 13 namespace gfx {
14 class Image; 14 class Image;
15 class Size;
15 } // namespace gfx 16 } // namespace gfx
16 17
17 namespace image_fetcher { 18 namespace image_fetcher {
18 19
19 using ImageDecodedCallback = base::Callback<void(const gfx::Image&)>; 20 using ImageDecodedCallback = base::Callback<void(const gfx::Image&)>;
20 21
21 // ImageDecoder defines the common interface for decoding images. 22 // ImageDecoder defines the common interface for decoding images.
22 class ImageDecoder { 23 class ImageDecoder {
23 public: 24 public:
24 ImageDecoder() {} 25 ImageDecoder() {}
25 virtual ~ImageDecoder() {} 26 virtual ~ImageDecoder() {}
26 27
27 // Decodes the passed |image_data| and runs the given callback. The callback 28 // Decodes the passed |image_data| and runs the given callback. The callback
28 // is run even if decoding the image fails. In case an error occured during 29 // is run even if decoding the image fails. In case an error occured during
29 // decoding the image an empty image is passed to the callback. 30 // decoding the image an empty image is passed to the callback.
31 // For images with multiple frames (e.g. ico files), a frame with a size as
32 // close as possible to |desired_image_frame_size| is chosen (tries to take
33 // one in larger size if there's no precise match).
Mathieu 2017/03/01 20:24:30 I would repeat the comment about gfx::Size() every
tschumann 2017/03/01 20:55:06 Done.
30 virtual void DecodeImage(const std::string& image_data, 34 virtual void DecodeImage(const std::string& image_data,
35 const gfx::Size& desired_image_frame_size,
31 const ImageDecodedCallback& callback) = 0; 36 const ImageDecodedCallback& callback) = 0;
32 37
33 private: 38 private:
34 DISALLOW_COPY_AND_ASSIGN(ImageDecoder); 39 DISALLOW_COPY_AND_ASSIGN(ImageDecoder);
35 }; 40 };
36 41
37 } // namespace image_fetcher 42 } // namespace image_fetcher
38 43
39 #endif // COMPONENTS_IMAGE_FETCHER_IMAGE_DECODER_H_ 44 #endif // COMPONENTS_IMAGE_FETCHER_IMAGE_DECODER_H_
OLDNEW
« no previous file with comments | « components/image_fetcher/DEPS ('k') | components/image_fetcher/image_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698