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

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

Issue 2733083004: Emit error events if the loading of an object element failed (Closed)
Patch Set: Emit error events if the loading of an object element failed Created 3 years, 9 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/plugins/non_loadable_plugin_placeholder.h" 5 #include "chrome/renderer/plugins/non_loadable_plugin_placeholder.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/common/render_messages.h" 9 #include "chrome/common/render_messages.h"
10 #include "chrome/grit/generated_resources.h" 10 #include "chrome/grit/generated_resources.h"
(...skipping 15 matching lines...) Expand all
26 const base::StringPiece template_html( 26 const base::StringPiece template_html(
27 ResourceBundle::GetSharedInstance().GetRawDataResource( 27 ResourceBundle::GetSharedInstance().GetRawDataResource(
28 IDR_BLOCKED_PLUGIN_HTML)); 28 IDR_BLOCKED_PLUGIN_HTML));
29 29
30 base::DictionaryValue values; 30 base::DictionaryValue values;
31 values.SetString("message", 31 values.SetString("message",
32 l10n_util::GetStringUTF8(IDS_PLUGIN_NOT_SUPPORTED)); 32 l10n_util::GetStringUTF8(IDS_PLUGIN_NOT_SUPPORTED));
33 33
34 std::string html_data = webui::GetI18nTemplateHtml(template_html, &values); 34 std::string html_data = webui::GetI18nTemplateHtml(template_html, &values);
35 35
36 plugins::PluginPlaceholder* plugin =
37 new plugins::PluginPlaceholder(render_frame, frame, params, html_data);
38
39 plugin->plugin()->markAsErrorPlaceholder();
40
36 // PluginPlaceholder will destroy itself when its WebViewPlugin is going away. 41 // PluginPlaceholder will destroy itself when its WebViewPlugin is going away.
37 return new plugins::PluginPlaceholder(render_frame, frame, params, html_data); 42 return plugin;
38 } 43 }
39 44
40 // static 45 // static
41 plugins::PluginPlaceholder* NonLoadablePluginPlaceholder::CreateErrorPlugin( 46 plugins::PluginPlaceholder* NonLoadablePluginPlaceholder::CreateErrorPlugin(
42 content::RenderFrame* render_frame, 47 content::RenderFrame* render_frame,
43 const base::FilePath& file_path) { 48 const base::FilePath& file_path) {
44 base::DictionaryValue values; 49 base::DictionaryValue values;
45 values.SetString("message", 50 values.SetString("message",
46 l10n_util::GetStringUTF8(IDS_PLUGIN_INITIALIZATION_ERROR)); 51 l10n_util::GetStringUTF8(IDS_PLUGIN_INITIALIZATION_ERROR));
47 52
48 const base::StringPiece template_html( 53 const base::StringPiece template_html(
49 ResourceBundle::GetSharedInstance().GetRawDataResource( 54 ResourceBundle::GetSharedInstance().GetRawDataResource(
50 IDR_BLOCKED_PLUGIN_HTML)); 55 IDR_BLOCKED_PLUGIN_HTML));
51 std::string html_data = webui::GetI18nTemplateHtml(template_html, &values); 56 std::string html_data = webui::GetI18nTemplateHtml(template_html, &values);
52 57
53 blink::WebPluginParams params; 58 blink::WebPluginParams params;
54 // PluginPlaceholder will destroy itself when its WebViewPlugin is going away. 59 // PluginPlaceholder will destroy itself when its WebViewPlugin is going away.
55 plugins::PluginPlaceholder* plugin = 60 plugins::PluginPlaceholder* plugin =
56 new plugins::PluginPlaceholder(render_frame, nullptr, params, html_data); 61 new plugins::PluginPlaceholder(render_frame, nullptr, params, html_data);
57 62
63 plugin->plugin()->markAsErrorPlaceholder();
64
58 content::RenderThread::Get()->Send(new ChromeViewHostMsg_CouldNotLoadPlugin( 65 content::RenderThread::Get()->Send(new ChromeViewHostMsg_CouldNotLoadPlugin(
59 plugin->routing_id(), file_path)); 66 plugin->routing_id(), file_path));
60 return plugin; 67 return plugin;
61 } 68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698