| 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" |
| 11 #include "base/string_split.h" | 11 #include "base/string_split.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
| 16 #include "chrome/browser/extensions/extension_prefs.h" | 16 #include "chrome/browser/extensions/extension_prefs.h" |
| 17 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
| 18 #include "chrome/browser/extensions/extension_system.h" | 18 #include "chrome/browser/extensions/extension_system.h" |
| 19 #include "chrome/browser/extensions/image_loader.h" | 19 #include "chrome/browser/extensions/image_loader.h" |
| 20 #include "chrome/browser/favicon/favicon_service_factory.h" | 20 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/common/extensions/app_launch_manifest_handler.h" |
| 22 #include "chrome/common/extensions/extension.h" | 23 #include "chrome/common/extensions/extension.h" |
| 23 #include "chrome/common/extensions/extension_constants.h" | 24 #include "chrome/common/extensions/extension_constants.h" |
| 24 #include "chrome/common/extensions/extension_resource.h" | 25 #include "chrome/common/extensions/extension_resource.h" |
| 25 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
| 26 #include "googleurl/src/gurl.h" | 27 #include "googleurl/src/gurl.h" |
| 27 #include "grit/component_extension_resources_map.h" | 28 #include "grit/component_extension_resources_map.h" |
| 28 #include "grit/theme_resources.h" | 29 #include "grit/theme_resources.h" |
| 29 #include "skia/ext/image_operations.h" | 30 #include "skia/ext/image_operations.h" |
| 30 #include "ui/base/layout.h" | 31 #include "ui/base/layout.h" |
| 31 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 207 |
| 207 void ExtensionIconSource::LoadFaviconImage(int request_id) { | 208 void ExtensionIconSource::LoadFaviconImage(int request_id) { |
| 208 FaviconService* favicon_service = | 209 FaviconService* favicon_service = |
| 209 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 210 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); |
| 210 // Fall back to the default icons if the service isn't available. | 211 // Fall back to the default icons if the service isn't available. |
| 211 if (favicon_service == NULL) { | 212 if (favicon_service == NULL) { |
| 212 LoadDefaultImage(request_id); | 213 LoadDefaultImage(request_id); |
| 213 return; | 214 return; |
| 214 } | 215 } |
| 215 | 216 |
| 216 GURL favicon_url = GetData(request_id)->extension->GetFullLaunchURL(); | 217 GURL favicon_url = extensions::AppLaunchInfo::GetFullLaunchURL( |
| 218 GetData(request_id)->extension); |
| 217 favicon_service->GetRawFaviconForURL( | 219 favicon_service->GetRawFaviconForURL( |
| 218 FaviconService::FaviconForURLParams( | 220 FaviconService::FaviconForURLParams( |
| 219 profile_, favicon_url, history::FAVICON, gfx::kFaviconSize), | 221 profile_, favicon_url, history::FAVICON, gfx::kFaviconSize), |
| 220 ui::SCALE_FACTOR_100P, | 222 ui::SCALE_FACTOR_100P, |
| 221 base::Bind(&ExtensionIconSource::OnFaviconDataAvailable, | 223 base::Bind(&ExtensionIconSource::OnFaviconDataAvailable, |
| 222 base::Unretained(this), request_id), | 224 base::Unretained(this), request_id), |
| 223 &cancelable_task_tracker_); | 225 &cancelable_task_tracker_); |
| 224 } | 226 } |
| 225 | 227 |
| 226 void ExtensionIconSource::OnFaviconDataAvailable( | 228 void ExtensionIconSource::OnFaviconDataAvailable( |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 335 |
| 334 void ExtensionIconSource::ClearData(int request_id) { | 336 void ExtensionIconSource::ClearData(int request_id) { |
| 335 std::map<int, ExtensionIconRequest*>::iterator i = | 337 std::map<int, ExtensionIconRequest*>::iterator i = |
| 336 request_map_.find(request_id); | 338 request_map_.find(request_id); |
| 337 if (i == request_map_.end()) | 339 if (i == request_map_.end()) |
| 338 return; | 340 return; |
| 339 | 341 |
| 340 delete i->second; | 342 delete i->second; |
| 341 request_map_.erase(i); | 343 request_map_.erase(i); |
| 342 } | 344 } |
| OLD | NEW |