| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/common/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1237 | 1237 |
| 1238 // static | 1238 // static |
| 1239 void Extension::DecodeIconFromPath(const FilePath& icon_path, | 1239 void Extension::DecodeIconFromPath(const FilePath& icon_path, |
| 1240 Icons icon_size, | 1240 Icons icon_size, |
| 1241 scoped_ptr<SkBitmap>* result) { | 1241 scoped_ptr<SkBitmap>* result) { |
| 1242 if (icon_path.empty()) | 1242 if (icon_path.empty()) |
| 1243 return; | 1243 return; |
| 1244 | 1244 |
| 1245 std::string file_contents; | 1245 std::string file_contents; |
| 1246 if (!file_util::ReadFileToString(icon_path, &file_contents)) { | 1246 if (!file_util::ReadFileToString(icon_path, &file_contents)) { |
| 1247 LOG(ERROR) << "Could not read icon file: " | 1247 LOG(ERROR) << "Could not read icon file: " << icon_path.LossyDisplayName(); |
| 1248 << WideToUTF8(icon_path.ToWStringHack()); | |
| 1249 return; | 1248 return; |
| 1250 } | 1249 } |
| 1251 | 1250 |
| 1252 // Decode the image using WebKit's image decoder. | 1251 // Decode the image using WebKit's image decoder. |
| 1253 const unsigned char* data = | 1252 const unsigned char* data = |
| 1254 reinterpret_cast<const unsigned char*>(file_contents.data()); | 1253 reinterpret_cast<const unsigned char*>(file_contents.data()); |
| 1255 webkit_glue::ImageDecoder decoder; | 1254 webkit_glue::ImageDecoder decoder; |
| 1256 scoped_ptr<SkBitmap> decoded(new SkBitmap()); | 1255 scoped_ptr<SkBitmap> decoded(new SkBitmap()); |
| 1257 *decoded = decoder.Decode(data, file_contents.length()); | 1256 *decoded = decoder.Decode(data, file_contents.length()); |
| 1258 if (decoded->empty()) { | 1257 if (decoded->empty()) { |
| 1259 LOG(ERROR) << "Could not decode icon file: " | 1258 LOG(ERROR) << "Could not decode icon file: " |
| 1260 << WideToUTF8(icon_path.ToWStringHack()); | 1259 << icon_path.LossyDisplayName(); |
| 1261 return; | 1260 return; |
| 1262 } | 1261 } |
| 1263 | 1262 |
| 1264 if (decoded->width() != icon_size || decoded->height() != icon_size) { | 1263 if (decoded->width() != icon_size || decoded->height() != icon_size) { |
| 1265 LOG(ERROR) << "Icon file has unexpected size: " | 1264 LOG(ERROR) << "Icon file has unexpected size: " |
| 1266 << base::IntToString(decoded->width()) << "x" | 1265 << base::IntToString(decoded->width()) << "x" |
| 1267 << base::IntToString(decoded->height()); | 1266 << base::IntToString(decoded->height()); |
| 1268 return; | 1267 return; |
| 1269 } | 1268 } |
| 1270 | 1269 |
| (...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2383 | 2382 |
| 2384 UninstalledExtensionInfo::~UninstalledExtensionInfo() {} | 2383 UninstalledExtensionInfo::~UninstalledExtensionInfo() {} |
| 2385 | 2384 |
| 2386 | 2385 |
| 2387 UnloadedExtensionInfo::UnloadedExtensionInfo( | 2386 UnloadedExtensionInfo::UnloadedExtensionInfo( |
| 2388 const Extension* extension, | 2387 const Extension* extension, |
| 2389 Reason reason) | 2388 Reason reason) |
| 2390 : reason(reason), | 2389 : reason(reason), |
| 2391 already_disabled(false), | 2390 already_disabled(false), |
| 2392 extension(extension) {} | 2391 extension(extension) {} |
| OLD | NEW |