| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 FaviconService* favicon_service = | 208 FaviconService* favicon_service = |
| 209 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 209 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); |
| 210 // Fall back to the default icons if the service isn't available. | 210 // Fall back to the default icons if the service isn't available. |
| 211 if (favicon_service == NULL) { | 211 if (favicon_service == NULL) { |
| 212 LoadDefaultImage(request_id); | 212 LoadDefaultImage(request_id); |
| 213 return; | 213 return; |
| 214 } | 214 } |
| 215 | 215 |
| 216 GURL favicon_url = GetData(request_id)->extension->GetFullLaunchURL(); | 216 GURL favicon_url = GetData(request_id)->extension->GetFullLaunchURL(); |
| 217 FaviconService::Handle handle = favicon_service->GetRawFaviconForURL( | 217 FaviconService::Handle handle = favicon_service->GetRawFaviconForURL( |
| 218 profile_, | 218 FaviconService::FaviconForURLParams( |
| 219 favicon_url, | 219 profile_, |
| 220 history::FAVICON, | 220 favicon_url, |
| 221 gfx::kFaviconSize, | 221 history::FAVICON, |
| 222 gfx::kFaviconSize, |
| 223 &cancelable_consumer_), |
| 222 ui::SCALE_FACTOR_100P, | 224 ui::SCALE_FACTOR_100P, |
| 223 &cancelable_consumer_, | |
| 224 base::Bind(&ExtensionIconSource::OnFaviconDataAvailable, | 225 base::Bind(&ExtensionIconSource::OnFaviconDataAvailable, |
| 225 base::Unretained(this))); | 226 base::Unretained(this))); |
| 226 cancelable_consumer_.SetClientData(favicon_service, handle, request_id); | 227 cancelable_consumer_.SetClientData(favicon_service, handle, request_id); |
| 227 } | 228 } |
| 228 | 229 |
| 229 void ExtensionIconSource::OnFaviconDataAvailable( | 230 void ExtensionIconSource::OnFaviconDataAvailable( |
| 230 FaviconService::Handle request_handle, | 231 FaviconService::Handle request_handle, |
| 231 const history::FaviconBitmapResult& bitmap_result) { | 232 const history::FaviconBitmapResult& bitmap_result) { |
| 232 int request_id = cancelable_consumer_.GetClientData( | 233 int request_id = cancelable_consumer_.GetClientData( |
| 233 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS), | 234 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS), |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 | 346 |
| 346 void ExtensionIconSource::ClearData(int request_id) { | 347 void ExtensionIconSource::ClearData(int request_id) { |
| 347 std::map<int, ExtensionIconRequest*>::iterator i = | 348 std::map<int, ExtensionIconRequest*>::iterator i = |
| 348 request_map_.find(request_id); | 349 request_map_.find(request_id); |
| 349 if (i == request_map_.end()) | 350 if (i == request_map_.end()) |
| 350 return; | 351 return; |
| 351 | 352 |
| 352 delete i->second; | 353 delete i->second; |
| 353 request_map_.erase(i); | 354 request_map_.erase(i); |
| 354 } | 355 } |
| OLD | NEW |