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