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 #include "chrome/browser/extensions/extension_icon_image.h" | 5 #include "chrome/browser/extensions/extension_icon_image.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "chrome/common/chrome_notification_types.h" | 9 #include "chrome/common/chrome_notification_types.h" |
10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 return default_icon_.GetRepresentation(scale_factor); | 186 return default_icon_.GetRepresentation(scale_factor); |
187 } | 187 } |
188 | 188 |
189 int id = tracker_.next_id(); | 189 int id = tracker_.next_id(); |
190 load_map_[id].scale_factor = scale_factor; | 190 load_map_[id].scale_factor = scale_factor; |
191 load_map_[id].is_async = false; | 191 load_map_[id].is_async = false; |
192 | 192 |
193 std::vector<ImageLoadingTracker::ImageRepresentation> info_list; | 193 std::vector<ImageLoadingTracker::ImageRepresentation> info_list; |
194 info_list.push_back(ImageLoadingTracker::ImageRepresentation( | 194 info_list.push_back(ImageLoadingTracker::ImageRepresentation( |
195 resource, | 195 resource, |
196 ImageLoadingTracker::ImageRepresentation::RESIZE_WHEN_LARGER, | 196 ImageLoadingTracker::ImageRepresentation::ALWAYS_RESIZE, |
197 gfx::Size(resource_size_in_dip_, resource_size_in_dip_).Scale(scale), | 197 gfx::Size(resource_size_in_dip_, resource_size_in_dip_).Scale(scale), |
198 scale_factor)); | 198 scale_factor)); |
199 tracker_.LoadImages(extension_, info_list, ImageLoadingTracker::DONT_CACHE); | 199 tracker_.LoadImages(extension_, info_list, ImageLoadingTracker::DONT_CACHE); |
200 | 200 |
201 // If we have not received |OnImageLoaded|, image load request is | 201 // If we have not received |OnImageLoaded|, image load request is |
202 // asynchronous. | 202 // asynchronous. |
203 if (load_map_.find(id) != load_map_.end()) | 203 if (load_map_.find(id) != load_map_.end()) |
204 load_map_[id].is_async = true; | 204 load_map_[id].is_async = true; |
205 | 205 |
206 // If LoadImages returned synchronously and the requested image rep is cached | 206 // If LoadImages returned synchronously and the requested image rep is cached |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 DCHECK_EQ(type, chrome::NOTIFICATION_EXTENSION_UNLOADED); | 250 DCHECK_EQ(type, chrome::NOTIFICATION_EXTENSION_UNLOADED); |
251 | 251 |
252 const Extension* extension = | 252 const Extension* extension = |
253 content::Details<extensions::UnloadedExtensionInfo>(details)->extension; | 253 content::Details<extensions::UnloadedExtensionInfo>(details)->extension; |
254 | 254 |
255 if (extension_ == extension) | 255 if (extension_ == extension) |
256 extension_ = NULL; | 256 extension_ = NULL; |
257 } | 257 } |
258 | 258 |
259 } // namespace extensions | 259 } // namespace extensions |
OLD | NEW |