| 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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 } | 314 } |
| 315 | 315 |
| 316 parsed_mime_types->push_back(mime_type); | 316 parsed_mime_types->push_back(mime_type); |
| 317 } | 317 } |
| 318 | 318 |
| 319 return true; | 319 return true; |
| 320 } | 320 } |
| 321 | 321 |
| 322 PluginList::PluginList() | 322 PluginList::PluginList() |
| 323 : plugins_need_refresh_(true), | 323 : plugins_need_refresh_(true), |
| 324 disable_outdated_plugins_(false), | |
| 325 group_definitions_(kGroupDefinitions), | 324 group_definitions_(kGroupDefinitions), |
| 326 num_group_definitions_(ARRAYSIZE_UNSAFE(kGroupDefinitions)), | 325 num_group_definitions_(ARRAYSIZE_UNSAFE(kGroupDefinitions)), |
| 327 default_plugin_enabled_(false) { | 326 default_plugin_enabled_(false) { |
| 328 PlatformInit(); | 327 PlatformInit(); |
| 329 AddHardcodedPluginGroups(&plugin_groups_); | 328 AddHardcodedPluginGroups(&plugin_groups_); |
| 330 } | 329 } |
| 331 | 330 |
| 332 PluginList::PluginList(const PluginGroupDefinition* definitions, | 331 PluginList::PluginList(const PluginGroupDefinition* definitions, |
| 333 size_t num_definitions) | 332 size_t num_definitions) |
| 334 : plugins_need_refresh_(true), | 333 : plugins_need_refresh_(true), |
| 335 disable_outdated_plugins_(false), | |
| 336 group_definitions_(definitions), | 334 group_definitions_(definitions), |
| 337 num_group_definitions_(num_definitions), | 335 num_group_definitions_(num_definitions), |
| 338 default_plugin_enabled_(false) { | 336 default_plugin_enabled_(false) { |
| 339 // Don't do platform-dependend initialization in unit tests. | 337 // Don't do platform-dependend initialization in unit tests. |
| 340 AddHardcodedPluginGroups(&plugin_groups_); | 338 AddHardcodedPluginGroups(&plugin_groups_); |
| 341 } | 339 } |
| 342 | 340 |
| 343 void PluginList::LoadPluginsInternal(ScopedVector<PluginGroup>* plugin_groups) { | 341 void PluginList::LoadPluginsInternal(ScopedVector<PluginGroup>* plugin_groups) { |
| 344 // Don't want to hold the lock while loading new plugins, so we don't block | 342 // Don't want to hold the lock while loading new plugins, so we don't block |
| 345 // other methods if they're called on other threads. | 343 // other methods if they're called on other threads. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 } | 439 } |
| 442 } | 440 } |
| 443 | 441 |
| 444 if (group->IsEmpty()) { | 442 if (group->IsEmpty()) { |
| 445 new_plugin_groups.erase(new_plugin_groups.begin() + i); | 443 new_plugin_groups.erase(new_plugin_groups.begin() + i); |
| 446 --i; | 444 --i; |
| 447 continue; | 445 continue; |
| 448 } | 446 } |
| 449 | 447 |
| 450 group->EnforceGroupPolicy(); | 448 group->EnforceGroupPolicy(); |
| 451 if (disable_outdated_plugins_) | |
| 452 group->DisableOutdatedPlugins(); | |
| 453 } | 449 } |
| 454 // We flush the list of prematurely disabled plugins after the load has | 450 // We flush the list of prematurely disabled plugins after the load has |
| 455 // finished. If for some reason a plugin reappears on a second load it is | 451 // finished. If for some reason a plugin reappears on a second load it is |
| 456 // going to be loaded normally. This is only true for non-policy controlled | 452 // going to be loaded normally. This is only true for non-policy controlled |
| 457 // plugins though. | 453 // plugins though. |
| 458 plugins_to_disable_.clear(); | 454 plugins_to_disable_.clear(); |
| 459 | 455 |
| 460 plugin_groups_.swap(new_plugin_groups); | 456 plugin_groups_.swap(new_plugin_groups); |
| 461 } | 457 } |
| 462 | 458 |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 if (mime_type.file_extensions[j] == extension) { | 771 if (mime_type.file_extensions[j] == extension) { |
| 776 if (actual_mime_type) | 772 if (actual_mime_type) |
| 777 *actual_mime_type = mime_type.mime_type; | 773 *actual_mime_type = mime_type.mime_type; |
| 778 return true; | 774 return true; |
| 779 } | 775 } |
| 780 } | 776 } |
| 781 } | 777 } |
| 782 return false; | 778 return false; |
| 783 } | 779 } |
| 784 | 780 |
| 785 void PluginList::DisableOutdatedPluginGroups() { | |
| 786 disable_outdated_plugins_ = true; | |
| 787 } | |
| 788 | |
| 789 PluginList::~PluginList() { | 781 PluginList::~PluginList() { |
| 790 } | 782 } |
| 791 | 783 |
| 792 | 784 |
| 793 } // namespace npapi | 785 } // namespace npapi |
| 794 } // namespace webkit | 786 } // namespace webkit |
| OLD | NEW |