[Lacros] Update to use app service to get the app display mode.

This CL updates the chrome new window client to use app service to get
the app display mode instead of the web app provider. This is to reduce
the direct access of web app provider where possible.

BUG=1144877

Change-Id: I9273c4c4feff595630b0c009169b3c9405eb062c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3002795
Reviewed-by: Jimmy Gong <jimmyxgong@chromium.org>
Commit-Queue: Maggie Cai <mxcai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#898505}
diff --git a/chrome/browser/ui/ash/chrome_new_window_client.cc b/chrome/browser/ui/ash/chrome_new_window_client.cc
index 348635a4..41937fe 100644
--- a/chrome/browser/ui/ash/chrome_new_window_client.cc
+++ b/chrome/browser/ui/ash/chrome_new_window_client.cc
@@ -597,17 +597,19 @@
   int event_flags = apps::GetEventFlags(
       apps::mojom::LaunchContainer::kLaunchContainerWindow,
       WindowOpenDisposition::NEW_WINDOW, /*prefer_container=*/false);
-  if (web_app::WebAppProviderBase::GetProviderBase(profile)
-          ->registrar()
-          .GetAppEffectiveDisplayMode(*app_id) ==
-      blink::mojom::DisplayMode::kBrowser) {
-    event_flags = apps::GetEventFlags(
-        apps::mojom::LaunchContainer::kLaunchContainerTab,
-        WindowOpenDisposition::NEW_FOREGROUND_TAB, /*prefer_container=*/false);
-  }
-
   apps::AppServiceProxyChromeOs* proxy =
       apps::AppServiceProxyFactory::GetForProfile(profile);
+
+  proxy->AppRegistryCache().ForOneApp(
+      *app_id, [&event_flags](const apps::AppUpdate& update) {
+        if (update.WindowMode() == apps::mojom::WindowMode::kBrowser) {
+          event_flags = apps::GetEventFlags(
+              apps::mojom::LaunchContainer::kLaunchContainerTab,
+              WindowOpenDisposition::NEW_FOREGROUND_TAB,
+              /*prefer_container=*/false);
+        }
+      });
+
   proxy->LaunchAppWithUrl(*app_id, event_flags, url,
                           apps::mojom::LaunchSource::kFromArc);