summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/common/notification_type.h4
-rw-r--r--chrome/renderer/blocked_plugin.cc26
-rw-r--r--chrome/renderer/blocked_plugin.h16
-rw-r--r--chrome/renderer/render_view.cc15
-rw-r--r--chrome/renderer/render_view.h7
5 files changed, 26 insertions, 42 deletions
diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h
index 8dbc2a3..cc7ac46 100644
--- a/chrome/common/notification_type.h
+++ b/chrome/common/notification_type.h
@@ -569,10 +569,6 @@ class NotificationType {
// interception. No details are expected.
CHROME_PLUGIN_UNLOADED,
- // This is sent in the RenderView when previously blocked plugins on a page
- // should be loaded. The source is the RenderView. No details are expected.
- SHOULD_LOAD_PLUGINS,
-
// Sent by the PluginUpdater when there is a change of plugin
// enable/disable status.
PLUGIN_ENABLE_STATUS_CHANGED,
diff --git a/chrome/renderer/blocked_plugin.cc b/chrome/renderer/blocked_plugin.cc
index 68af8f8..064d004 100644
--- a/chrome/renderer/blocked_plugin.cc
+++ b/chrome/renderer/blocked_plugin.cc
@@ -9,11 +9,8 @@
#include "base/string_piece.h"
#include "base/values.h"
#include "chrome/common/jstemplate_builder.h"
-#include "chrome/common/notification_service.h"
-#include "chrome/common/render_messages.h"
#include "chrome/renderer/render_view.h"
#include "grit/generated_resources.h"
-#include "grit/renderer_resources.h"
#include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h"
#include "third_party/WebKit/WebKit/chromium/public/WebData.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
@@ -70,13 +67,12 @@ BlockedPlugin::BlockedPlugin(RenderView* render_view,
html_data,
GURL(kBlockedPluginDataURL));
- registrar_.Add(this,
- NotificationType::SHOULD_LOAD_PLUGINS,
- NotificationService::AllSources());
+ render_view_->RegisterBlockedPlugin(this);
}
BlockedPlugin::~BlockedPlugin() {
render_view_->CustomMenuListenerDestroyed(this);
+ render_view_->UnregisterBlockedPlugin(this);
}
void BlockedPlugin::BindWebFrame(WebFrame* frame) {
@@ -130,20 +126,6 @@ void BlockedPlugin::MenuItemSelected(unsigned id) {
}
}
-void BlockedPlugin::Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details) {
- if (type == NotificationType::SHOULD_LOAD_PLUGINS) {
- LoadPlugin();
- } else {
- NOTREACHED();
- }
-}
-
-void BlockedPlugin::Load(const CppArgumentList& args, CppVariant* result) {
- LoadPlugin();
-}
-
void BlockedPlugin::LoadPlugin() {
CHECK(plugin_);
WebPluginContainer* container = plugin_->container();
@@ -159,6 +141,10 @@ void BlockedPlugin::LoadPlugin() {
}
}
+void BlockedPlugin::Load(const CppArgumentList& args, CppVariant* result) {
+ LoadPlugin();
+}
+
void BlockedPlugin::HidePlugin() {
CHECK(plugin_);
WebPluginContainer* container = plugin_->container();
diff --git a/chrome/renderer/blocked_plugin.h b/chrome/renderer/blocked_plugin.h
index 7b616bf..fe68275 100644
--- a/chrome/renderer/blocked_plugin.h
+++ b/chrome/renderer/blocked_plugin.h
@@ -6,8 +6,6 @@
#define CHROME_RENDERER_BLOCKED_PLUGIN_H_
#pragma once
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
#include "chrome/renderer/custom_menu_listener.h"
#include "third_party/WebKit/WebKit/chromium/public/WebPluginParams.h"
#include "webkit/glue/cpp_bound_class.h"
@@ -25,7 +23,6 @@ class PluginGroup;
class BlockedPlugin : public CppBoundClass,
public webkit::npapi::WebViewPlugin::Delegate,
- public NotificationObserver,
public CustomMenuListener {
public:
BlockedPlugin(RenderView* render_view,
@@ -43,14 +40,12 @@ class BlockedPlugin : public CppBoundClass,
virtual void WillDestroyPlugin();
virtual void ShowContextMenu(const WebKit::WebMouseEvent&);
- // NotificationObserver methods:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
// CustomMenuListener methods:
virtual void MenuItemSelected(unsigned id);
+ // Load the blocked plugin.
+ void LoadPlugin();
+
private:
virtual ~BlockedPlugin();
@@ -59,9 +54,6 @@ class BlockedPlugin : public CppBoundClass,
// Takes no arguments, and returns nothing.
void Load(const CppArgumentList& args, CppVariant* result);
- // Load the blocked plugin.
- void LoadPlugin();
-
// Hide the blocked plugin.
void HidePlugin();
@@ -71,8 +63,6 @@ class BlockedPlugin : public CppBoundClass,
webkit::npapi::WebViewPlugin* plugin_;
// The name of the plugin that was blocked.
string16 name_;
-
- NotificationRegistrar registrar_;
};
#endif // CHROME_RENDERER_BLOCKED_PLUGIN_H_
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index e33d1c0..c6723e8 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -886,6 +886,14 @@ void RenderView::UnregisterPluginDelegate(WebPluginDelegateProxy* delegate) {
plugin_delegates_.erase(delegate);
}
+void RenderView::RegisterBlockedPlugin(BlockedPlugin* blocked_plugin) {
+ blocked_plugins_.insert(blocked_plugin);
+}
+
+void RenderView::UnregisterBlockedPlugin(BlockedPlugin* blocked_plugin) {
+ blocked_plugins_.erase(blocked_plugin);
+}
+
void RenderView::Init(gfx::NativeViewId parent_hwnd,
int32 opener_id,
const RendererPreferences& renderer_prefs,
@@ -4783,11 +4791,8 @@ void RenderView::OnInstallMissingPlugin() {
}
void RenderView::OnLoadBlockedPlugins() {
- current_content_settings_.settings[CONTENT_SETTINGS_TYPE_PLUGINS] =
- CONTENT_SETTING_ALLOW;
- NotificationService::current()->Notify(NotificationType::SHOULD_LOAD_PLUGINS,
- Source<RenderView>(this),
- NotificationService::NoDetails());
+ while (!blocked_plugins_.empty())
+ (*blocked_plugins_.begin())->LoadPlugin();
}
void RenderView::OnFileChooserResponse(const std::vector<FilePath>& paths) {
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index e3c27d6a..49b3ed5 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -56,6 +56,7 @@
class AudioMessageFilter;
class AutoFillHelper;
+class BlockedPlugin;
class CustomMenuListener;
class DictionaryValue;
class DeviceOrientationDispatcher;
@@ -389,6 +390,9 @@ class RenderView : public RenderWidget,
void RegisterPluginDelegate(WebPluginDelegateProxy* delegate);
void UnregisterPluginDelegate(WebPluginDelegateProxy* delegate);
+ void RegisterBlockedPlugin(BlockedPlugin* blocked_plugin);
+ void UnregisterBlockedPlugin(BlockedPlugin* blocked_plugin);
+
// IPC::Channel::Listener implementation -------------------------------------
virtual bool OnMessageReceived(const IPC::Message& msg);
@@ -1366,6 +1370,9 @@ class RenderView : public RenderWidget,
// destroyed yet. Pepper v2 plugins are tracked by the pepper_delegate_.
std::set<WebPluginDelegatePepper*> current_oldstyle_pepper_plugins_;
+ // A list of all BlockedPlugins so they can all be loaded if needed.
+ std::set<BlockedPlugin*> blocked_plugins_;
+
// Helper objects ------------------------------------------------------------
ScopedRunnableMethodFactory<RenderView> page_info_method_factory_;