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/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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 return true; | 507 return true; |
508 } | 508 } |
509 | 509 |
510 bool CheckForIllegalFilenames(const FilePath& extension_path, | 510 bool CheckForIllegalFilenames(const FilePath& extension_path, |
511 std::string* error) { | 511 std::string* error) { |
512 // Reserved underscore names. | 512 // Reserved underscore names. |
513 static const FilePath::CharType* reserved_names[] = { | 513 static const FilePath::CharType* reserved_names[] = { |
514 Extension::kLocaleFolder, | 514 Extension::kLocaleFolder, |
515 FILE_PATH_LITERAL("__MACOSX"), | 515 FILE_PATH_LITERAL("__MACOSX"), |
516 }; | 516 }; |
517 static std::set<FilePath::StringType> reserved_underscore_names( | 517 CR_DEFINE_STATIC_LOCAL( |
518 reserved_names, reserved_names + arraysize(reserved_names)); | 518 std::set<FilePath::StringType>, reserved_underscore_names, |
| 519 (reserved_names, reserved_names + arraysize(reserved_names))); |
519 | 520 |
520 // Enumerate all files and directories in the extension root. | 521 // Enumerate all files and directories in the extension root. |
521 // There is a problem when using pattern "_*" with FileEnumerator, so we have | 522 // There is a problem when using pattern "_*" with FileEnumerator, so we have |
522 // to cheat with find_first_of and match all. | 523 // to cheat with find_first_of and match all. |
523 file_util::FileEnumerator all_files( | 524 file_util::FileEnumerator all_files( |
524 extension_path, | 525 extension_path, |
525 false, | 526 false, |
526 static_cast<file_util::FileEnumerator::FileType>( | 527 static_cast<file_util::FileEnumerator::FileType>( |
527 file_util::FileEnumerator::DIRECTORIES | | 528 file_util::FileEnumerator::DIRECTORIES | |
528 file_util::FileEnumerator::FILES)); | 529 file_util::FileEnumerator::FILES)); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 return temp_path; | 641 return temp_path; |
641 | 642 |
642 return FilePath(); | 643 return FilePath(); |
643 } | 644 } |
644 | 645 |
645 void DeleteFile(const FilePath& path, bool recursive) { | 646 void DeleteFile(const FilePath& path, bool recursive) { |
646 file_util::Delete(path, recursive); | 647 file_util::Delete(path, recursive); |
647 } | 648 } |
648 | 649 |
649 } // namespace extension_file_util | 650 } // namespace extension_file_util |
OLD | NEW |