OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/glue/plugins/plugin_list.h" | 5 #include "webkit/plugins/npapi/plugin_list.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/sha1.h" | 9 #include "base/sha1.h" |
10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 | 13 |
| 14 namespace webkit { |
| 15 namespace npapi { |
| 16 |
14 namespace { | 17 namespace { |
15 | 18 |
16 // We build up a list of files and mtimes so we can sort them. | 19 // We build up a list of files and mtimes so we can sort them. |
17 typedef std::pair<FilePath, base::Time> FileAndTime; | 20 typedef std::pair<FilePath, base::Time> FileAndTime; |
18 typedef std::vector<FileAndTime> FileTimeList; | 21 typedef std::vector<FileAndTime> FileTimeList; |
19 | 22 |
20 // Comparator used to sort by descending mtime then ascending filename. | 23 // Comparator used to sort by descending mtime then ascending filename. |
21 bool CompareTime(const FileAndTime& a, const FileAndTime& b) { | 24 bool CompareTime(const FileAndTime& a, const FileAndTime& b) { |
22 if (a.second == b.second) { | 25 if (a.second == b.second) { |
23 // Fall back on filename sorting, just to make the predicate valid. | 26 // Fall back on filename sorting, just to make the predicate valid. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 }; | 96 }; |
94 std::string filename = path.BaseName().value(); | 97 std::string filename = path.BaseName().value(); |
95 for (size_t i = 0; i < arraysize(kBlackListedPlugins); i++) { | 98 for (size_t i = 0; i < arraysize(kBlackListedPlugins); i++) { |
96 if (filename.find(kBlackListedPlugins[i]) != std::string::npos) { | 99 if (filename.find(kBlackListedPlugins[i]) != std::string::npos) { |
97 return true; | 100 return true; |
98 } | 101 } |
99 } | 102 } |
100 return IsBlacklistedBySha1sum(path); | 103 return IsBlacklistedBySha1sum(path); |
101 } | 104 } |
102 | 105 |
103 } // anonymous namespace | 106 } // namespace |
104 | |
105 namespace NPAPI { | |
106 | 107 |
107 void PluginList::PlatformInit() { | 108 void PluginList::PlatformInit() { |
108 } | 109 } |
109 | 110 |
110 void PluginList::GetPluginDirectories(std::vector<FilePath>* plugin_dirs) { | 111 void PluginList::GetPluginDirectories(std::vector<FilePath>* plugin_dirs) { |
111 // See http://groups.google.com/group/chromium-dev/browse_thread/thread/7a70e5
fcbac786a9 | 112 // See http://groups.google.com/group/chromium-dev/browse_thread/thread/7a70e5
fcbac786a9 |
112 // for discussion. | 113 // for discussion. |
113 // We first consult Chrome-specific dirs, then fall back on the logic | 114 // We first consult Chrome-specific dirs, then fall back on the logic |
114 // Mozilla uses. | 115 // Mozilla uses. |
115 | 116 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } | 261 } |
261 } | 262 } |
262 | 263 |
263 // TODO(evanm): prefer the newest version of flash, etc. here? | 264 // TODO(evanm): prefer the newest version of flash, etc. here? |
264 | 265 |
265 VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value(); | 266 VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value(); |
266 | 267 |
267 return true; | 268 return true; |
268 } | 269 } |
269 | 270 |
270 } // namespace NPAPI | 271 } // namespace npapi |
| 272 } // namespace webkit |
OLD | NEW |