Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5385)

Unified Diff: chrome/browser/plugins/plugin_observer.cc

Issue 2972123002: Click to Open PDF: Open PDF once View PDF is clicked. (Closed)
Patch Set: Grammar Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/plugins/plugin_observer.h ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
+}
« no previous file with comments | « chrome/browser/plugins/plugin_observer.h ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698