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: Created 5 years, 7 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 plugins::PluginPlaceholder* CreateMissingPluginPlaceholder(
Bernhard Bauer 2015/05/16 00:22:21 Would it make sense to name this method CreateNotS
tommycli 2015/05/18 21:12:42 Done.
20 content::RenderFrame* render_frame,
21 blink::WebLocalFrame* frame,
22 const blink::WebPluginParams& params) {
23 const base::StringPiece template_html(
24 ResourceBundle::GetSharedInstance().GetRawDataResource(
25 IDR_BLOCKED_PLUGIN_HTML));
26
27 base::DictionaryValue values;
28 values.SetString("message",
29 l10n_util::GetStringUTF8(IDS_PLUGIN_NOT_SUPPORTED));
30
31 std::string html_data = webui::GetI18nTemplateHtml(template_html, &values);
32
33 // PluginPlaceholder will destroy itself when its WebViewPlugin is going away.
34 return new plugins::PluginPlaceholder(render_frame, frame, params, html_data);
35 }
36
37 plugins::PluginPlaceholder* CreateErrorPluginPlaceholder(
38 content::RenderFrame* render_frame,
39 const base::FilePath& file_path) {
40 base::DictionaryValue values;
41 values.SetString("message",
42 l10n_util::GetStringUTF8(IDS_PLUGIN_INITIALIZATION_ERROR));
43
44 const base::StringPiece template_html(
45 ResourceBundle::GetSharedInstance().GetRawDataResource(
46 IDR_BLOCKED_PLUGIN_HTML));
47 std::string html_data = webui::GetI18nTemplateHtml(template_html, &values);
48
49 blink::WebPluginParams params;
50 // PluginPlaceholder will destroy itself when its WebViewPlugin is going away.
51 plugins::PluginPlaceholder* plugin =
52 new plugins::PluginPlaceholder(render_frame, NULL, params, html_data);
Bernhard Bauer 2015/05/16 00:22:21 Use nullptr instead of NULL.
tommycli 2015/05/18 21:12:42 Done.
53
54 content::RenderThread::Get()->Send(new ChromeViewHostMsg_CouldNotLoadPlugin(
55 plugin->routing_id(), file_path));
56 return plugin;
57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698