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

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: rebase and fix test Created 5 years, 7 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..5ce3e65148e9c93016d3763de9d389ab41606aaa 100644
--- a/chrome/browser/ui/android/external_protocol_dialog_android.cc
+++ b/chrome/browser/ui/android/external_protocol_dialog_android.cc
@@ -5,13 +5,40 @@
#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,
+ bool has_user_gesture) {
+ 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(),
+ has_user_gesture, // has_user_gesture
+ false, // is_post, doesn't matter here.
+ page_transition,
+ false, // is_redirect, doesn't matter here.
+ true, // is_external_protocol
+ false); // is_main_frame
+ delegate->ShouldIgnoreNavigation(navigation_params);
}

Powered by Google App Engine
This is Rietveld 408576698