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/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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 bool ExtensionIconSource::TryLoadingComponentExtensionImage( | 204 bool ExtensionIconSource::TryLoadingComponentExtensionImage( |
205 const ExtensionResource& icon, int request_id) { | 205 const ExtensionResource& icon, int request_id) { |
206 ExtensionIconRequest* request = GetData(request_id); | 206 ExtensionIconRequest* request = GetData(request_id); |
207 FilePath directory_path = request->extension->path(); | 207 FilePath directory_path = request->extension->path(); |
208 FilePath relative_path = directory_path.BaseName().Append( | 208 FilePath relative_path = directory_path.BaseName().Append( |
209 icon.relative_path()); | 209 icon.relative_path()); |
210 for (size_t i = 0; i < kComponentExtensionResourcesSize; ++i) { | 210 for (size_t i = 0; i < kComponentExtensionResourcesSize; ++i) { |
211 FilePath bm_resource_path = | 211 FilePath bm_resource_path = |
212 FilePath().AppendASCII(kComponentExtensionResources[i].name); | 212 FilePath().AppendASCII(kComponentExtensionResources[i].name); |
213 #if defined(OS_WIN) | 213 bm_resource_path = bm_resource_path.NormalizePathSeparators(); |
214 bm_resource_path = bm_resource_path.NormalizeWindowsPathSeparators(); | |
215 #endif | |
216 if (relative_path == bm_resource_path) { | 214 if (relative_path == bm_resource_path) { |
217 scoped_ptr<SkBitmap> decoded(LoadImageByResourceId( | 215 scoped_ptr<SkBitmap> decoded(LoadImageByResourceId( |
218 kComponentExtensionResources[i].value)); | 216 kComponentExtensionResources[i].value)); |
219 FinalizeImage(decoded.get(), request_id); | 217 FinalizeImage(decoded.get(), request_id); |
220 return true; | 218 return true; |
221 } | 219 } |
222 } | 220 } |
223 return false; | 221 return false; |
224 } | 222 } |
225 | 223 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 | 362 |
365 void ExtensionIconSource::ClearData(int request_id) { | 363 void ExtensionIconSource::ClearData(int request_id) { |
366 std::map<int, ExtensionIconRequest*>::iterator i = | 364 std::map<int, ExtensionIconRequest*>::iterator i = |
367 request_map_.find(request_id); | 365 request_map_.find(request_id); |
368 if (i == request_map_.end()) | 366 if (i == request_map_.end()) |
369 return; | 367 return; |
370 | 368 |
371 delete i->second; | 369 delete i->second; |
372 request_map_.erase(i); | 370 request_map_.erase(i); |
373 } | 371 } |
OLD | NEW |