| 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_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
| 12 #include "base/string_split.h" | 12 #include "base/string_split.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/stringprintf.h" | 14 #include "base/stringprintf.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/image_loader.h" | 19 #include "chrome/browser/extensions/image_loader.h" |
| 19 #include "chrome/browser/favicon/favicon_service_factory.h" | 20 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/common/extensions/extension.h" | 22 #include "chrome/common/extensions/extension.h" |
| 22 #include "chrome/common/extensions/extension_constants.h" | 23 #include "chrome/common/extensions/extension_constants.h" |
| 23 #include "chrome/common/extensions/extension_resource.h" | 24 #include "chrome/common/extensions/extension_resource.h" |
| 24 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
| 25 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
| 26 #include "grit/component_extension_resources_map.h" | 27 #include "grit/component_extension_resources_map.h" |
| 27 #include "grit/theme_resources.h" | 28 #include "grit/theme_resources.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 if (!base::StringToInt(match_param, &match_num)) | 286 if (!base::StringToInt(match_param, &match_num)) |
| 286 return false; | 287 return false; |
| 287 match_type = static_cast<ExtensionIconSet::MatchType>(match_num); | 288 match_type = static_cast<ExtensionIconSet::MatchType>(match_num); |
| 288 if (!(match_type == ExtensionIconSet::MATCH_EXACTLY || | 289 if (!(match_type == ExtensionIconSet::MATCH_EXACTLY || |
| 289 match_type == ExtensionIconSet::MATCH_SMALLER || | 290 match_type == ExtensionIconSet::MATCH_SMALLER || |
| 290 match_type == ExtensionIconSet::MATCH_BIGGER)) | 291 match_type == ExtensionIconSet::MATCH_BIGGER)) |
| 291 match_type = ExtensionIconSet::MATCH_EXACTLY; | 292 match_type = ExtensionIconSet::MATCH_EXACTLY; |
| 292 | 293 |
| 293 std::string extension_id = path_parts.at(0); | 294 std::string extension_id = path_parts.at(0); |
| 294 const extensions::Extension* extension = | 295 const extensions::Extension* extension = |
| 295 profile_->GetExtensionService()->GetInstalledExtension(extension_id); | 296 extensions::ExtensionSystem::Get(profile_)->extension_service()-> |
| 297 GetInstalledExtension(extension_id); |
| 296 if (!extension) | 298 if (!extension) |
| 297 return false; | 299 return false; |
| 298 | 300 |
| 299 bool grayscale = path_lower.find("grayscale=true") != std::string::npos; | 301 bool grayscale = path_lower.find("grayscale=true") != std::string::npos; |
| 300 | 302 |
| 301 SetData(request_id, extension, grayscale, size, match_type); | 303 SetData(request_id, extension, grayscale, size, match_type); |
| 302 | 304 |
| 303 return true; | 305 return true; |
| 304 } | 306 } |
| 305 | 307 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 331 | 333 |
| 332 void ExtensionIconSource::ClearData(int request_id) { | 334 void ExtensionIconSource::ClearData(int request_id) { |
| 333 std::map<int, ExtensionIconRequest*>::iterator i = | 335 std::map<int, ExtensionIconRequest*>::iterator i = |
| 334 request_map_.find(request_id); | 336 request_map_.find(request_id); |
| 335 if (i == request_map_.end()) | 337 if (i == request_map_.end()) |
| 336 return; | 338 return; |
| 337 | 339 |
| 338 delete i->second; | 340 delete i->second; |
| 339 request_map_.erase(i); | 341 request_map_.erase(i); |
| 340 } | 342 } |
| OLD | NEW |