Commit 6f692316 authored by Nicholas Hollingum's avatar Nicholas Hollingum Committed by Commit Bot

app_service: Windows from exo are not browser windows

The IsOpenedInBrowser method is used to exclude windows managed by
browser controllers from being handled by the app service. This method
special-cased unmatched crostini windows, whose app type is unknown and
therefore would be conservatively assumed to be broswer-based.

We use a better case, by excluding all exo-originating windows. This not
only catches all the unmatched crostini cases, but also it handles all
arc, larcos and pluginvm windows here, instead of needing to check the
AppType of their app id against the proxy.  Further, it allows us to
exclude all anonymous apps (see go/anonymous-apps).

Bug: b/172979315
Change-Id: Ic8f109a5fe0d3aa5049ba244aba9e22a8bcdd7b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2560442Reviewed-by: default avatarNancy Wang <nancylingwang@chromium.org>
Commit-Queue: Nic Hollingum <hollingum@google.com>
Cr-Commit-Position: refs/heads/master@{#831226}
parent 990f883c
......@@ -12,7 +12,6 @@
#include "base/time/time.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/chromeos/crostini/crostini_shelf_utils.h"
#include "chrome/browser/chromeos/crostini/crostini_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
......@@ -22,6 +21,7 @@
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
#include "components/exo/shell_surface_util.h"
#include "components/services/app_service/public/cpp/instance_update.h"
#include "components/services/app_service/public/mojom/types.mojom.h"
#include "content/public/browser/web_contents.h"
......@@ -409,7 +409,8 @@ bool AppServiceInstanceRegistryHelper::IsOpenedInBrowser(
if (app_id == crostini::kCrostiniTerminalSystemAppId)
return true;
if (crostini::IsUnmatchedCrostiniShelfAppId(app_id))
// Windows created by exo with app/startup ids are not browser windows.
if (exo::GetShellApplicationId(window) || exo::GetShellStartupId(window))
return false;
for (auto* profile : controller_->GetProfileList()) {
......
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