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

Unified Diff: chrome/browser/ui/android/external_protocol_dialog_android.cc

Issue 1091253008: Fix an issue that external protocol in subframes are not handled on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
Index: chrome/browser/ui/android/external_protocol_dialog_android.cc
diff --git a/chrome/browser/ui/android/external_protocol_dialog_android.cc b/chrome/browser/ui/android/external_protocol_dialog_android.cc
index 6362e6c40536810c189baf20b4345576122aea90..2c2e70207be4628528b781e0b3aa92e7bd3e789d 100644
--- a/chrome/browser/ui/android/external_protocol_dialog_android.cc
+++ b/chrome/browser/ui/android/external_protocol_dialog_android.cc
@@ -5,13 +5,36 @@
#include "chrome/browser/external_protocol/external_protocol_handler.h"
#include "base/logging.h"
+#include "chrome/browser/external_protocol/external_protocol_handler.h"
+#include "chrome/browser/tab_contents/tab_util.h"
+#include "components/navigation_interception/intercept_navigation_delegate.h"
+#include "components/navigation_interception/navigation_params.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/common/referrer.h"
+#include "ui/base/page_transition_types.h"
+
+using content::WebContents;
// static
void ExternalProtocolHandler::RunExternalProtocolDialog(
- const GURL& url, int render_process_host_id, int routing_id) {
- // Chrome on Android uses a throttle-based mechansim to intercept links
- // so that the user may choose to run an Android application instead of
- // loading the link in the browser. The throttle is also used to handle
- // external protocols, so this code should not be reachable.
- NOTREACHED();
+ const GURL& url, int render_process_host_id, int routing_id,
+ ui::PageTransition page_transition) {
+ WebContents* web_contents = tab_util::GetWebContentsByID(
+ render_process_host_id, routing_id);
+ if (!web_contents)
+ return;
+ navigation_interception::InterceptNavigationDelegate* delegate =
+ navigation_interception::InterceptNavigationDelegate::Get(web_contents);
+ if (!delegate)
+ return;
+
+ navigation_interception::NavigationParams navigation_params(
+ url,
+ content::Referrer(),
+ true, // has_user_gesture
+ false, // is_post, doesn't matter here.
+ page_transition,
+ false, // is_redirect, doesn't matter here.
+ true); // is_external_protocol
+ delegate->ShouldIgnoreNavigation(navigation_params);
}

Powered by Google App Engine
This is Rietveld 408576698