Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: chrome/common/extensions/extension_file_util.cc

Issue 10855002: Change the type of file_type parameter to int, as the parameter actually takes or-ed bitmasks, (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_path.h" 10 #include "base/file_path.h"
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 CR_DEFINE_STATIC_LOCAL( 647 CR_DEFINE_STATIC_LOCAL(
648 std::set<FilePath::StringType>, reserved_underscore_names, 648 std::set<FilePath::StringType>, reserved_underscore_names,
649 (reserved_names, reserved_names + arraysize(reserved_names))); 649 (reserved_names, reserved_names + arraysize(reserved_names)));
650 650
651 // Enumerate all files and directories in the extension root. 651 // Enumerate all files and directories in the extension root.
652 // There is a problem when using pattern "_*" with FileEnumerator, so we have 652 // There is a problem when using pattern "_*" with FileEnumerator, so we have
653 // to cheat with find_first_of and match all. 653 // to cheat with find_first_of and match all.
654 file_util::FileEnumerator all_files( 654 file_util::FileEnumerator all_files(
655 extension_path, 655 extension_path,
656 false, 656 false,
657 static_cast<file_util::FileEnumerator::FileType>( 657 (file_util::FileEnumerator::DIRECTORIES |
658 file_util::FileEnumerator::DIRECTORIES | 658 file_util::FileEnumerator::FILES));
not at google - send to devlin 2012/08/06 05:04:56 extra parens seem unnecessary
Haruki Sato 2012/08/06 23:22:18 Ack. replied to another comment.
not at google - send to devlin 2012/08/06 23:28:18 You could assign to a kFilesAndDirectories constan
Haruki Sato 2012/08/07 02:29:17 Done.
659 file_util::FileEnumerator::FILES));
660 659
661 FilePath file; 660 FilePath file;
662 while (!(file = all_files.Next()).empty()) { 661 while (!(file = all_files.Next()).empty()) {
663 FilePath::StringType filename = file.BaseName().value(); 662 FilePath::StringType filename = file.BaseName().value();
664 // Skip all that don't start with "_". 663 // Skip all that don't start with "_".
665 if (filename.find_first_of(FILE_PATH_LITERAL("_")) != 0) continue; 664 if (filename.find_first_of(FILE_PATH_LITERAL("_")) != 0) continue;
666 if (reserved_underscore_names.find(filename) == 665 if (reserved_underscore_names.find(filename) ==
667 reserved_underscore_names.end()) { 666 reserved_underscore_names.end()) {
668 *error = base::StringPrintf( 667 *error = base::StringPrintf(
669 "Cannot load extension with file or directory name %s. " 668 "Cannot load extension with file or directory name %s. "
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 return temp_path; 787 return temp_path;
789 788
790 return FilePath(); 789 return FilePath();
791 } 790 }
792 791
793 void DeleteFile(const FilePath& path, bool recursive) { 792 void DeleteFile(const FilePath& path, bool recursive) {
794 file_util::Delete(path, recursive); 793 file_util::Delete(path, recursive);
795 } 794 }
796 795
797 } // namespace extension_file_util 796 } // namespace extension_file_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698