[Pwa]: Switch to new filter functions that query on Capabilities.

Target(s): chrome/browser/ui

This updates callsites for FindBestAppWithUrlInScope and for
FindAllAppsNestedInUrl to use the new versions that allows for
querying the web app registry for apps with certain capabilities
(such as how it opens, browser tab/dedicated window, supports
badging/notifications, etc).

It replaces similar functions that deal with install state, which
is error prone and confusing for consumers of the API.

The prototype with more discussion threads can be found here:
https://chromium-review.googlesource.com/c/chromium/src/+/6167649

This CL was uploaded by git cl split.

R=yhanada@chromium.org

Bug: 390167210
Change-Id: I86047cd609aebd7884809c75faca504e487b0373
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6180271
Commit-Queue: Tim Sergeant <tsergeant@chromium.org>
Reviewed-by: Tim Sergeant <tsergeant@chromium.org>
Auto-Submit: Finnur Thorarinsson <finnur@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1408493}
diff --git a/chrome/browser/ui/intent_picker_tab_helper.cc b/chrome/browser/ui/intent_picker_tab_helper.cc
index 75de4aa84..38da861 100644
--- a/chrome/browser/ui/intent_picker_tab_helper.cc
+++ b/chrome/browser/ui/intent_picker_tab_helper.cc
@@ -472,15 +472,10 @@
     const webapps::AppId& app_id) {
   // WebAppTabHelper has an app_id but it is reset during
   // OnWebAppWillBeUninstalled so using FindAppWithUrlInScope.
-  // TODO(crbug.com/340952100): Evaluate call sites of FindBestAppWithUrlInScope
-  // for correctness.
   std::optional<webapps::AppId> local_app_id =
       registrar_->FindBestAppWithUrlInScope(
           web_contents()->GetLastCommittedURL(),
-          {
-              web_app::proto::InstallState::INSTALLED_WITH_OS_INTEGRATION,
-              web_app::proto::InstallState::INSTALLED_WITHOUT_OS_INTEGRATION,
-          });
+          web_app::WebAppFilter::InstalledInChrome());
   if (app_id == local_app_id) {
     ShowOrHideIcon(web_contents(), /*should_show_icon=*/false);
   }