| 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/ui/webui/extensions/extension_icon_source.h" | 5 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 int request_id) { | 203 int request_id) { |
| 204 ExtensionIconRequest* request = GetData(request_id); | 204 ExtensionIconRequest* request = GetData(request_id); |
| 205 ImageLoader::Get(profile_)->LoadImageAsync( | 205 ImageLoader::Get(profile_)->LoadImageAsync( |
| 206 request->extension.get(), | 206 request->extension.get(), |
| 207 icon, | 207 icon, |
| 208 gfx::Size(request->size, request->size), | 208 gfx::Size(request->size, request->size), |
| 209 base::Bind(&ExtensionIconSource::OnImageLoaded, AsWeakPtr(), request_id)); | 209 base::Bind(&ExtensionIconSource::OnImageLoaded, AsWeakPtr(), request_id)); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void ExtensionIconSource::LoadFaviconImage(int request_id) { | 212 void ExtensionIconSource::LoadFaviconImage(int request_id) { |
| 213 FaviconService* favicon_service = | 213 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( |
| 214 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 214 profile_, ServiceAccessType::EXPLICIT_ACCESS); |
| 215 // Fall back to the default icons if the service isn't available. | 215 // Fall back to the default icons if the service isn't available. |
| 216 if (favicon_service == NULL) { | 216 if (favicon_service == NULL) { |
| 217 LoadDefaultImage(request_id); | 217 LoadDefaultImage(request_id); |
| 218 return; | 218 return; |
| 219 } | 219 } |
| 220 | 220 |
| 221 GURL favicon_url = | 221 GURL favicon_url = |
| 222 AppLaunchInfo::GetFullLaunchURL(GetData(request_id)->extension.get()); | 222 AppLaunchInfo::GetFullLaunchURL(GetData(request_id)->extension.get()); |
| 223 favicon_service->GetRawFaviconForPageURL( | 223 favicon_service->GetRawFaviconForPageURL( |
| 224 favicon_url, | 224 favicon_url, |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 std::map<int, ExtensionIconRequest*>::iterator i = | 341 std::map<int, ExtensionIconRequest*>::iterator i = |
| 342 request_map_.find(request_id); | 342 request_map_.find(request_id); |
| 343 if (i == request_map_.end()) | 343 if (i == request_map_.end()) |
| 344 return; | 344 return; |
| 345 | 345 |
| 346 delete i->second; | 346 delete i->second; |
| 347 request_map_.erase(i); | 347 request_map_.erase(i); |
| 348 } | 348 } |
| 349 | 349 |
| 350 } // namespace extensions | 350 } // namespace extensions |
| OLD | NEW |