| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 #include "third_party/WebKit/public/web/WebDocument.h" | 109 #include "third_party/WebKit/public/web/WebDocument.h" |
| 110 #include "third_party/WebKit/public/web/WebElement.h" | 110 #include "third_party/WebKit/public/web/WebElement.h" |
| 111 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 111 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 112 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 112 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
| 113 #include "third_party/WebKit/public/web/WebPluginParams.h" | 113 #include "third_party/WebKit/public/web/WebPluginParams.h" |
| 114 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 114 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
| 115 #include "ui/base/l10n/l10n_util.h" | 115 #include "ui/base/l10n/l10n_util.h" |
| 116 #include "ui/base/layout.h" | 116 #include "ui/base/layout.h" |
| 117 #include "ui/base/resource/resource_bundle.h" | 117 #include "ui/base/resource/resource_bundle.h" |
| 118 #include "ui/base/webui/jstemplate_builder.h" | 118 #include "ui/base/webui/jstemplate_builder.h" |
| 119 #include "url/origin.h" |
| 119 | 120 |
| 120 #if !defined(DISABLE_NACL) | 121 #if !defined(DISABLE_NACL) |
| 121 #include "components/nacl/common/nacl_constants.h" | 122 #include "components/nacl/common/nacl_constants.h" |
| 122 #include "components/nacl/renderer/nacl_helper.h" | 123 #include "components/nacl/renderer/nacl_helper.h" |
| 123 #endif | 124 #endif |
| 124 | 125 |
| 125 #if defined(ENABLE_EXTENSIONS) | 126 #if defined(ENABLE_EXTENSIONS) |
| 126 #include "chrome/common/extensions/chrome_extensions_client.h" | 127 #include "chrome/common/extensions/chrome_extensions_client.h" |
| 127 #include "chrome/renderer/extensions/chrome_extensions_renderer_client.h" | 128 #include "chrome/renderer/extensions/chrome_extensions_renderer_client.h" |
| 128 #include "extensions/common/extension_urls.h" | 129 #include "extensions/common/extension_urls.h" |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 #if defined(ENABLE_EXTENSIONS) | 557 #if defined(ENABLE_EXTENSIONS) |
| 557 if (!ChromeExtensionsRendererClient::GetInstance()->OverrideCreatePlugin( | 558 if (!ChromeExtensionsRendererClient::GetInstance()->OverrideCreatePlugin( |
| 558 render_frame, params)) { | 559 render_frame, params)) { |
| 559 return false; | 560 return false; |
| 560 } | 561 } |
| 561 #endif | 562 #endif |
| 562 | 563 |
| 563 GURL url(params.url); | 564 GURL url(params.url); |
| 564 #if defined(ENABLE_PLUGINS) | 565 #if defined(ENABLE_PLUGINS) |
| 565 ChromeViewHostMsg_GetPluginInfo_Output output; | 566 ChromeViewHostMsg_GetPluginInfo_Output output; |
| 566 WebString top_origin = frame->top()->getSecurityOrigin().toString(); | |
| 567 render_frame->Send(new ChromeViewHostMsg_GetPluginInfo( | 567 render_frame->Send(new ChromeViewHostMsg_GetPluginInfo( |
| 568 render_frame->GetRoutingID(), url, blink::WebStringToGURL(top_origin), | 568 render_frame->GetRoutingID(), url, |
| 569 orig_mime_type, &output)); | 569 url::Origin(frame->top()->getSecurityOrigin()).GetURL(), orig_mime_type, |
| 570 &output)); |
| 570 *plugin = CreatePlugin(render_frame, frame, params, output); | 571 *plugin = CreatePlugin(render_frame, frame, params, output); |
| 571 #else // !defined(ENABLE_PLUGINS) | 572 #else // !defined(ENABLE_PLUGINS) |
| 572 | 573 |
| 573 #if defined(OS_ANDROID) | 574 #if defined(OS_ANDROID) |
| 574 if (plugins::MobileYouTubePlugin::IsYouTubeURL(url, orig_mime_type)) { | 575 if (plugins::MobileYouTubePlugin::IsYouTubeURL(url, orig_mime_type)) { |
| 575 base::StringPiece template_html( | 576 base::StringPiece template_html( |
| 576 ResourceBundle::GetSharedInstance().GetRawDataResource( | 577 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 577 IDR_MOBILE_YOUTUBE_PLUGIN_HTML)); | 578 IDR_MOBILE_YOUTUBE_PLUGIN_HTML)); |
| 578 *plugin = (new plugins::MobileYouTubePlugin(render_frame, frame, params, | 579 *plugin = (new plugins::MobileYouTubePlugin(render_frame, frame, params, |
| 579 template_html))->plugin(); | 580 template_html))->plugin(); |
| (...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1469 | 1470 |
| 1470 url::Replacements<char> r; | 1471 url::Replacements<char> r; |
| 1471 r.SetPath(path.c_str(), url::Component(0, path.length())); | 1472 r.SetPath(path.c_str(), url::Component(0, path.length())); |
| 1472 | 1473 |
| 1473 if (result == internal::NUM_PLUGIN_ERROR) | 1474 if (result == internal::NUM_PLUGIN_ERROR) |
| 1474 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS; | 1475 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS; |
| 1475 | 1476 |
| 1476 RecordYouTubeRewriteUMA(result); | 1477 RecordYouTubeRewriteUMA(result); |
| 1477 return corrected_url.ReplaceComponents(r); | 1478 return corrected_url.ReplaceComponents(r); |
| 1478 } | 1479 } |
| OLD | NEW |