Index: chrome/browser/plugins/plugin_observer.cc |
diff --git a/chrome/browser/plugins/plugin_observer.cc b/chrome/browser/plugins/plugin_observer.cc |
index 6f939ac790ca9b8ad9b3fabee2019b5bf5470162..f5a46fae5ab1b8ee4d29ec5fa7f7ec85a76beebe 100644 |
--- a/chrome/browser/plugins/plugin_observer.cc |
+++ b/chrome/browser/plugins/plugin_observer.cc |
@@ -36,6 +36,7 @@ |
#include "components/infobars/core/simple_alert_infobar_delegate.h" |
#include "components/metrics_services_manager/metrics_services_manager.h" |
#include "content/public/browser/browser_thread.h" |
+#include "content/public/browser/child_process_security_policy.h" |
#include "content/public/browser/plugin_service.h" |
#include "content/public/browser/render_frame_host.h" |
#include "content/public/browser/render_view_host.h" |
@@ -256,6 +257,7 @@ void PluginObserver::PluginCrashed(const base::FilePath& plugin_path, |
bool PluginObserver::OnMessageReceived( |
const IPC::Message& message, |
content::RenderFrameHost* render_frame_host) { |
+ bool handled = true; |
IPC_BEGIN_MESSAGE_MAP(PluginObserver, message) |
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedOutdatedPlugin, |
OnBlockedOutdatedPlugin) |
@@ -267,7 +269,14 @@ bool PluginObserver::OnMessageReceived( |
OnShowFlashPermissionBubble) |
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_CouldNotLoadPlugin, |
OnCouldNotLoadPlugin) |
+ IPC_MESSAGE_UNHANDLED(handled = false) |
+ IPC_END_MESSAGE_MAP() |
+ |
+ if (handled) |
+ return true; |
+ IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(PluginObserver, message, render_frame_host) |
+ IPC_MESSAGE_HANDLER(ChromeViewHostMsg_OpenPDF, OnOpenPDF) |
IPC_MESSAGE_UNHANDLED(return false) |
IPC_END_MESSAGE_MAP() |
@@ -335,3 +344,18 @@ void PluginObserver::OnCouldNotLoadPlugin(const base::FilePath& plugin_path) { |
plugin_name), |
true); |
} |
+ |
+void PluginObserver::OnOpenPDF(content::RenderFrameHost* render_frame_host, |
+ const GURL& url) { |
+ if (!content::ChildProcessSecurityPolicy::GetInstance()->CanRequestURL( |
+ render_frame_host->GetRoutingID(), url)) |
+ return; |
+ |
+ web_contents()->OpenURL(content::OpenURLParams( |
+ url, |
+ content::Referrer::SanitizeForRequest( |
+ url, content::Referrer(web_contents()->GetURL(), |
+ blink::kWebReferrerPolicyDefault)), |
+ WindowOpenDisposition::NEW_FOREGROUND_TAB, |
+ ui::PAGE_TRANSITION_AUTO_BOOKMARK, false)); |
+} |