| 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 |  | 
| 270 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info, |  | 
| 271                                   ScopedVector<PluginGroup>* plugin_groups) { |  | 
| 272   LOG_IF(ERROR, PluginList::DebugPluginLoading()) |  | 
| 273       << "Considering " << info.path.value() << " (" << info.name << ")"; |  | 
| 274 |  | 
| 275   if (IsUndesirablePlugin(info)) { |  | 
| 276     LOG_IF(ERROR, PluginList::DebugPluginLoading()) |  | 
| 277         << info.path.value() << " is undesirable."; |  | 
| 278 |  | 
| 279     // See if we have a better version of this plugin. |  | 
| 280     for (size_t i = 0; i < plugin_groups->size(); ++i) { |  | 
| 281       const std::vector<WebPluginInfo>& plugins = |  | 
| 282           (*plugin_groups)[i]->web_plugin_infos(); |  | 
| 283       for (size_t j = 0; j < plugins.size(); ++j) { |  | 
| 284         if (plugins[j].name == info.name && |  | 
| 285             !IsUndesirablePlugin(plugins[j])) { |  | 
| 286           // Skip the current undesirable one so we can use the better one |  | 
| 287           // we just found. |  | 
| 288           LOG_IF(ERROR, PluginList::DebugPluginLoading()) |  | 
| 289               << "Skipping " << info.path.value() << ", preferring " |  | 
| 290               << plugins[j].path.value(); |  | 
| 291           return false; |  | 
| 292         } |  | 
| 293       } |  | 
| 294     } |  | 
| 295   } |  | 
| 296 |  | 
| 297   // TODO(evanm): prefer the newest version of flash, etc. here? |  | 
| 298 |  | 
| 299   VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value(); |  | 
| 300 |  | 
| 301   return true; |  | 
| 302 } |  | 
| 303 |  | 
| 304 bool PluginList::ShouldLoadPluginUsingPluginList( | 269 bool PluginList::ShouldLoadPluginUsingPluginList( | 
| 305     const WebPluginInfo& info, std::vector<webkit::WebPluginInfo>* plugins) { | 270     const WebPluginInfo& info, std::vector<webkit::WebPluginInfo>* plugins) { | 
| 306   LOG_IF(ERROR, PluginList::DebugPluginLoading()) | 271   LOG_IF(ERROR, PluginList::DebugPluginLoading()) | 
| 307       << "Considering " << info.path.value() << " (" << info.name << ")"; | 272       << "Considering " << info.path.value() << " (" << info.name << ")"; | 
| 308 | 273 | 
| 309   if (IsUndesirablePlugin(info)) { | 274   if (IsUndesirablePlugin(info)) { | 
| 310     LOG_IF(ERROR, PluginList::DebugPluginLoading()) | 275     LOG_IF(ERROR, PluginList::DebugPluginLoading()) | 
| 311         << info.path.value() << " is undesirable."; | 276         << info.path.value() << " is undesirable."; | 
| 312 | 277 | 
| 313     // See if we have a better version of this plugin. | 278     // See if we have a better version of this plugin. | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 326 | 291 | 
| 327   // TODO(evanm): prefer the newest version of flash, etc. here? | 292   // TODO(evanm): prefer the newest version of flash, etc. here? | 
| 328 | 293 | 
| 329   VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value(); | 294   VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value(); | 
| 330 | 295 | 
| 331   return true; | 296   return true; | 
| 332 } | 297 } | 
| 333 | 298 | 
| 334 }  // namespace npapi | 299 }  // namespace npapi | 
| 335 }  // namespace webkit | 300 }  // namespace webkit | 
| OLD | NEW | 
|---|