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 "webkit/plugins/npapi/plugin_list.h" | 5 #include "webkit/plugins/npapi/plugin_list.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/cpu.h" | 9 #include "base/cpu.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 259 |
260 // Sort the file list by time (and filename). | 260 // Sort the file list by time (and filename). |
261 std::sort(files.begin(), files.end(), CompareTime); | 261 std::sort(files.begin(), files.end(), CompareTime); |
262 | 262 |
263 // Load the files in order. | 263 // Load the files in order. |
264 for (FileTimeList::const_iterator i = files.begin(); i != files.end(); ++i) { | 264 for (FileTimeList::const_iterator i = files.begin(); i != files.end(); ++i) { |
265 plugins->push_back(i->first); | 265 plugins->push_back(i->first); |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
| 269 // TODO(ibraaaa): DELETE. http://crbug.com/124396 |
269 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info, | 270 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info, |
270 ScopedVector<PluginGroup>* plugin_groups) { | 271 ScopedVector<PluginGroup>* plugin_groups) { |
271 LOG_IF(ERROR, PluginList::DebugPluginLoading()) | 272 LOG_IF(ERROR, PluginList::DebugPluginLoading()) |
272 << "Considering " << info.path.value() << " (" << info.name << ")"; | 273 << "Considering " << info.path.value() << " (" << info.name << ")"; |
273 | 274 |
274 if (IsUndesirablePlugin(info)) { | 275 if (IsUndesirablePlugin(info)) { |
275 LOG_IF(ERROR, PluginList::DebugPluginLoading()) | 276 LOG_IF(ERROR, PluginList::DebugPluginLoading()) |
276 << info.path.value() << " is undesirable."; | 277 << info.path.value() << " is undesirable."; |
277 | 278 |
278 // See if we have a better version of this plugin. | 279 // See if we have a better version of this plugin. |
(...skipping 14 matching lines...) Expand all Loading... |
293 } | 294 } |
294 } | 295 } |
295 | 296 |
296 // TODO(evanm): prefer the newest version of flash, etc. here? | 297 // TODO(evanm): prefer the newest version of flash, etc. here? |
297 | 298 |
298 VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value(); | 299 VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value(); |
299 | 300 |
300 return true; | 301 return true; |
301 } | 302 } |
302 | 303 |
| 304 bool PluginList::ShouldLoadPluginUsingPluginList( |
| 305 const WebPluginInfo& info, std::vector<webkit::WebPluginInfo>* plugins) { |
| 306 LOG_IF(ERROR, PluginList::DebugPluginLoading()) |
| 307 << "Considering " << info.path.value() << " (" << info.name << ")"; |
| 308 |
| 309 if (IsUndesirablePlugin(info)) { |
| 310 LOG_IF(ERROR, PluginList::DebugPluginLoading()) |
| 311 << info.path.value() << " is undesirable."; |
| 312 |
| 313 // See if we have a better version of this plugin. |
| 314 for (size_t j = 0; j < plugins->size(); ++j) { |
| 315 if ((*plugins)[j].name == info.name && |
| 316 !IsUndesirablePlugin((*plugins)[j])) { |
| 317 // Skip the current undesirable one so we can use the better one |
| 318 // we just found. |
| 319 LOG_IF(ERROR, PluginList::DebugPluginLoading()) |
| 320 << "Skipping " << info.path.value() << ", preferring " |
| 321 << (*plugins)[j].path.value(); |
| 322 return false; |
| 323 } |
| 324 } |
| 325 } |
| 326 |
| 327 // TODO(evanm): prefer the newest version of flash, etc. here? |
| 328 |
| 329 VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value(); |
| 330 |
| 331 return true; |
| 332 } |
| 333 |
303 } // namespace npapi | 334 } // namespace npapi |
304 } // namespace webkit | 335 } // namespace webkit |
OLD | NEW |