| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // type. | 115 // type. |
| 116 void LoadImages(const extensions::Extension* extension, | 116 void LoadImages(const extensions::Extension* extension, |
| 117 const std::vector<ImageRepresentation>& info_list, | 117 const std::vector<ImageRepresentation>& info_list, |
| 118 CacheParam cache); | 118 CacheParam cache); |
| 119 | 119 |
| 120 // Returns the ID used for the next image that is loaded. That is, the return | 120 // Returns the ID used for the next image that is loaded. That is, the return |
| 121 // value from this method corresponds to the int that is passed to | 121 // value from this method corresponds to the int that is passed to |
| 122 // OnImageLoaded() the next time LoadImage() is invoked. | 122 // OnImageLoaded() the next time LoadImage() is invoked. |
| 123 int next_id() const { return next_id_; } | 123 int next_id() const { return next_id_; } |
| 124 | 124 |
| 125 // Checks whether image is a component extension resource. Returns false | |
| 126 // if a given |resource| does not have a corresponding image in bundled | |
| 127 // resources. Otherwise fills |resource_id|. | |
| 128 static bool IsComponentExtensionResource( | |
| 129 const extensions::Extension* extension, | |
| 130 const FilePath& resource_path, | |
| 131 int* resource_id); | |
| 132 | |
| 133 private: | 125 private: |
| 134 // Information for pending resource load operation for one or more image | 126 // Information for pending resource load operation for one or more image |
| 135 // representations. | 127 // representations. |
| 136 struct PendingLoadInfo { | 128 struct PendingLoadInfo { |
| 137 PendingLoadInfo(); | 129 PendingLoadInfo(); |
| 138 ~PendingLoadInfo(); | 130 ~PendingLoadInfo(); |
| 139 | 131 |
| 140 const extensions::Extension* extension; | 132 const extensions::Extension* extension; |
| 141 // This is cached separate from |extension| in case the extension is | 133 // This is cached separate from |extension| in case the extension is |
| 142 // unloaded. | 134 // unloaded. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // Information for each LoadImage request is cached here. The integer | 169 // Information for each LoadImage request is cached here. The integer |
| 178 // identifies the id assigned to the request. | 170 // identifies the id assigned to the request. |
| 179 LoadMap load_map_; | 171 LoadMap load_map_; |
| 180 | 172 |
| 181 content::NotificationRegistrar registrar_; | 173 content::NotificationRegistrar registrar_; |
| 182 | 174 |
| 183 DISALLOW_COPY_AND_ASSIGN(ImageLoadingTracker); | 175 DISALLOW_COPY_AND_ASSIGN(ImageLoadingTracker); |
| 184 }; | 176 }; |
| 185 | 177 |
| 186 #endif // CHROME_BROWSER_EXTENSIONS_IMAGE_LOADING_TRACKER_H_ | 178 #endif // CHROME_BROWSER_EXTENSIONS_IMAGE_LOADING_TRACKER_H_ |
| OLD | NEW |