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

Side by Side Diff: webkit/plugins/npapi/plugin_list_posix.cc

Issue 16392011: Move FileEnumerator to its own file, do some refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix incorrect includes Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/npapi/plugin_list_mac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "webkit/plugins/npapi/plugin_list.h" 5 #include "webkit/plugins/npapi/plugin_list.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <dlfcn.h> 8 #include <dlfcn.h>
9 #if defined(OS_OPENBSD) 9 #if defined(OS_OPENBSD)
10 #include <sys/exec_elf.h> 10 #include <sys/exec_elf.h>
11 #else 11 #else
12 #include <elf.h> 12 #include <elf.h>
13 #endif 13 #endif
14 #include <fcntl.h> 14 #include <fcntl.h>
15 #include <sys/stat.h> 15 #include <sys/stat.h>
16 #include <sys/types.h> 16 #include <sys/types.h>
17 #include <unistd.h> 17 #include <unistd.h>
18 18
19 #include "base/cpu.h" 19 #include "base/cpu.h"
20 #include "base/file_util.h" 20 #include "base/file_util.h"
21 #include "base/files/file_enumerator.h"
21 #include "base/native_library.h" 22 #include "base/native_library.h"
22 #include "base/path_service.h" 23 #include "base/path_service.h"
23 #include "base/posix/eintr_wrapper.h" 24 #include "base/posix/eintr_wrapper.h"
24 #include "base/sha1.h" 25 #include "base/sha1.h"
25 #include "base/string_util.h" 26 #include "base/string_util.h"
26 #include "base/stringprintf.h" 27 #include "base/stringprintf.h"
27 #include "base/strings/string_split.h" 28 #include "base/strings/string_split.h"
28 #include "base/strings/sys_string_conversions.h" 29 #include "base/strings/sys_string_conversions.h"
29 #include "base/utf_string_conversions.h" 30 #include "base/utf_string_conversions.h"
30 #include "build/build_config.h" 31 #include "build/build_config.h"
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 } 487 }
487 488
488 void PluginList::GetPluginsInDir( 489 void PluginList::GetPluginsInDir(
489 const base::FilePath& dir_path, std::vector<base::FilePath>* plugins) { 490 const base::FilePath& dir_path, std::vector<base::FilePath>* plugins) {
490 // See ScanPluginsDirectory near 491 // See ScanPluginsDirectory near
491 // http://mxr.mozilla.org/firefox/source/modules/plugin/base/src/nsPluginHostI mpl.cpp#5052 492 // http://mxr.mozilla.org/firefox/source/modules/plugin/base/src/nsPluginHostI mpl.cpp#5052
492 493
493 // Construct and stat a list of all filenames under consideration, for 494 // Construct and stat a list of all filenames under consideration, for
494 // later sorting by mtime. 495 // later sorting by mtime.
495 FileTimeList files; 496 FileTimeList files;
496 file_util::FileEnumerator enumerator(dir_path, 497 base::FileEnumerator enumerator(dir_path,
497 false, // not recursive 498 false, // not recursive
498 file_util::FileEnumerator::FILES); 499 base::FileEnumerator::FILES);
499 for (base::FilePath path = enumerator.Next(); !path.value().empty(); 500 for (base::FilePath path = enumerator.Next(); !path.value().empty();
500 path = enumerator.Next()) { 501 path = enumerator.Next()) {
501 // Skip over Mozilla .xpt files. 502 // Skip over Mozilla .xpt files.
502 if (path.MatchesExtension(FILE_PATH_LITERAL(".xpt"))) 503 if (path.MatchesExtension(FILE_PATH_LITERAL(".xpt")))
503 continue; 504 continue;
504 505
505 // Java doesn't like being loaded through a symlink, since it uses 506 // Java doesn't like being loaded through a symlink, since it uses
506 // its path to find dependent data files. 507 // its path to find dependent data files.
507 // MakeAbsoluteFilePath calls through to realpath(), which resolves 508 // MakeAbsoluteFilePath calls through to realpath(), which resolves
508 // symlinks. 509 // symlinks.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 585
585 // TODO(evanm): prefer the newest version of flash, etc. here? 586 // TODO(evanm): prefer the newest version of flash, etc. here?
586 587
587 VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value(); 588 VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value();
588 589
589 return true; 590 return true;
590 } 591 }
591 592
592 } // namespace npapi 593 } // namespace npapi
593 } // namespace webkit 594 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/plugin_list_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698