OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_IMAGE_LOADING_TRACKER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_IMAGE_LOADING_TRACKER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_IMAGE_LOADING_TRACKER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_IMAGE_LOADING_TRACKER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 ResizeCondition resize_method; | 89 ResizeCondition resize_method; |
90 | 90 |
91 // When |resize_method| is ALWAYS_RESIZE or when the loaded image is larger | 91 // When |resize_method| is ALWAYS_RESIZE or when the loaded image is larger |
92 // than |desired_size| it will be resized to these dimensions. | 92 // than |desired_size| it will be resized to these dimensions. |
93 gfx::Size desired_size; | 93 gfx::Size desired_size; |
94 | 94 |
95 // |scale_factor| is used to construct the loaded gfx::ImageSkia. | 95 // |scale_factor| is used to construct the loaded gfx::ImageSkia. |
96 ui::ScaleFactor scale_factor; | 96 ui::ScaleFactor scale_factor; |
97 }; | 97 }; |
98 | 98 |
99 // Returns true if given extension id is a special component extension that | |
100 // has its resource bundled. | |
101 // TODO(xiyuan): Move this out of this class. | |
102 static bool IsSpecialBundledExtensionId(const std::string& extension_id); | |
103 | |
104 explicit ImageLoadingTracker(Observer* observer); | 99 explicit ImageLoadingTracker(Observer* observer); |
105 virtual ~ImageLoadingTracker(); | 100 virtual ~ImageLoadingTracker(); |
106 | 101 |
107 // Specify image resource to load. If the loaded image is larger than | 102 // Specify image resource to load. If the loaded image is larger than |
108 // |max_size| it will be resized to those dimensions. IMPORTANT NOTE: this | 103 // |max_size| it will be resized to those dimensions. IMPORTANT NOTE: this |
109 // function may call back your observer synchronously (ie before it returns) | 104 // function may call back your observer synchronously (ie before it returns) |
110 // if the image was found in the cache. | 105 // if the image was found in the cache. |
111 // Note this method loads a raw bitmap from the resource. All sizes given are | 106 // Note this method loads a raw bitmap from the resource. All sizes given are |
112 // assumed to be in pixels. | 107 // assumed to be in pixels. |
113 void LoadImage(const extensions::Extension* extension, | 108 void LoadImage(const extensions::Extension* extension, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 179 |
185 content::NotificationRegistrar registrar_; | 180 content::NotificationRegistrar registrar_; |
186 | 181 |
187 FRIEND_TEST_ALL_PREFIXES(ImageLoadingTrackerTest, | 182 FRIEND_TEST_ALL_PREFIXES(ImageLoadingTrackerTest, |
188 IsComponentExtensionResource); | 183 IsComponentExtensionResource); |
189 | 184 |
190 DISALLOW_COPY_AND_ASSIGN(ImageLoadingTracker); | 185 DISALLOW_COPY_AND_ASSIGN(ImageLoadingTracker); |
191 }; | 186 }; |
192 | 187 |
193 #endif // CHROME_BROWSER_EXTENSIONS_IMAGE_LOADING_TRACKER_H_ | 188 #endif // CHROME_BROWSER_EXTENSIONS_IMAGE_LOADING_TRACKER_H_ |
OLD | NEW |