OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/extensions/sandboxed_extension_unpacker.h" | 5 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "app/gfx/codec/png_codec.h" | 9 #include "app/gfx/codec/png_codec.h" |
10 #include "base/crypto/signature_verifier.h" | 10 #include "base/crypto/signature_verifier.h" |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 return false; | 329 return false; |
330 } | 330 } |
331 } | 331 } |
332 | 332 |
333 return true; | 333 return true; |
334 } | 334 } |
335 | 335 |
336 bool SandboxedExtensionUnpacker::RewriteCatalogFiles( | 336 bool SandboxedExtensionUnpacker::RewriteCatalogFiles( |
337 const DictionaryValue& catalogs) { | 337 const DictionaryValue& catalogs) { |
338 // Write our parsed catalogs back to disk. | 338 // Write our parsed catalogs back to disk. |
339 DictionaryValue::key_iterator key_it = catalogs.begin_keys(); | 339 for (DictionaryValue::key_iterator key_it = catalogs.begin_keys(); |
340 for (; key_it != catalogs.end_keys(); ++key_it) { | 340 key_it != catalogs.end_keys(); ++key_it) { |
341 DictionaryValue* catalog; | 341 DictionaryValue* catalog; |
342 if (!catalogs.GetDictionary(*key_it, &catalog)) { | 342 if (!catalogs.GetDictionaryWithoutPathExpansion(*key_it, &catalog)) { |
343 ReportFailure("Invalid catalog data."); | 343 ReportFailure("Invalid catalog data."); |
344 return false; | 344 return false; |
345 } | 345 } |
346 | 346 |
347 FilePath relative_path = FilePath::FromWStringHack(*key_it); | 347 FilePath relative_path = FilePath::FromWStringHack(*key_it); |
348 relative_path = relative_path.AppendASCII(Extension::kMessagesFilename); | 348 relative_path = relative_path.AppendASCII(Extension::kMessagesFilename); |
349 if (relative_path.IsAbsolute() || relative_path.ReferencesParent()) { | 349 if (relative_path.IsAbsolute() || relative_path.ReferencesParent()) { |
350 ReportFailure("Invalid path for catalog."); | 350 ReportFailure("Invalid path for catalog."); |
351 return false; | 351 return false; |
352 } | 352 } |
(...skipping 12 matching lines...) Expand all Loading... |
365 if (!file_util::WriteFile(path, | 365 if (!file_util::WriteFile(path, |
366 catalog_json.c_str(), | 366 catalog_json.c_str(), |
367 catalog_json.size())) { | 367 catalog_json.size())) { |
368 ReportFailure("Error saving catalog."); | 368 ReportFailure("Error saving catalog."); |
369 return false; | 369 return false; |
370 } | 370 } |
371 } | 371 } |
372 | 372 |
373 return true; | 373 return true; |
374 } | 374 } |
OLD | NEW |