Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / android / external_protocol_dialog_android.cc
blob5ce3e65148e9c93016d3763de9d389ab41606aaa
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/external_protocol/external_protocol_handler.h"
7 #include "base/logging.h"
8 #include "chrome/browser/external_protocol/external_protocol_handler.h"
9 #include "chrome/browser/tab_contents/tab_util.h"
10 #include "components/navigation_interception/intercept_navigation_delegate.h"
11 #include "components/navigation_interception/navigation_params.h"
12 #include "content/public/browser/web_contents.h"
13 #include "content/public/common/referrer.h"
14 #include "ui/base/page_transition_types.h"
16 using content::WebContents;
18 // static
19 void ExternalProtocolHandler::RunExternalProtocolDialog(
20 const GURL& url,
21 int render_process_host_id,
22 int routing_id,
23 ui::PageTransition page_transition,
24 bool has_user_gesture) {
25 WebContents* web_contents = tab_util::GetWebContentsByID(
26 render_process_host_id, routing_id);
27 if (!web_contents)
28 return;
29 navigation_interception::InterceptNavigationDelegate* delegate =
30 navigation_interception::InterceptNavigationDelegate::Get(web_contents);
31 if (!delegate)
32 return;
34 navigation_interception::NavigationParams navigation_params(
35 url,
36 content::Referrer(),
37 has_user_gesture, // has_user_gesture
38 false, // is_post, doesn't matter here.
39 page_transition,
40 false, // is_redirect, doesn't matter here.
41 true, // is_external_protocol
42 false); // is_main_frame
43 delegate->ShouldIgnoreNavigation(navigation_params);