summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/blocked_plugin.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/renderer/blocked_plugin.cc')
-rw-r--r--chrome/renderer/blocked_plugin.cc49
1 files changed, 11 insertions, 38 deletions
diff --git a/chrome/renderer/blocked_plugin.cc b/chrome/renderer/blocked_plugin.cc
index 57d342b..07ff93c 100644
--- a/chrome/renderer/blocked_plugin.cc
+++ b/chrome/renderer/blocked_plugin.cc
@@ -18,32 +18,25 @@
#include "third_party/WebKit/WebKit/chromium/public/WebData.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
#include "third_party/WebKit/WebKit/chromium/public/WebView.h"
#include "webkit/glue/plugins/webview_plugin.h"
+#include "webkit/glue/webpreferences.h"
-using WebKit::WebCursorInfo;
using WebKit::WebFrame;
using WebKit::WebPlugin;
using WebKit::WebPluginContainer;
using WebKit::WebPluginParams;
-using WebKit::WebURL;
-using WebKit::WebView;
static const char* const kBlockedPluginDataURL = "chrome://blockedplugindata/";
BlockedPlugin::BlockedPlugin(RenderView* render_view,
WebFrame* frame,
const WebPluginParams& params,
+ const WebPreferences& preferences,
PluginGroup* group)
: render_view_(render_view),
frame_(frame),
plugin_params_(params) {
- plugin_ = new WebViewPlugin(this);
-
- WebView* web_view = plugin_->web_view();
- web_view->mainFrame()->setCanHaveScrollbars(false);
-
int resource_id = IDR_BLOCKED_PLUGIN_HTML;
const base::StringPiece template_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id));
@@ -52,31 +45,28 @@ BlockedPlugin::BlockedPlugin(RenderView* render_view,
<< resource_id;
DictionaryValue values;
- values.SetString("loadPlugin",
- l10n_util::GetStringUTF16(IDS_PLUGIN_LOAD));
- values.SetString("updatePlugin",
- l10n_util::GetStringUTF16(IDS_PLUGIN_UPDATE));
- values.SetString("message",
- l10n_util::GetStringUTF16(IDS_BLOCKED_PLUGINS_MESSAGE));
- if (group)
- values.Set("pluginGroup", group->GetDataForUI());
+ values.SetString("loadPlugin", l10n_util::GetStringUTF16(IDS_PLUGIN_LOAD));
+ values.Set("pluginGroup", group->GetDataForUI());
// "t" is the id of the templates root node.
- std::string htmlData = jstemplate_builder::GetTemplatesHtml(
+ std::string html_data = jstemplate_builder::GetTemplatesHtml(
template_html, &values, "t");
- web_view->mainFrame()->loadHTMLString(htmlData,
- GURL(kBlockedPluginDataURL));
+ plugin_ = WebViewPlugin::Create(this,
+ preferences,
+ html_data,
+ GURL(kBlockedPluginDataURL));
registrar_.Add(this,
NotificationType::SHOULD_LOAD_PLUGINS,
NotificationService::AllSources());
}
+BlockedPlugin::~BlockedPlugin() {}
+
void BlockedPlugin::BindWebFrame(WebFrame* frame) {
BindToJavascript(frame, L"plugin");
BindMethod("load", &BlockedPlugin::Load);
- BindMethod("update", &BlockedPlugin::Update);
}
void BlockedPlugin::WillDestroyPlugin() {
@@ -97,23 +87,6 @@ void BlockedPlugin::Load(const CppArgumentList& args, CppVariant* result) {
LoadPlugin();
}
-void BlockedPlugin::Update(const CppArgumentList& args, CppVariant* result) {
- if (args.size() > 0) {
- CppVariant arg(args[0]);
- if (arg.isString()) {
- GURL url(arg.ToString());
- OpenURL(url);
- }
- }
-}
-
-void BlockedPlugin::OpenURL(GURL& url) {
- render_view_->Send(new ViewHostMsg_OpenURL(render_view_->routing_id(),
- url,
- GURL(),
- CURRENT_TAB));
-}
-
void BlockedPlugin::LoadPlugin() {
CHECK(plugin_);
WebPluginContainer* container = plugin_->container();