OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_file_util.h" | 5 #include "chrome/common/extensions/extension_file_util.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 base::FilePath basename = extension_path.BaseName(); | 343 base::FilePath basename = extension_path.BaseName(); |
344 // Clean up temporary files left if Chrome crashed or quit in the middle | 344 // Clean up temporary files left if Chrome crashed or quit in the middle |
345 // of an extension install. | 345 // of an extension install. |
346 if (basename.value() == kTempDirectoryName) { | 346 if (basename.value() == kTempDirectoryName) { |
347 if (clean_temp_dir) | 347 if (clean_temp_dir) |
348 base::DeleteFile(extension_path, true); // Recursive | 348 base::DeleteFile(extension_path, true); // Recursive |
349 continue; | 349 continue; |
350 } | 350 } |
351 | 351 |
352 // Parse directory name as a potential extension ID. | 352 // Parse directory name as a potential extension ID. |
353 if (IsStringASCII(basename.value())) { | 353 if (base::IsStringASCII(basename.value())) { |
354 extension_id = base::UTF16ToASCII(basename.LossyDisplayName()); | 354 extension_id = base::UTF16ToASCII(basename.LossyDisplayName()); |
355 if (!Extension::IdIsValid(extension_id)) | 355 if (!Extension::IdIsValid(extension_id)) |
356 extension_id.clear(); | 356 extension_id.clear(); |
357 } | 357 } |
358 | 358 |
359 // Delete directories that aren't valid IDs. | 359 // Delete directories that aren't valid IDs. |
360 if (extension_id.empty()) { | 360 if (extension_id.empty()) { |
361 DLOG(WARNING) << "Invalid extension ID encountered in extensions " | 361 DLOG(WARNING) << "Invalid extension ID encountered in extensions " |
362 "directory: " << basename.value(); | 362 "directory: " << basename.value(); |
363 DVLOG(1) << "Deleting invalid extension directory " | 363 DVLOG(1) << "Deleting invalid extension directory " |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 return base::FilePath(); | 524 return base::FilePath(); |
525 } | 525 } |
526 return temp_path; | 526 return temp_path; |
527 } | 527 } |
528 | 528 |
529 void DeleteFile(const base::FilePath& path, bool recursive) { | 529 void DeleteFile(const base::FilePath& path, bool recursive) { |
530 base::DeleteFile(path, recursive); | 530 base::DeleteFile(path, recursive); |
531 } | 531 } |
532 | 532 |
533 } // namespace extension_file_util | 533 } // namespace extension_file_util |
OLD | NEW |