| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extension_icon_source.h" | 5 #include "chrome/browser/ui/webui/extension_icon_source.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 if (!base::StringToInt(match_param, &match_num)) | 271 if (!base::StringToInt(match_param, &match_num)) |
| 272 return false; | 272 return false; |
| 273 match_type = static_cast<ExtensionIconSet::MatchType>(match_num); | 273 match_type = static_cast<ExtensionIconSet::MatchType>(match_num); |
| 274 if (!(match_type == ExtensionIconSet::MATCH_EXACTLY || | 274 if (!(match_type == ExtensionIconSet::MATCH_EXACTLY || |
| 275 match_type == ExtensionIconSet::MATCH_SMALLER || | 275 match_type == ExtensionIconSet::MATCH_SMALLER || |
| 276 match_type == ExtensionIconSet::MATCH_BIGGER)) | 276 match_type == ExtensionIconSet::MATCH_BIGGER)) |
| 277 match_type = ExtensionIconSet::MATCH_EXACTLY; | 277 match_type = ExtensionIconSet::MATCH_EXACTLY; |
| 278 | 278 |
| 279 std::string extension_id = path_parts.at(0); | 279 std::string extension_id = path_parts.at(0); |
| 280 const Extension* extension = | 280 const Extension* extension = |
| 281 profile_->GetExtensionService()->GetInstalledExtension(extension_id); | 281 profile_->GetExtensionService()->GetExtensionById(extension_id, true); |
| 282 if (!extension) | 282 if (!extension) |
| 283 return false; | 283 return false; |
| 284 | 284 |
| 285 bool grayscale = path_lower.find("grayscale=true") != std::string::npos; | 285 bool grayscale = path_lower.find("grayscale=true") != std::string::npos; |
| 286 | 286 |
| 287 SetData(request_id, extension, grayscale, size, match_type); | 287 SetData(request_id, extension, grayscale, size, match_type); |
| 288 | 288 |
| 289 return true; | 289 return true; |
| 290 } | 290 } |
| 291 | 291 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 317 | 317 |
| 318 void ExtensionIconSource::ClearData(int request_id) { | 318 void ExtensionIconSource::ClearData(int request_id) { |
| 319 std::map<int, ExtensionIconRequest*>::iterator i = | 319 std::map<int, ExtensionIconRequest*>::iterator i = |
| 320 request_map_.find(request_id); | 320 request_map_.find(request_id); |
| 321 if (i == request_map_.end()) | 321 if (i == request_map_.end()) |
| 322 return; | 322 return; |
| 323 | 323 |
| 324 delete i->second; | 324 delete i->second; |
| 325 request_map_.erase(i); | 325 request_map_.erase(i); |
| 326 } | 326 } |
| OLD | NEW |