| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 213 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); |
| 214 // Fall back to the default icons if the service isn't available. | 214 // Fall back to the default icons if the service isn't available. |
| 215 if (favicon_service == NULL) { | 215 if (favicon_service == NULL) { |
| 216 LoadDefaultImage(request_id); | 216 LoadDefaultImage(request_id); |
| 217 return; | 217 return; |
| 218 } | 218 } |
| 219 | 219 |
| 220 GURL favicon_url = | 220 GURL favicon_url = |
| 221 AppLaunchInfo::GetFullLaunchURL(GetData(request_id)->extension); | 221 AppLaunchInfo::GetFullLaunchURL(GetData(request_id)->extension); |
| 222 favicon_service->GetRawFaviconForPageURL( | 222 favicon_service->GetRawFaviconForPageURL( |
| 223 FaviconService::FaviconForPageURLParams( | 223 favicon_url, |
| 224 favicon_url, favicon_base::FAVICON, gfx::kFaviconSize), | 224 favicon_base::FAVICON, |
| 225 1.0f, | 225 gfx::kFaviconSize, |
| 226 base::Bind(&ExtensionIconSource::OnFaviconDataAvailable, | 226 base::Bind(&ExtensionIconSource::OnFaviconDataAvailable, |
| 227 base::Unretained(this), | 227 base::Unretained(this), |
| 228 request_id), | 228 request_id), |
| 229 &cancelable_task_tracker_); | 229 &cancelable_task_tracker_); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void ExtensionIconSource::OnFaviconDataAvailable( | 232 void ExtensionIconSource::OnFaviconDataAvailable( |
| 233 int request_id, | 233 int request_id, |
| 234 const favicon_base::FaviconRawBitmapResult& bitmap_result) { | 234 const favicon_base::FaviconRawBitmapResult& bitmap_result) { |
| 235 ExtensionIconRequest* request = GetData(request_id); | 235 ExtensionIconRequest* request = GetData(request_id); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 std::map<int, ExtensionIconRequest*>::iterator i = | 340 std::map<int, ExtensionIconRequest*>::iterator i = |
| 341 request_map_.find(request_id); | 341 request_map_.find(request_id); |
| 342 if (i == request_map_.end()) | 342 if (i == request_map_.end()) |
| 343 return; | 343 return; |
| 344 | 344 |
| 345 delete i->second; | 345 delete i->second; |
| 346 request_map_.erase(i); | 346 request_map_.erase(i); |
| 347 } | 347 } |
| 348 | 348 |
| 349 } // namespace extensions | 349 } // namespace extensions |
| OLD | NEW |