| 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 #include "extensions/browser/extension_icon_image.h" | 5 #include "extensions/browser/extension_icon_image.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "content/public/browser/notification_service.h" | 10 #include "content/public/browser/notification_service.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 resource = GetExtensionIconResource(extension_, icon_set_, | 189 resource = GetExtensionIconResource(extension_, icon_set_, |
| 190 resource_size_in_pixel, ExtensionIconSet::MATCH_SMALLER); | 190 resource_size_in_pixel, ExtensionIconSet::MATCH_SMALLER); |
| 191 } | 191 } |
| 192 | 192 |
| 193 // If there is no resource found, return default icon. | 193 // If there is no resource found, return default icon. |
| 194 if (resource.empty()) | 194 if (resource.empty()) |
| 195 return default_icon_.GetRepresentation(scale); | 195 return default_icon_.GetRepresentation(scale); |
| 196 | 196 |
| 197 std::vector<ImageLoader::ImageRepresentation> info_list; | 197 std::vector<ImageLoader::ImageRepresentation> info_list; |
| 198 info_list.push_back(ImageLoader::ImageRepresentation( | 198 info_list.push_back(ImageLoader::ImageRepresentation( |
| 199 resource, | 199 resource, ImageLoader::ImageRepresentation::ALWAYS_RESIZE, |
| 200 ImageLoader::ImageRepresentation::ALWAYS_RESIZE, | 200 gfx::ScaleToFlooredSize( |
| 201 gfx::ToFlooredSize(gfx::ScaleSize( | 201 gfx::Size(resource_size_in_dip_, resource_size_in_dip_), scale), |
| 202 gfx::Size(resource_size_in_dip_, resource_size_in_dip_), scale)), | |
| 203 scale_factor)); | 202 scale_factor)); |
| 204 | 203 |
| 205 extensions::ImageLoader* loader = | 204 extensions::ImageLoader* loader = |
| 206 extensions::ImageLoader::Get(browser_context_); | 205 extensions::ImageLoader::Get(browser_context_); |
| 207 loader->LoadImagesAsync(extension_, info_list, | 206 loader->LoadImagesAsync(extension_, info_list, |
| 208 base::Bind(&IconImage::OnImageLoaded, | 207 base::Bind(&IconImage::OnImageLoaded, |
| 209 weak_ptr_factory_.GetWeakPtr(), | 208 weak_ptr_factory_.GetWeakPtr(), |
| 210 scale)); | 209 scale)); |
| 211 | 210 |
| 212 return gfx::ImageSkiaRep(); | 211 return gfx::ImageSkiaRep(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 const content::NotificationDetails& details) { | 255 const content::NotificationDetails& details) { |
| 257 DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_REMOVED); | 256 DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_REMOVED); |
| 258 | 257 |
| 259 const Extension* extension = content::Details<const Extension>(details).ptr(); | 258 const Extension* extension = content::Details<const Extension>(details).ptr(); |
| 260 | 259 |
| 261 if (extension_ == extension) | 260 if (extension_ == extension) |
| 262 extension_ = NULL; | 261 extension_ = NULL; |
| 263 } | 262 } |
| 264 | 263 |
| 265 } // namespace extensions | 264 } // namespace extensions |
| OLD | NEW |