OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chrome_plugin_placeholder.h" | 5 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/common/prerender_messages.h" | 9 #include "chrome/common/prerender_messages.h" |
10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } // namespace | 44 } // namespace |
45 | 45 |
46 const char ChromePluginPlaceholder::kPluginPlaceholderDataURL[] = | 46 const char ChromePluginPlaceholder::kPluginPlaceholderDataURL[] = |
47 "chrome://pluginplaceholderdata/"; | 47 "chrome://pluginplaceholderdata/"; |
48 | 48 |
49 ChromePluginPlaceholder::ChromePluginPlaceholder( | 49 ChromePluginPlaceholder::ChromePluginPlaceholder( |
50 content::RenderView* render_view, | 50 content::RenderView* render_view, |
51 blink::WebFrame* frame, | 51 blink::WebFrame* frame, |
52 const blink::WebPluginParams& params, | 52 const blink::WebPluginParams& params, |
53 const std::string& html_data, | 53 const std::string& html_data, |
54 const string16& title) | 54 const base::string16& title) |
55 : plugins::PluginPlaceholder(render_view, | 55 : plugins::PluginPlaceholder(render_view, |
56 frame, | 56 frame, |
57 params, | 57 params, |
58 html_data, | 58 html_data, |
59 GURL(kPluginPlaceholderDataURL)), | 59 GURL(kPluginPlaceholderDataURL)), |
60 status_(new ChromeViewHostMsg_GetPluginInfo_Status), | 60 status_(new ChromeViewHostMsg_GetPluginInfo_Status), |
61 title_(title), | 61 title_(title), |
62 #if defined(ENABLE_PLUGIN_INSTALLATION) | 62 #if defined(ENABLE_PLUGIN_INSTALLATION) |
63 placeholder_routing_id_(MSG_ROUTING_NONE), | 63 placeholder_routing_id_(MSG_ROUTING_NONE), |
64 #endif | 64 #endif |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 return plugin; | 138 return plugin; |
139 } | 139 } |
140 | 140 |
141 // static | 141 // static |
142 ChromePluginPlaceholder* ChromePluginPlaceholder::CreateBlockedPlugin( | 142 ChromePluginPlaceholder* ChromePluginPlaceholder::CreateBlockedPlugin( |
143 RenderView* render_view, | 143 RenderView* render_view, |
144 WebFrame* frame, | 144 WebFrame* frame, |
145 const WebPluginParams& params, | 145 const WebPluginParams& params, |
146 const content::WebPluginInfo& plugin, | 146 const content::WebPluginInfo& plugin, |
147 const std::string& identifier, | 147 const std::string& identifier, |
148 const string16& name, | 148 const base::string16& name, |
149 int template_id, | 149 int template_id, |
150 const string16& message) { | 150 const base::string16& message) { |
151 base::DictionaryValue values; | 151 base::DictionaryValue values; |
152 values.SetString("message", message); | 152 values.SetString("message", message); |
153 values.SetString("name", name); | 153 values.SetString("name", name); |
154 values.SetString("hide", l10n_util::GetStringUTF8(IDS_PLUGIN_HIDE)); | 154 values.SetString("hide", l10n_util::GetStringUTF8(IDS_PLUGIN_HIDE)); |
155 | 155 |
156 const base::StringPiece template_html( | 156 const base::StringPiece template_html( |
157 ResourceBundle::GetSharedInstance().GetRawDataResource(template_id)); | 157 ResourceBundle::GetSharedInstance().GetRawDataResource(template_id)); |
158 | 158 |
159 DCHECK(!template_html.empty()) << "unable to load template. ID: " | 159 DCHECK(!template_html.empty()) << "unable to load template. ID: " |
160 << template_id; | 160 << template_id; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 void ChromePluginPlaceholder::OnSetIsPrerendering(bool is_prerendering) { | 228 void ChromePluginPlaceholder::OnSetIsPrerendering(bool is_prerendering) { |
229 plugins::PluginPlaceholder::OnSetIsPrerendering(is_prerendering); | 229 plugins::PluginPlaceholder::OnSetIsPrerendering(is_prerendering); |
230 } | 230 } |
231 | 231 |
232 #if defined(ENABLE_PLUGIN_INSTALLATION) | 232 #if defined(ENABLE_PLUGIN_INSTALLATION) |
233 void ChromePluginPlaceholder::OnDidNotFindMissingPlugin() { | 233 void ChromePluginPlaceholder::OnDidNotFindMissingPlugin() { |
234 SetMessage(l10n_util::GetStringUTF16(IDS_PLUGIN_NOT_FOUND)); | 234 SetMessage(l10n_util::GetStringUTF16(IDS_PLUGIN_NOT_FOUND)); |
235 } | 235 } |
236 | 236 |
237 void ChromePluginPlaceholder::OnFoundMissingPlugin( | 237 void ChromePluginPlaceholder::OnFoundMissingPlugin( |
238 const string16& plugin_name) { | 238 const base::string16& plugin_name) { |
239 if (status_->value == ChromeViewHostMsg_GetPluginInfo_Status::kNotFound) | 239 if (status_->value == ChromeViewHostMsg_GetPluginInfo_Status::kNotFound) |
240 SetMessage(l10n_util::GetStringFUTF16(IDS_PLUGIN_FOUND, plugin_name)); | 240 SetMessage(l10n_util::GetStringFUTF16(IDS_PLUGIN_FOUND, plugin_name)); |
241 has_host_ = true; | 241 has_host_ = true; |
242 plugin_name_ = plugin_name; | 242 plugin_name_ = plugin_name; |
243 } | 243 } |
244 | 244 |
245 void ChromePluginPlaceholder::OnStartedDownloadingPlugin() { | 245 void ChromePluginPlaceholder::OnStartedDownloadingPlugin() { |
246 SetMessage(l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOADING, plugin_name_)); | 246 SetMessage(l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOADING, plugin_name_)); |
247 } | 247 } |
248 | 248 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 context_menu_request_id_ = render_view()->ShowContextMenu(this, params); | 352 context_menu_request_id_ = render_view()->ShowContextMenu(this, params); |
353 g_last_active_menu = this; | 353 g_last_active_menu = this; |
354 } | 354 } |
355 | 355 |
356 void ChromePluginPlaceholder::BindWebFrame(blink::WebFrame* frame) { | 356 void ChromePluginPlaceholder::BindWebFrame(blink::WebFrame* frame) { |
357 plugins::PluginPlaceholder::BindWebFrame(frame); | 357 plugins::PluginPlaceholder::BindWebFrame(frame); |
358 BindCallback("openAboutPlugins", | 358 BindCallback("openAboutPlugins", |
359 base::Bind(&ChromePluginPlaceholder::OpenAboutPluginsCallback, | 359 base::Bind(&ChromePluginPlaceholder::OpenAboutPluginsCallback, |
360 base::Unretained(this))); | 360 base::Unretained(this))); |
361 } | 361 } |
OLD | NEW |