| 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 |
| 99 explicit ImageLoadingTracker(Observer* observer); | 104 explicit ImageLoadingTracker(Observer* observer); |
| 100 virtual ~ImageLoadingTracker(); | 105 virtual ~ImageLoadingTracker(); |
| 101 | 106 |
| 102 // Specify image resource to load. If the loaded image is larger than | 107 // Specify image resource to load. If the loaded image is larger than |
| 103 // |max_size| it will be resized to those dimensions. IMPORTANT NOTE: this | 108 // |max_size| it will be resized to those dimensions. IMPORTANT NOTE: this |
| 104 // function may call back your observer synchronously (ie before it returns) | 109 // function may call back your observer synchronously (ie before it returns) |
| 105 // if the image was found in the cache. | 110 // if the image was found in the cache. |
| 106 // Note this method loads a raw bitmap from the resource. All sizes given are | 111 // Note this method loads a raw bitmap from the resource. All sizes given are |
| 107 // assumed to be in pixels. | 112 // assumed to be in pixels. |
| 108 void LoadImage(const extensions::Extension* extension, | 113 void LoadImage(const extensions::Extension* extension, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 184 |
| 180 content::NotificationRegistrar registrar_; | 185 content::NotificationRegistrar registrar_; |
| 181 | 186 |
| 182 FRIEND_TEST_ALL_PREFIXES(ImageLoadingTrackerTest, | 187 FRIEND_TEST_ALL_PREFIXES(ImageLoadingTrackerTest, |
| 183 IsComponentExtensionResource); | 188 IsComponentExtensionResource); |
| 184 | 189 |
| 185 DISALLOW_COPY_AND_ASSIGN(ImageLoadingTracker); | 190 DISALLOW_COPY_AND_ASSIGN(ImageLoadingTracker); |
| 186 }; | 191 }; |
| 187 | 192 |
| 188 #endif // CHROME_BROWSER_EXTENSIONS_IMAGE_LOADING_TRACKER_H_ | 193 #endif // CHROME_BROWSER_EXTENSIONS_IMAGE_LOADING_TRACKER_H_ |
| OLD | NEW |