Chromium Code Reviews| 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 8f676b81ed27498dfdd03b299479d57f2c4463a6..e3d2fe5da62ef39478d422745a1c3299a3a2c9ad 100644 |
| --- a/third_party/WebKit/Source/platform/plugins/PluginData.cpp |
| +++ b/third_party/WebKit/Source/platform/plugins/PluginData.cpp |
| @@ -24,48 +24,19 @@ |
| #include "platform/plugins/PluginData.h" |
| #include "platform/plugins/PluginListBuilder.h" |
| +#include "platform/weborigin/SecurityOrigin.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() |
| +PluginData::PluginData(const RefPtr<SecurityOrigin> mainFrameOrigin) |
|
alexmos
2016/08/09 01:40:15
Why not PassRefPtr<SecurityOrigin> or SecurityOrig
trizzofo
2016/08/09 21:24:24
Done. Changed it to SecurityOrigin*.
|
| { |
| - DEFINE_STATIC_LOCAL(PluginCache, cache, ()); |
| - return cache; |
| -} |
| + m_mainFrameOrigin = mainFrameOrigin; |
| -PluginData::PluginData(const Page* page) |
| -{ |
| - initPlugins(page); |
| + PluginListBuilder builder(&m_plugins); |
| + Platform::current()->getPluginList(m_refresh, WebSecurityOrigin(m_mainFrameOrigin), &builder); |
| + m_refresh = false; |
| for (unsigned i = 0; i < m_plugins.size(); ++i) { |
| const PluginInfo& plugin = m_plugins[i]; |
| @@ -103,17 +74,11 @@ String PluginData::pluginNameForMimeType(const String& mimeType) const |
| return String(); |
| } |
| -void PluginData::initPlugins(const Page*) |
| -{ |
| - const Vector<PluginInfo>& plugins = pluginCache().plugins(); |
| - for (size_t i = 0; i < plugins.size(); ++i) |
| - m_plugins.append(plugins[i]); |
| -} |
| - |
| void PluginData::refresh() |
| { |
| - pluginCache().reset(true); |
| - pluginCache().plugins(); // Force the plugins to be reloaded now. |
| + m_refresh = true; |
| } |
| +bool PluginData::m_refresh = false; |
| + |
| } // namespace blink |