summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/blocked_plugin.cc15
-rw-r--r--chrome/renderer/blocked_plugin.h11
-rw-r--r--chrome/renderer/render_view.cc8
-rw-r--r--chrome/renderer/render_view.h1
4 files changed, 34 insertions, 1 deletions
diff --git a/chrome/renderer/blocked_plugin.cc b/chrome/renderer/blocked_plugin.cc
index 3e891b3..a6ef499 100644
--- a/chrome/renderer/blocked_plugin.cc
+++ b/chrome/renderer/blocked_plugin.cc
@@ -9,6 +9,7 @@
#include "base/file_path.h"
#include "base/string_piece.h"
#include "chrome/common/jstemplate_builder.h"
+#include "chrome/common/notification_service.h"
#include "chrome/renderer/render_view.h"
#include "grit/generated_resources.h"
#include "grit/renderer_resources.h"
@@ -57,6 +58,10 @@ BlockedPlugin::BlockedPlugin(RenderView* render_view,
web_view->mainFrame()->loadHTMLString(htmlData,
GURL(kBlockedPluginDataURL));
+
+ registrar_.Add(this,
+ NotificationType::SHOULD_LOAD_PLUGINS,
+ NotificationService::AllSources());
}
void BlockedPlugin::BindWebFrame(WebFrame* frame) {
@@ -68,6 +73,16 @@ void BlockedPlugin::WillDestroyPlugin() {
delete this;
}
+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();
}
diff --git a/chrome/renderer/blocked_plugin.h b/chrome/renderer/blocked_plugin.h
index 2e7bd75..014c489 100644
--- a/chrome/renderer/blocked_plugin.h
+++ b/chrome/renderer/blocked_plugin.h
@@ -6,6 +6,7 @@
#define CHROME_RENDERER_BLOCKED_PLUGIN_H_
#pragma once
+#include "chrome/common/notification_registrar.h"
#include "third_party/WebKit/WebKit/chromium/public/WebPluginParams.h"
#include "webkit/glue/cpp_bound_class.h"
#include "webkit/glue/plugins/webview_plugin.h"
@@ -13,7 +14,8 @@
class RenderView;
class BlockedPlugin : public CppBoundClass,
- public WebViewPlugin::Delegate {
+ public WebViewPlugin::Delegate,
+ public NotificationObserver {
public:
BlockedPlugin(RenderView* render_view,
WebKit::WebFrame* frame,
@@ -28,6 +30,11 @@ class BlockedPlugin : public CppBoundClass,
virtual void BindWebFrame(WebKit::WebFrame* frame);
virtual void WillDestroyPlugin();
+ // NotificationObserver methods:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
private:
virtual ~BlockedPlugin() { }
@@ -35,6 +42,8 @@ class BlockedPlugin : public CppBoundClass,
WebKit::WebFrame* frame_;
WebKit::WebPluginParams plugin_params_;
WebViewPlugin* plugin_;
+
+ NotificationRegistrar registrar_;
};
#endif // CHROME_RENDERER_BLOCKED_PLUGIN_H_
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 4efa8de..03d18a9 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -30,6 +30,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/jstemplate_builder.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/page_zoom.h"
#include "chrome/common/pepper_plugin_registry.h"
#include "chrome/common/render_messages.h"
@@ -685,6 +686,7 @@ void RenderView::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences)
IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL)
IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin)
+ IPC_MESSAGE_HANDLER(ViewMsg_LoadBlockedPlugins, OnLoadBlockedPlugins)
IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse)
IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode)
IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage,
@@ -3985,6 +3987,12 @@ void RenderView::OnInstallMissingPlugin() {
first_default_plugin_->InstallMissingPlugin();
}
+void RenderView::OnLoadBlockedPlugins() {
+ NotificationService::current()->Notify(NotificationType::SHOULD_LOAD_PLUGINS,
+ Source<RenderView>(this),
+ NotificationService::NoDetails());
+}
+
void RenderView::OnFileChooserResponse(const std::vector<FilePath>& paths) {
// This could happen if we navigated to a different page before the user
// closed the chooser.
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 6e2a43b..82a293a 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -765,6 +765,7 @@ class RenderView : public RenderWidget,
const std::string& origin,
const std::string& target);
void OnInstallMissingPlugin();
+ void OnLoadBlockedPlugins();
void OnMediaPlayerActionAt(const gfx::Point& location,
const WebKit::WebMediaPlayerAction& action);
void OnMoveOrResizeStarted();