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..a7c310f9b6ba914171edae7543a13045639c19bb 100644 |
--- a/chrome/browser/plugins/plugin_observer.cc |
+++ b/chrome/browser/plugins/plugin_observer.cc |
@@ -267,6 +267,7 @@ bool PluginObserver::OnMessageReceived( |
OnShowFlashPermissionBubble) |
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_CouldNotLoadPlugin, |
OnCouldNotLoadPlugin) |
+ IPC_MESSAGE_HANDLER(ChromeViewHostMsg_OpenPDF, OnOpenPDF) |
IPC_MESSAGE_UNHANDLED(return false) |
IPC_END_MESSAGE_MAP() |
@@ -335,3 +336,16 @@ void PluginObserver::OnCouldNotLoadPlugin(const base::FilePath& plugin_path) { |
plugin_name), |
true); |
} |
+ |
+void PluginObserver::OnOpenPDF(const GURL& url) { |
+ if (!url.SchemeIsHTTPOrHTTPS()) |
Lei Zhang
2017/07/12 22:57:30
What about ftp://, or file:// ? The latter works f
dcheng
2017/07/12 23:04:22
I think we should be using ChildProcessSecurityPol
tommycli
2017/07/12 23:05:15
Awesome thank dcheng, i did not know about that me
amberwon
2017/07/13 20:33:54
Done.
|
+ 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)); |
+} |