Commit fea523e1 authored by Maggie Cai's avatar Maggie Cai Committed by Commit Bot

[IntentHandling]Fix common apps navigation throttle dead loop.

Currently when we defer navigation, it will try to find apps, and if
there is no preferred app, it will try to show the bubble and resume the
navigation. However when there is no app found, the navigation will be
trapped in start navigation, defer navigation and resume navigation all the
time. This CL fixes this issue by adding checks when there is no app found.

BUG=853604

Change-Id: Id4215e6b0885da7ab37da9b81f75409ad915af7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2072481Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Commit-Queue: Maggie Cai <mxcai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#744561}
parent 34527322
......@@ -202,6 +202,9 @@ bool CommonAppsNavigationThrottle::ShouldDeferNavigation(
std::vector<std::string> app_ids = proxy->GetAppIdsForUrl(url);
if (app_ids.empty())
return false;
if (navigate_from_link()) {
auto preferred_app_id = proxy->PreferredApps().FindPreferredAppForUrl(url);
......@@ -218,6 +221,9 @@ bool CommonAppsNavigationThrottle::ShouldDeferNavigation(
std::vector<apps::IntentPickerAppInfo> apps_for_picker =
FindAllAppsForUrl(web_contents, url, {});
if (apps_for_picker.empty())
return false;
IntentPickerTabHelper::LoadAppIcons(
web_contents, std::move(apps_for_picker),
base::BindOnce(
......@@ -232,11 +238,8 @@ void CommonAppsNavigationThrottle::OnDeferredNavigationProcessed(
content::WebContents* web_contents = handle->GetWebContents();
const GURL& url = handle->GetURL();
std::vector<apps::IntentPickerAppInfo> apps_for_picker =
FindAllAppsForUrl(web_contents, url, std::move(apps));
ShowIntentPickerForApps(web_contents, ui_auto_display_service_, url,
std::move(apps_for_picker),
std::move(apps),
base::BindOnce(&OnIntentPickerClosed, web_contents,
ui_auto_display_service_, url));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment