| Index: chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog.cc
|
| diff --git a/chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog.cc b/chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog.cc
|
| index 05a401638115229c81e8668d2bd1356bed4a9c9e..f49f39f6e5b238741031a5bb3addcbba703ad0c2 100644
|
| --- a/chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog.cc
|
| +++ b/chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog.cc
|
| @@ -339,6 +339,20 @@ void OnUrlHandlerList(int render_process_host_id,
|
| routing_id, url, base::Passed(&handlers)));
|
| }
|
|
|
| +// Returns true if ARC should ignore the navigation with the |page_transition|.
|
| +bool ShouldIgnoreNavigation(ui::PageTransition page_transition) {
|
| + // Handle client-side redirections. Forwarding such navigations to ARC is
|
| + // better than just showing the "can't open" dialog.
|
| + // TODO(djacobo): Check if doing this in arc::ShouldIgnoreNavigation is safe,
|
| + // and move it to the function if it is. (b/32442730#comment3)
|
| + page_transition = ui::PageTransitionFromInt(
|
| + page_transition & ~ui::PAGE_TRANSITION_CLIENT_REDIRECT);
|
| +
|
| + // Try to forward <form> submissions to ARC when possible.
|
| + constexpr bool kAllowFormSubmit = true;
|
| + return arc::ShouldIgnoreNavigation(page_transition, kAllowFormSubmit);
|
| +}
|
| +
|
| } // namespace
|
|
|
| bool RunArcExternalProtocolDialog(const GURL& url,
|
| @@ -349,16 +363,7 @@ bool RunArcExternalProtocolDialog(const GURL& url,
|
| // This function is for external protocols that Chrome cannot handle.
|
| DCHECK(!url.SchemeIsHTTPOrHTTPS()) << url;
|
|
|
| - // Handle client-side redirections. Forwarding such navigations to ARC is
|
| - // better than just showing the "can't open" dialog.
|
| - // TODO(djacobo): Check if doing this in arc::ShouldIgnoreNavigation is safe,
|
| - // and move it to the function if it is. (b/32442730#comment3)
|
| - page_transition = ui::PageTransitionFromInt(
|
| - page_transition & ~ui::PAGE_TRANSITION_CLIENT_REDIRECT);
|
| -
|
| - // Try to forward <form> submissions to ARC when possible.
|
| - constexpr bool kAllowFormSubmit = true;
|
| - if (ShouldIgnoreNavigation(page_transition, kAllowFormSubmit))
|
| + if (ShouldIgnoreNavigation(page_transition))
|
| return false;
|
|
|
| auto* instance = ArcIntentHelperBridge::GetIntentHelperInstance(
|
| @@ -381,6 +386,10 @@ bool RunArcExternalProtocolDialog(const GURL& url,
|
| return true;
|
| }
|
|
|
| +bool ShouldIgnoreNavigationForTesting(ui::PageTransition page_transition) {
|
| + return ShouldIgnoreNavigation(page_transition);
|
| +}
|
| +
|
| GetActionResult GetActionForTesting(
|
| const GURL& original_url,
|
| const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers,
|
|
|