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

Side by Side Diff: chrome/renderer/plugins/non_loadable_plugin_placeholder.cc

Issue 1126073003: Plugin Placeholders: Refactor for platforms that don't support plugins (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: The version that was reverted. Created 5 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/renderer/plugins/non_loadable_plugin_placeholder.h"
6
7 #include "base/files/file_path.h"
8 #include "base/values.h"
9 #include "chrome/common/render_messages.h"
10 #include "chrome/grit/generated_resources.h"
11 #include "chrome/grit/renderer_resources.h"
12 #include "components/plugins/renderer/plugin_placeholder.h"
13 #include "content/app/strings/grit/content_strings.h"
14 #include "content/public/renderer/render_thread.h"
15 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/base/webui/jstemplate_builder.h"
18
19 // static
20 plugins::PluginPlaceholder*
21 NonLoadablePluginPlaceholder::CreateNotSupportedPlugin(
22 content::RenderFrame* render_frame,
23 blink::WebLocalFrame* frame,
24 const blink::WebPluginParams& params) {
25 const base::StringPiece template_html(
26 ResourceBundle::GetSharedInstance().GetRawDataResource(
27 IDR_BLOCKED_PLUGIN_HTML));
28
29 base::DictionaryValue values;
30 values.SetString("message",
31 l10n_util::GetStringUTF8(IDS_PLUGIN_NOT_SUPPORTED));
32
33 std::string html_data = webui::GetI18nTemplateHtml(template_html, &values);
34
35 // PluginPlaceholder will destroy itself when its WebViewPlugin is going away.
36 return new plugins::PluginPlaceholder(render_frame, frame, params, html_data);
37 }
38
39 // static
40 plugins::PluginPlaceholder* NonLoadablePluginPlaceholder::CreateErrorPlugin(
41 content::RenderFrame* render_frame,
42 const base::FilePath& file_path) {
43 base::DictionaryValue values;
44 values.SetString("message",
45 l10n_util::GetStringUTF8(IDS_PLUGIN_INITIALIZATION_ERROR));
46
47 const base::StringPiece template_html(
48 ResourceBundle::GetSharedInstance().GetRawDataResource(
49 IDR_BLOCKED_PLUGIN_HTML));
50 std::string html_data = webui::GetI18nTemplateHtml(template_html, &values);
51
52 blink::WebPluginParams params;
53 // PluginPlaceholder will destroy itself when its WebViewPlugin is going away.
54 plugins::PluginPlaceholder* plugin =
55 new plugins::PluginPlaceholder(render_frame, nullptr, params, html_data);
56
57 content::RenderThread::Get()->Send(new ChromeViewHostMsg_CouldNotLoadPlugin(
58 plugin->routing_id(), file_path));
59 return plugin;
60 }
OLDNEW
« no previous file with comments | « chrome/renderer/plugins/non_loadable_plugin_placeholder.h ('k') | chrome/renderer/plugins/plugin_preroller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698