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..74d8be6341f43851f46c11aa498eb042d658a3a4 100644 |
| --- a/third_party/WebKit/Source/platform/plugins/PluginData.cpp |
| +++ b/third_party/WebKit/Source/platform/plugins/PluginData.cpp |
| @@ -24,48 +24,18 @@ |
| #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(SecurityOrigin* mainFrameOrigin) |
| + : m_mainFrameOrigin(mainFrameOrigin) |
| { |
| - DEFINE_STATIC_LOCAL(PluginCache, cache, ()); |
| - return cache; |
| -} |
| - |
| -PluginData::PluginData(const Page* page) |
| -{ |
| - initPlugins(page); |
| + PluginListBuilder builder(&m_plugins); |
| + Platform::current()->getPluginList(m_refresh, WebSecurityOrigin(m_mainFrameOrigin), &builder); |
|
esprehn
2016/08/26 04:46:03
I don't understand how this code can work, you're
trizzofo
2016/08/26 20:28:00
It's confusing, but PluginData::refresh() is actua
tommycli
2016/08/26 20:34:16
Yes - after refresh() is called, all existing Plug
trizzofo
2016/08/26 22:19:41
Actually, when PluginData::refresh() is called, al
|
| + m_refresh = false; |
|
esprehn
2016/08/26 04:46:03
What about all of the other frames?
trizzofo
2016/08/26 20:28:00
New instances of PluginData will have the updated
|
| for (unsigned i = 0; i < m_plugins.size(); ++i) { |
| const PluginInfo& plugin = m_plugins[i]; |
| @@ -103,17 +73,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 |