| Index: third_party/WebKit/Source/platform/plugins/PluginData.cpp
|
| diff --git a/third_party/WebKit/Source/platform/plugins/PluginData.cpp b/third_party/WebKit/Source/platform/plugins/PluginData.cpp
|
| index 4897488b842de7a845c17c668d7a12426384c840..980e489ac86b14027dd7c8c15202c873aac8892c 100644
|
| --- a/third_party/WebKit/Source/platform/plugins/PluginData.cpp
|
| +++ b/third_party/WebKit/Source/platform/plugins/PluginData.cpp
|
| @@ -25,47 +25,12 @@
|
|
|
| #include "platform/plugins/PluginListBuilder.h"
|
| #include "public/platform/Platform.h"
|
| +#include "public/platform/WebSecurityOrigin.h"
|
|
|
| namespace blink {
|
| -
|
| -class PluginCache {
|
| -public:
|
| - PluginCache() : m_loaded(false), m_refresh(false) { }
|
| - ~PluginCache() { reset(false); }
|
| -
|
| - void reset(bool refresh)
|
| - {
|
| - m_plugins.clear();
|
| - m_loaded = false;
|
| - m_refresh = refresh;
|
| - }
|
| -
|
| - const Vector<PluginInfo>& plugins()
|
| - {
|
| - if (!m_loaded) {
|
| - PluginListBuilder builder(&m_plugins);
|
| - Platform::current()->getPluginList(m_refresh, &builder);
|
| - m_loaded = true;
|
| - m_refresh = false;
|
| - }
|
| - return m_plugins;
|
| - }
|
| -
|
| -private:
|
| - Vector<PluginInfo> m_plugins;
|
| - bool m_loaded;
|
| - bool m_refresh;
|
| -};
|
| -
|
| -static PluginCache& pluginCache()
|
| -{
|
| - DEFINE_STATIC_LOCAL(PluginCache, cache, ());
|
| - return cache;
|
| -}
|
| -
|
| -PluginData::PluginData(const Page* page)
|
| +PluginData::PluginData(const WebSecurityOrigin* origin)
|
| {
|
| - initPlugins(page);
|
| + initPlugins(origin);
|
|
|
| for (unsigned i = 0; i < m_plugins.size(); ++i) {
|
| const PluginInfo& plugin = m_plugins[i];
|
| @@ -103,22 +68,24 @@ String PluginData::pluginNameForMimeType(const String& mimeType) const
|
| return String();
|
| }
|
|
|
| -void PluginData::initPlugins(const Page*)
|
| +void PluginData::initPlugins(const WebSecurityOrigin* origin)
|
| {
|
| - const Vector<PluginInfo>& plugins = pluginCache().plugins();
|
| - for (size_t i = 0; i < plugins.size(); ++i)
|
| - m_plugins.append(plugins[i]);
|
| + PluginListBuilder builder(&m_plugins);
|
| + Platform::current()->getPluginList(m_refresh, origin, &builder);
|
| + m_refresh = false;
|
| }
|
|
|
| void PluginData::refresh()
|
| {
|
| - pluginCache().reset(true);
|
| - pluginCache().plugins(); // Force the plugins to be reloaded now.
|
| + m_refresh = true;
|
| }
|
|
|
| String getPluginMimeTypeFromExtension(const String& extension)
|
| {
|
| - const Vector<PluginInfo>& plugins = pluginCache().plugins();
|
| + Vector<PluginInfo> plugins;
|
| + PluginListBuilder builder(&plugins);
|
| + Platform::current()->getPluginList(PluginData::m_refresh, nullptr, &builder);
|
| + PluginData::m_refresh = false;
|
| for (size_t i = 0; i < plugins.size(); ++i) {
|
| for (size_t j = 0; j < plugins[i].mimes.size(); ++j) {
|
| const MimeClassInfo& mime = plugins[i].mimes[j];
|
| @@ -132,4 +99,6 @@ String getPluginMimeTypeFromExtension(const String& extension)
|
| return String();
|
| }
|
|
|
| +bool PluginData::m_refresh = false;
|
| +
|
| } // namespace blink
|
|
|