Commit de100774 authored by nancy's avatar nancy Committed by Commit Bot

Unregister Crostini Terminal system web app in Web apps.

TerminalSystemApp is registered as a crostini app by
CrostiniRegistryService. Similar implementation in extension_apps:
https://cs.chromium.org/chromium/src/chrome/browser/apps/app_service/extension_apps.cc?l=326

BUG=1029221

Change-Id: I4a234fe3fad49e5c02531a798d55bdd66e62b695
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2043180Reviewed-by: default avatarAlexey Baskakov <loyso@chromium.org>
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#739297}
parent ea358e18
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "chrome/browser/apps/app_service/menu_util.h" #include "chrome/browser/apps/app_service/menu_util.h"
#include "chrome/browser/apps/launch_service/launch_service.h" #include "chrome/browser/apps/launch_service/launch_service.h"
#include "chrome/browser/chromeos/arc/arc_util.h" #include "chrome/browser/chromeos/arc/arc_util.h"
#include "chrome/browser/chromeos/crostini/crostini_util.h"
#include "chrome/browser/chromeos/extensions/gfx_utils.h" #include "chrome/browser/chromeos/extensions/gfx_utils.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
...@@ -430,7 +431,8 @@ void WebApps::OnContentSettingChanged( ...@@ -430,7 +431,8 @@ void WebApps::OnContentSettingChanged(
continue; continue;
} }
if (primary_pattern.Matches(web_app.launch_url())) { if (primary_pattern.Matches(web_app.launch_url()) &&
Accepts(web_app.app_id())) {
apps::mojom::AppPtr app = apps::mojom::App::New(); apps::mojom::AppPtr app = apps::mojom::App::New();
app->app_type = apps::mojom::AppType::kWeb; app->app_type = apps::mojom::AppType::kWeb;
app->app_id = web_app.app_id(); app->app_id = web_app.app_id();
...@@ -443,14 +445,14 @@ void WebApps::OnContentSettingChanged( ...@@ -443,14 +445,14 @@ void WebApps::OnContentSettingChanged(
void WebApps::OnWebAppInstalled(const web_app::AppId& app_id) { void WebApps::OnWebAppInstalled(const web_app::AppId& app_id) {
const web_app::WebApp* web_app = GetWebApp(app_id); const web_app::WebApp* web_app = GetWebApp(app_id);
if (web_app) { if (web_app && Accepts(app_id)) {
Publish(Convert(web_app, apps::mojom::Readiness::kReady)); Publish(Convert(web_app, apps::mojom::Readiness::kReady));
} }
} }
void WebApps::OnWebAppWillBeUninstalled(const web_app::AppId& app_id) { void WebApps::OnWebAppWillBeUninstalled(const web_app::AppId& app_id) {
const web_app::WebApp* web_app = GetWebApp(app_id); const web_app::WebApp* web_app = GetWebApp(app_id);
if (!web_app) { if (!web_app || !Accepts(app_id)) {
return; return;
} }
...@@ -669,4 +671,9 @@ void WebApps::SetIconEffect(const std::string& app_id) { ...@@ -669,4 +671,9 @@ void WebApps::SetIconEffect(const std::string& app_id) {
Publish(std::move(app)); Publish(std::move(app));
} }
bool WebApps::Accepts(const std::string& app_id) {
// Crostini Terminal System App is handled by Crostini Apps.
return app_id != crostini::kCrostiniTerminalSystemAppId;
}
} // namespace apps } // namespace apps
...@@ -137,6 +137,8 @@ class WebApps : public apps::mojom::Publisher, ...@@ -137,6 +137,8 @@ class WebApps : public apps::mojom::Publisher,
void SetIconEffect(const std::string& app_id); void SetIconEffect(const std::string& app_id);
bool Accepts(const std::string& app_id);
mojo::Receiver<apps::mojom::Publisher> receiver_{this}; mojo::Receiver<apps::mojom::Publisher> receiver_{this};
mojo::RemoteSet<apps::mojom::Subscriber> subscribers_; mojo::RemoteSet<apps::mojom::Subscriber> subscribers_;
......
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