OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_IMAGE_LOADER_H_ | 5 #ifndef EXTENSIONS_BROWSER_IMAGE_LOADER_H_ |
6 #define EXTENSIONS_BROWSER_IMAGE_LOADER_H_ | 6 #define EXTENSIONS_BROWSER_IMAGE_LOADER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 | 73 |
74 ImageLoader(); | 74 ImageLoader(); |
75 ~ImageLoader() override; | 75 ~ImageLoader() override; |
76 | 76 |
77 // Specify image resource to load. If the loaded image is larger than | 77 // Specify image resource to load. If the loaded image is larger than |
78 // |max_size| it will be resized to those dimensions. IMPORTANT NOTE: this | 78 // |max_size| it will be resized to those dimensions. IMPORTANT NOTE: this |
79 // function may call back your callback synchronously (ie before it returns) | 79 // function may call back your callback synchronously (ie before it returns) |
80 // if the image was found in the cache. | 80 // if the image was found in the cache. |
81 // Note this method loads a raw bitmap from the resource. All sizes given are | 81 // Note this method loads a raw bitmap from the resource. All sizes given are |
82 // assumed to be in pixels. | 82 // assumed to be in pixels. |
83 // TODO(estade): remove this in favor of LoadImageAtEveryScaleFactorAsync, | |
84 // and rename the later to LoadImageAsync. | |
Devlin
2016/12/15 17:14:41
s/later/latter
Evan Stade
2016/12/15 23:49:02
Done.
| |
83 void LoadImageAsync(const extensions::Extension* extension, | 85 void LoadImageAsync(const extensions::Extension* extension, |
84 const ExtensionResource& resource, | 86 const ExtensionResource& resource, |
85 const gfx::Size& max_size, | 87 const gfx::Size& max_size, |
86 const ImageLoaderImageCallback& callback); | 88 const ImageLoaderImageCallback& callback); |
87 | 89 |
90 // Loads and returns a gfx::Image that has representations at all supported | |
91 // scale factors. | |
92 void LoadImageAtEveryScaleFactorAsync( | |
93 const extensions::Extension* extension, | |
Devlin
2016/12/15 17:14:41
no need for extensions:: prefix.
Evan Stade
2016/12/15 23:49:02
Done.
| |
94 const gfx::Size& dip_size, | |
95 const ImageLoaderImageCallback& callback); | |
96 | |
88 // Same as LoadImageAsync() above except it loads multiple images from the | 97 // Same as LoadImageAsync() above except it loads multiple images from the |
89 // same extension. This is used to load multiple resolutions of the same image | 98 // same extension. This is used to load multiple resolutions of the same image |
90 // type. | 99 // type. |
91 void LoadImagesAsync(const extensions::Extension* extension, | 100 void LoadImagesAsync(const extensions::Extension* extension, |
92 const std::vector<ImageRepresentation>& info_list, | 101 const std::vector<ImageRepresentation>& info_list, |
93 const ImageLoaderImageCallback& callback); | 102 const ImageLoaderImageCallback& callback); |
94 | 103 |
95 // Same as LoadImagesAsync() above except it loads into an image family. This | 104 // Same as LoadImagesAsync() above except it loads into an image family. This |
96 // is used to load multiple images of different logical sizes as opposed to | 105 // is used to load multiple images of different logical sizes as opposed to |
97 // LoadImagesAsync() which loads different scale factors of the same logical | 106 // LoadImagesAsync() which loads different scale factors of the same logical |
(...skipping 13 matching lines...) Expand all Loading... | |
111 const std::vector<LoadResult>& load_result); | 120 const std::vector<LoadResult>& load_result); |
112 | 121 |
113 base::WeakPtrFactory<ImageLoader> weak_ptr_factory_; | 122 base::WeakPtrFactory<ImageLoader> weak_ptr_factory_; |
114 | 123 |
115 DISALLOW_COPY_AND_ASSIGN(ImageLoader); | 124 DISALLOW_COPY_AND_ASSIGN(ImageLoader); |
116 }; | 125 }; |
117 | 126 |
118 } // namespace extensions | 127 } // namespace extensions |
119 | 128 |
120 #endif // EXTENSIONS_BROWSER_IMAGE_LOADER_H_ | 129 #endif // EXTENSIONS_BROWSER_IMAGE_LOADER_H_ |
OLD | NEW |