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" |
11 #include "chrome/renderer/chrome_content_renderer_client.h" | 11 #include "chrome/renderer/chrome_content_renderer_client.h" |
12 #include "chrome/renderer/custom_menu_commands.h" | 12 #include "chrome/renderer/custom_menu_commands.h" |
13 #include "chrome/renderer/plugins/plugin_uma.h" | 13 #include "chrome/renderer/plugins/plugin_uma.h" |
14 #include "content/public/common/context_menu_params.h" | 14 #include "content/public/common/context_menu_params.h" |
| 15 #include "content/public/renderer/render_frame.h" |
15 #include "content/public/renderer/render_thread.h" | 16 #include "content/public/renderer/render_thread.h" |
16 #include "content/public/renderer/render_view.h" | 17 #include "content/public/renderer/render_view.h" |
17 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
18 #include "grit/renderer_resources.h" | 19 #include "grit/renderer_resources.h" |
19 #include "grit/webkit_strings.h" | 20 #include "grit/webkit_strings.h" |
20 #include "third_party/WebKit/public/web/WebDocument.h" | 21 #include "third_party/WebKit/public/web/WebDocument.h" |
21 #include "third_party/WebKit/public/web/WebFrame.h" | 22 #include "third_party/WebKit/public/web/WebFrame.h" |
22 #include "third_party/WebKit/public/web/WebInputEvent.h" | 23 #include "third_party/WebKit/public/web/WebInputEvent.h" |
23 #include "third_party/WebKit/public/web/WebScriptSource.h" | 24 #include "third_party/WebKit/public/web/WebScriptSource.h" |
24 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 void ChromePluginPlaceholder::PluginListChanged() { | 275 void ChromePluginPlaceholder::PluginListChanged() { |
275 if (!GetFrame()) | 276 if (!GetFrame()) |
276 return; | 277 return; |
277 WebDocument document = GetFrame()->top()->document(); | 278 WebDocument document = GetFrame()->top()->document(); |
278 if (document.isNull()) | 279 if (document.isNull()) |
279 return; | 280 return; |
280 | 281 |
281 ChromeViewHostMsg_GetPluginInfo_Output output; | 282 ChromeViewHostMsg_GetPluginInfo_Output output; |
282 std::string mime_type(GetPluginParams().mimeType.utf8()); | 283 std::string mime_type(GetPluginParams().mimeType.utf8()); |
283 render_view()->Send( | 284 render_view()->Send( |
284 new ChromeViewHostMsg_GetPluginInfo(routing_id(), | 285 new ChromeViewHostMsg_GetPluginInfo(GetRenderFrame()->GetRoutingID(), |
285 GURL(GetPluginParams().url), | 286 GURL(GetPluginParams().url), |
286 document.url(), | 287 document.url(), |
287 mime_type, | 288 mime_type, |
288 &output)); | 289 &output)); |
289 if (output.status.value == status_->value) | 290 if (output.status.value == status_->value) |
290 return; | 291 return; |
291 WebPlugin* new_plugin = ChromeContentRendererClient::CreatePlugin( | 292 WebPlugin* new_plugin = ChromeContentRendererClient::CreatePlugin( |
292 render_view(), GetRenderFrame(), GetFrame(), GetPluginParams(), output); | 293 render_view(), GetRenderFrame(), GetFrame(), GetPluginParams(), output); |
293 ReplacePlugin(new_plugin); | 294 ReplacePlugin(new_plugin); |
294 if (!new_plugin) { | 295 if (!new_plugin) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 context_menu_request_id_ = render_view()->ShowContextMenu(this, params); | 358 context_menu_request_id_ = render_view()->ShowContextMenu(this, params); |
358 g_last_active_menu = this; | 359 g_last_active_menu = this; |
359 } | 360 } |
360 | 361 |
361 void ChromePluginPlaceholder::BindWebFrame(blink::WebFrame* frame) { | 362 void ChromePluginPlaceholder::BindWebFrame(blink::WebFrame* frame) { |
362 plugins::PluginPlaceholder::BindWebFrame(frame); | 363 plugins::PluginPlaceholder::BindWebFrame(frame); |
363 BindCallback("openAboutPlugins", | 364 BindCallback("openAboutPlugins", |
364 base::Bind(&ChromePluginPlaceholder::OpenAboutPluginsCallback, | 365 base::Bind(&ChromePluginPlaceholder::OpenAboutPluginsCallback, |
365 base::Unretained(this))); | 366 base::Unretained(this))); |
366 } | 367 } |
OLD | NEW |