Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6596)

Unified Diff: chrome/renderer/plugins/plugin_placeholder.cc

Issue 10093011: Show a replacement plug-in for loading errors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/plugins/plugin_placeholder.h ('k') | content/public/renderer/content_renderer_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/plugins/plugin_placeholder.cc
diff --git a/chrome/renderer/plugins/plugin_placeholder.cc b/chrome/renderer/plugins/plugin_placeholder.cc
index c0a09a9c46ffa54350bed72ac1499adce3fdd5ee..595bb98aa846f82e012ddb0f81aae9671e8ae605 100644
--- a/chrome/renderer/plugins/plugin_placeholder.cc
+++ b/chrome/renderer/plugins/plugin_placeholder.cc
@@ -21,6 +21,7 @@
#include "content/public/renderer/render_view.h"
#include "grit/generated_resources.h"
#include "grit/renderer_resources.h"
+#include "grit/webkit_strings.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
@@ -39,6 +40,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "webkit/glue/webpreferences.h"
#include "webkit/plugins/npapi/plugin_group.h"
+#include "webkit/plugins/npapi/plugin_list.h"
#include "webkit/plugins/webview_plugin.h"
using content::RenderThread;
@@ -97,6 +99,28 @@ PluginPlaceholder* PluginPlaceholder::CreateMissingPlugin(
return missing_plugin;
}
+PluginPlaceholder* PluginPlaceholder::CreateErrorPlugin(
+ RenderView* render_view,
+ const FilePath& file_path) {
+ DictionaryValue values;
+ values.SetString("message",
+ l10n_util::GetStringUTF8(IDS_PLUGIN_INITIALIZATION_ERROR));
+
+ const base::StringPiece template_html(
+ ResourceBundle::GetSharedInstance().GetRawDataResource(
+ IDR_BLOCKED_PLUGIN_HTML));
+ std::string html_data =
+ jstemplate_builder::GetI18nTemplateHtml(template_html, &values);
+
+ WebPluginParams params;
+ // |missing_plugin| will destroy itself when its WebViewPlugin is going away.
+ PluginPlaceholder* plugin = new PluginPlaceholder(
+ render_view, NULL, params, html_data, params.mimeType);
+ plugin->set_allow_loading(true);
+
+ return plugin;
+}
+
// static
PluginPlaceholder* PluginPlaceholder::CreateBlockedPlugin(
RenderView* render_view,
« no previous file with comments | « chrome/renderer/plugins/plugin_placeholder.h ('k') | content/public/renderer/content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698