Remove TerminalSSH flag and cleanup references to Terminal app
Terminal app is no longer a crostini app, it is a web app. Previous
special-casing for terminal as a crostini app can be removed.
Bug: 1028898
Change-Id: I794a6b6c08ef0d50ecbf40d8a4c438b2702f3121
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3646546
Reviewed-by: Timothy Loh <[email protected]>
Reviewed-by: Lei Zhang <[email protected]>
Reviewed-by: Anqing Zhao <[email protected]>
Commit-Queue: Joel Hockey <[email protected]>
Reviewed-by: Nancy Wang <[email protected]>
Reviewed-by: Jason Lin <[email protected]>
Reviewed-by: Xiyuan Xia <[email protected]>
Reviewed-by: Jeffrey Young <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1005140}
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 08b72ab..1c6e64d 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -4025,9 +4025,6 @@
{"terminal-dev", flag_descriptions::kTerminalDevName,
flag_descriptions::kTerminalDevDescription, kOsCrOS,
FEATURE_VALUE_TYPE(chromeos::features::kTerminalDev)},
- {"terminal-ssh", flag_descriptions::kTerminalSSHName,
- flag_descriptions::kTerminalSSHDescription, kOsCrOS,
- FEATURE_VALUE_TYPE(chromeos::features::kTerminalSSH)},
{"terminal-tmux-integration",
flag_descriptions::kTerminalTmuxIntegrationName,
flag_descriptions::kTerminalTmuxIntegrationDescription, kOsCrOS,
diff --git a/chrome/browser/apps/app_service/metrics/app_platform_metrics.cc b/chrome/browser/apps/app_service/metrics/app_platform_metrics.cc
index c6d03bf..2b85f3cc 100644
--- a/chrome/browser/apps/app_service/metrics/app_platform_metrics.cc
+++ b/chrome/browser/apps/app_service/metrics/app_platform_metrics.cc
@@ -15,7 +15,6 @@
#include "chrome/browser/apps/app_service/extension_apps_utils.h"
#include "chrome/browser/apps/app_service/metrics/app_service_metrics.h"
#include "chrome/browser/ash/borealis/borealis_util.h"
-#include "chrome/browser/ash/crostini/crostini_util.h"
#include "chrome/browser/ash/guest_os/guest_os_registry_service.h"
#include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h"
#include "chrome/browser/ash/profiles/profile_helper.h"
@@ -517,12 +516,6 @@
ukm::SourceId AppPlatformMetrics::GetSourceIdForCrostini(
Profile* profile,
const std::string& app_id) {
- if (app_id == crostini::kCrostiniTerminalSystemAppId) {
- // The terminal is special, since it's actually a web app (though one we
- // count as Crostini) it doesn't have a desktop id, so give it a fake one.
- return ukm::AppSourceUrlRecorder::GetSourceIdForCrostini("CrostiniTerminal",
- "Terminal");
- }
auto* registry =
guest_os::GuestOsRegistryServiceFactory::GetForProfile(profile);
auto registration = registry->GetRegistration(app_id);
diff --git a/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_unittest.cc b/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_unittest.cc
index 0d7c03f..3f7d5efc 100644
--- a/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_unittest.cc
+++ b/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_unittest.cc
@@ -25,7 +25,9 @@
#include "chrome/browser/apps/app_service/publishers/app_publisher.h"
#include "chrome/browser/ash/borealis/borealis_util.h"
#include "chrome/browser/ash/borealis/testing/apps.h"
-#include "chrome/browser/ash/crostini/crostini_util.h"
+#include "chrome/browser/ash/crostini/crostini_test_helper.h"
+#include "chrome/browser/ash/guest_os/guest_os_registry_service.h"
+#include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h"
#include "chrome/browser/ash/login/users/fake_chrome_user_manager.h"
#include "chrome/browser/ash/profiles/profile_helper.h"
#include "chrome/browser/sync/sync_service_factory.h"
@@ -291,7 +293,13 @@
Readiness::kReady, InstallReason::kUser, InstallSource::kUnknown,
true /* should_notify_initialized */);
- AddApp(cache, /*app_id=*/crostini::kCrostiniTerminalSystemAppId,
+ vm_tools::apps::ApplicationList app_list =
+ crostini::CrostiniTestHelper::BasicAppList("test");
+ guest_os::GuestOsRegistryServiceFactory::GetForProfile(
+ testing_profile_.get())
+ ->UpdateApplicationList(app_list);
+ AddApp(cache, /*app_id=*/
+ crostini::CrostiniTestHelper::GenerateAppId("test"),
AppType::kCrostini, "", Readiness::kReady, InstallReason::kUser,
InstallSource::kUnknown, true /* should_notify_initialized */);
@@ -2038,9 +2046,9 @@
VerifyAppLaunchPerAppTypeV2Histogram(2, AppTypeNameV2::kBorealis);
proxy->Launch(
- /*app_id=*/crostini::kCrostiniTerminalSystemAppId, ui::EF_NONE,
- apps::mojom::LaunchSource::kFromChromeInternal, nullptr);
- VerifyAppsLaunchUkm("app://CrostiniTerminal/Terminal", AppTypeName::kCrostini,
+ /*app_id=*/crostini::CrostiniTestHelper::GenerateAppId("test"),
+ ui::EF_NONE, apps::mojom::LaunchSource::kFromChromeInternal, nullptr);
+ VerifyAppsLaunchUkm("app://test/test", AppTypeName::kCrostini,
apps::mojom::LaunchSource::kFromChromeInternal);
VerifyAppLaunchPerAppTypeHistogram(1, AppTypeName::kCrostini);
@@ -2171,13 +2179,6 @@
proxy->SetAppPlatformMetricsServiceForTesting(GetAppPlatformMetricsService());
proxy->UninstallSilently(
- /*app_id=*/crostini::kCrostiniTerminalSystemAppId,
- apps::mojom::UninstallSource::kAppList);
- VerifyAppsUninstallUkm("app://CrostiniTerminal/Terminal",
- AppTypeName::kCrostini,
- apps::mojom::UninstallSource::kAppList);
-
- proxy->UninstallSilently(
/*app_id=*/"a", apps::mojom::UninstallSource::kAppList);
VerifyAppsUninstallUkm("app://com.google.A", AppTypeName::kArc,
apps::mojom::UninstallSource::kAppList);
diff --git a/chrome/browser/apps/app_service/publishers/crostini_apps.cc b/chrome/browser/apps/app_service/publishers/crostini_apps.cc
index 3afe733..f058085 100644
--- a/chrome/browser/apps/app_service/publishers/crostini_apps.cc
+++ b/chrome/browser/apps/app_service/publishers/crostini_apps.cc
@@ -24,7 +24,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/grit/chrome_unscaled_resources.h"
#include "chrome/grit/generated_resources.h"
-#include "components/prefs/pref_change_registrar.h"
#include "components/prefs/pref_service.h"
#include "components/services/app_service/public/cpp/app_types.h"
#include "components/services/app_service/public/mojom/types.mojom.h"
@@ -45,8 +44,7 @@
int64_t display_id) {
// The default terminal app is crosh in a Chrome window and it doesn't run in
// the Crostini container so it doesn't support display density the same way.
- if (menu_type != apps::mojom::MenuType::kShelf ||
- app_id == crostini::kCrostiniTerminalSystemAppId) {
+ if (menu_type != apps::mojom::MenuType::kShelf) {
return false;
}
@@ -63,10 +61,7 @@
namespace apps {
CrostiniApps::CrostiniApps(AppServiceProxy* proxy)
- : AppPublisher(proxy),
- profile_(proxy->profile()),
- registry_(nullptr),
- crostini_enabled_(false) {}
+ : AppPublisher(proxy), profile_(proxy->profile()), registry_(nullptr) {}
CrostiniApps::~CrostiniApps() {
if (registry_) {
@@ -83,17 +78,9 @@
if (!registry_) {
return;
}
- crostini_enabled_ = crostini::CrostiniFeatures::Get()->IsEnabled(profile_);
registry_->AddObserver(this);
- pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>();
- pref_change_registrar_->Init(profile_->GetPrefs());
- pref_change_registrar_->Add(
- crostini::prefs::kCrostiniEnabled,
- base::BindRepeating(&CrostiniApps::OnCrostiniEnabledChanged,
- base::Unretained(this)));
-
PublisherBase::Initialize(proxy()->AppService(),
apps::mojom::AppType::kCrostini);
@@ -139,15 +126,6 @@
std::move(callback).Run(LaunchResult());
}
-void CrostiniApps::LaunchShortcut(const std::string& app_id,
- const std::string& shortcut_id,
- int64_t display_id) {
- if (app_id == crostini::kCrostiniTerminalSystemAppId) {
- crostini::ExecuteTerminalMenuShortcutCommand(profile_, shortcut_id,
- display_id);
- }
-}
-
void CrostiniApps::Connect(
mojo::PendingRemote<apps::mojom::Subscriber> subscriber_remote,
apps::mojom::ConnectOptionsPtr opts) {
@@ -236,10 +214,6 @@
AddCommandItem(ash::UNINSTALL, IDS_APP_LIST_UNINSTALL_ITEM, &menu_items);
}
- if (app_id == crostini::kCrostiniTerminalSystemAppId) {
- crostini::AddTerminalMenuItems(profile_, &menu_items);
- }
-
if (ShouldAddOpenItem(app_id, menu_type, profile_)) {
AddCommandItem(ash::MENU_OPEN_NEW, IDS_APP_CONTEXT_MENU_ACTIVATE_ARC,
&menu_items);
@@ -267,23 +241,7 @@
}
}
- if (app_id == crostini::kCrostiniTerminalSystemAppId) {
- crostini::AddTerminalMenuShortcuts(profile_, ash::LAUNCH_APP_SHORTCUT_FIRST,
- std::move(menu_items),
- std::move(callback));
- } else {
- std::move(callback).Run(std::move(menu_items));
- }
-}
-
-void CrostiniApps::ExecuteContextMenuCommand(const std::string& app_id,
- int command_id,
- const std::string& shortcut_id,
- int64_t display_id) {
- if (app_id == crostini::kCrostiniTerminalSystemAppId) {
- crostini::ExecuteTerminalMenuShortcutCommand(profile_, shortcut_id,
- display_id);
- }
+ std::move(callback).Run(std::move(menu_items));
}
void CrostiniApps::OnRegistryUpdated(
@@ -330,36 +288,6 @@
}
}
-void CrostiniApps::OnCrostiniEnabledChanged() {
- crostini_enabled_ =
- profile_ && crostini::CrostiniFeatures::Get()->IsEnabled(profile_);
- auto show = crostini_enabled_ ? apps::mojom::OptionalBool::kTrue
- : apps::mojom::OptionalBool::kFalse;
-
- if (!base::FeatureList::IsEnabled(chromeos::features::kTerminalSSH)) {
- // If they don't have the terminal app for ssh, then we need to update the
- // terminal's registration when Crostini is installed/uninstalled.
- // It is the entry point to installing other Crostini apps, and is always in
- // search, but should only show up elsewhere when installed.
- apps::mojom::AppPtr mojom_app = apps::mojom::App::New();
- mojom_app->app_type = apps::mojom::AppType::kCrostini;
- mojom_app->app_id = crostini::kCrostiniTerminalSystemAppId;
- mojom_app->show_in_launcher = show;
- mojom_app->show_in_shelf = show;
- mojom_app->show_in_search = apps::mojom::OptionalBool::kTrue;
- mojom_app->handles_intents = show;
- PublisherBase::Publish(std::move(mojom_app), subscribers_);
-
- auto app = std::make_unique<App>(AppType::kCrostini,
- crostini::kCrostiniTerminalSystemAppId);
- app->show_in_launcher = crostini_enabled_;
- app->show_in_shelf = crostini_enabled_;
- app->show_in_search = true;
- app->handles_intents = crostini_enabled_;
- AppPublisher::Publish(std::move(app));
- }
-}
-
AppPtr CrostiniApps::CreateApp(
const guest_os::GuestOsRegistryService::Registration& registration,
bool generate_new_icon_key) {
@@ -380,36 +308,17 @@
}
if (generate_new_icon_key) {
- if (registration.app_id() == crostini::kCrostiniTerminalSystemAppId) {
- // Treat the Crostini Terminal as a special case, loading an icon defined
- // by a resource instead of asking the Crostini VM (or the cache of
- // previous responses from the Crostini VM). Presumably this is for
- // bootstrapping: the Crostini Terminal icon (the UI for enabling and
- // installing Crostini apps) should be showable even before the user has
- // installed their first Crostini app and before bringing up an Crostini
- // VM for the first time.
- app->icon_key = IconKey(IconKey::kDoesNotChangeOverTime,
- IDR_LOGO_CROSTINI_TERMINAL, IconEffects::kNone);
- } else {
- app->icon_key = std::move(
- *icon_key_factory_.CreateIconKey(IconEffects::kCrOsStandardIcon));
- }
+ app->icon_key = std::move(
+ *icon_key_factory_.CreateIconKey(IconEffects::kCrOsStandardIcon));
}
app->last_launch_time = registration.LastLaunchTime();
app->install_time = registration.InstallTime();
auto show = !registration.NoDisplay();
- auto show_in_search = show;
- if (registration.app_id() == crostini::kCrostiniTerminalSystemAppId) {
- show = crostini_enabled_;
- // The Crostini Terminal should appear in the app search, even when
- // Crostini is not installed.
- show_in_search = true;
- }
app->show_in_launcher = show;
- app->show_in_search = show_in_search;
- app->show_in_shelf = show_in_search;
+ app->show_in_search = show;
+ app->show_in_shelf = show;
// TODO(crbug.com/955937): Enable once Crostini apps are managed inside App
// Management.
app->show_in_management = false;
@@ -452,17 +361,9 @@
if (registration.NoDisplay()) {
show = apps::mojom::OptionalBool::kFalse;
}
- auto show_in_search = show;
- if (registration.app_id() == crostini::kCrostiniTerminalSystemAppId) {
- show = crostini_enabled_ ? apps::mojom::OptionalBool::kTrue
- : apps::mojom::OptionalBool::kFalse;
- // The Crostini Terminal should appear in the app search, even when
- // Crostini is not installed.
- show_in_search = apps::mojom::OptionalBool::kTrue;
- }
app->show_in_launcher = show;
- app->show_in_search = show_in_search;
- app->show_in_shelf = show_in_search;
+ app->show_in_search = show;
+ app->show_in_shelf = show;
// TODO(crbug.com/955937): Enable once Crostini apps are managed inside App
// Management.
app->show_in_management = apps::mojom::OptionalBool::kFalse;
@@ -477,19 +378,6 @@
apps::mojom::IconKeyPtr CrostiniApps::NewIconKey(const std::string& app_id) {
DCHECK(!app_id.empty());
-
- // Treat the Crostini Terminal as a special case, loading an icon defined by
- // a resource instead of asking the Crostini VM (or the cache of previous
- // responses from the Crostini VM). Presumably this is for bootstrapping: the
- // Crostini Terminal icon (the UI for enabling and installing Crostini apps)
- // should be showable even before the user has installed their first Crostini
- // app and before bringing up an Crostini VM for the first time.
- if (app_id == crostini::kCrostiniTerminalSystemAppId) {
- return apps::mojom::IconKey::New(
- apps::mojom::IconKey::kDoesNotChangeOverTime,
- IDR_LOGO_CROSTINI_TERMINAL, apps::IconEffects::kNone);
- }
-
auto icon_effects = IconEffects::kCrOsStandardIcon;
return icon_key_factory_.MakeIconKey(icon_effects);
}
diff --git a/chrome/browser/apps/app_service/publishers/crostini_apps.h b/chrome/browser/apps/app_service/publishers/crostini_apps.h
index 54a1b9a..7cda7c86 100644
--- a/chrome/browser/apps/app_service/publishers/crostini_apps.h
+++ b/chrome/browser/apps/app_service/publishers/crostini_apps.h
@@ -24,7 +24,6 @@
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/remote_set.h"
-class PrefChangeRegistrar;
class Profile;
namespace apps {
@@ -64,9 +63,6 @@
apps::LoadIconCallback callback) override;
void LaunchAppWithParams(AppLaunchParams&& params,
LaunchCallback callback) override;
- void LaunchShortcut(const std::string& app_id,
- const std::string& shortcut_id,
- int64_t display_id) override;
// apps::mojom::Publisher overrides.
void Connect(mojo::PendingRemote<apps::mojom::Subscriber> subscriber_remote,
@@ -95,10 +91,6 @@
apps::mojom::MenuType menu_type,
int64_t display_id,
GetMenuModelCallback callback) override;
- void ExecuteContextMenuCommand(const std::string& app_id,
- int command_id,
- const std::string& shortcut_id,
- int64_t display_id) override;
// GuestOsRegistryService::Observer overrides.
void OnRegistryUpdated(
@@ -108,11 +100,6 @@
const std::vector<std::string>& removed_apps,
const std::vector<std::string>& inserted_apps) override;
- // Registers and unregisters terminal with AppService.
- // TODO(crbug.com/1028898): Move this code into System Apps
- // once it can support hiding apps.
- void OnCrostiniEnabledChanged();
-
AppPtr CreateApp(
const guest_os::GuestOsRegistryService::Registration& registration,
bool generate_new_icon_key);
@@ -126,13 +113,10 @@
Profile* const profile_;
- std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
guest_os::GuestOsRegistryService* registry_;
apps_util::IncrementingIconKeyFactory icon_key_factory_;
- bool crostini_enabled_;
-
base::WeakPtrFactory<CrostiniApps> weak_ptr_factory_{this};
};
diff --git a/chrome/browser/ash/crostini/crostini_package_notification.cc b/chrome/browser/ash/crostini/crostini_package_notification.cc
index 4f12b07f..57c714f 100644
--- a/chrome/browser/ash/crostini/crostini_package_notification.cc
+++ b/chrome/browser/ash/crostini/crostini_package_notification.cc
@@ -7,6 +7,7 @@
#include "ash/public/cpp/notification_utils.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/ash/crostini/crostini_package_service.h"
+#include "chrome/browser/ash/crostini/crostini_terminal.h"
#include "chrome/browser/ash/crostini/crostini_util.h"
#include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h"
#include "chrome/browser/notifications/notification_display_service.h"
@@ -290,8 +291,8 @@
return;
if (app_count_ == 0) {
- LaunchCrostiniApp(profile_, kCrostiniTerminalSystemAppId,
- display::Screen::GetScreen()->GetPrimaryDisplay().id());
+ LaunchTerminal(profile_,
+ display::Screen::GetScreen()->GetPrimaryDisplay().id());
} else if (app_count_ == 1) {
DCHECK(!app_id_.empty());
LaunchCrostiniApp(profile_, app_id_,
diff --git a/chrome/browser/ash/crostini/crostini_shelf_utils.cc b/chrome/browser/ash/crostini/crostini_shelf_utils.cc
index 5af6679..4b24969 100644
--- a/chrome/browser/ash/crostini/crostini_shelf_utils.cc
+++ b/chrome/browser/ash/crostini/crostini_shelf_utils.cc
@@ -4,8 +4,6 @@
#include "chrome/browser/ash/crostini/crostini_shelf_utils.h"
-#include "ash/constants/ash_features.h"
-#include "base/feature_list.h"
#include "base/logging.h"
#include "base/no_destructor.h"
#include "base/strings/string_piece.h"
@@ -72,9 +70,6 @@
bool ignore_space = false) {
result->clear();
for (const auto item : prefs->DictItems()) {
- if (item.first == kCrostiniTerminalSystemAppId)
- continue;
-
if (require_startup_notify &&
!item.second
.FindKeyOfType(guest_os::prefs::kAppStartupNotifyKey,
@@ -232,10 +227,6 @@
if (IsUnmatchedCrostiniShelfAppId(shelf_app_id)) {
return true;
}
- if (!base::FeatureList::IsEnabled(chromeos::features::kTerminalSSH) &&
- shelf_app_id == kCrostiniTerminalSystemAppId) {
- return true;
- }
if (!profile || !profile->GetPrefs()) {
return false;
diff --git a/chrome/browser/ash/crostini/crostini_terminal.cc b/chrome/browser/ash/crostini/crostini_terminal.cc
index be45a07..399062d 100644
--- a/chrome/browser/ash/crostini/crostini_terminal.cc
+++ b/chrome/browser/ash/crostini/crostini_terminal.cc
@@ -4,11 +4,9 @@
#include "chrome/browser/ash/crostini/crostini_terminal.h"
-#include "ash/constants/ash_features.h"
#include "ash/public/cpp/app_menu_constants.h"
#include "base/bind.h"
#include "base/containers/fixed_flat_map.h"
-#include "base/feature_list.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/metrics/histogram_functions.h"
@@ -27,6 +25,7 @@
#include "chrome/browser/ash/crostini/crostini_pref_names.h"
#include "chrome/browser/ash/crostini/crostini_util.h"
#include "chrome/browser/ash/file_manager/path_util.h"
+#include "chrome/browser/ash/guest_os/guest_os_pref_names.h"
#include "chrome/browser/ash/guest_os/guest_os_share_path.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
@@ -59,6 +58,10 @@
namespace crostini {
+// web_app::GenerateAppId(/*manifest_id=*/absl::nullopt,
+// GURL("chrome-untrusted://terminal/html/terminal.html"))
+const char kCrostiniTerminalSystemAppId[] = "fhicihalidkgcimdmhpohldehjmcabcf";
+
const char kTerminalHomePath[] = "html/terminal_home.html";
const char kShortcutKey[] = "shortcut";
@@ -104,15 +107,14 @@
// LaunchSystemWebAppAsync.
// Launch without a pinned home tab (settings page).
- if (!base::FeatureList::IsEnabled(chromeos::features::kTerminalSSH) ||
- params.disposition == WindowOpenDisposition::NEW_POPUP) {
+ if (params.disposition == WindowOpenDisposition::NEW_POPUP) {
web_app::LaunchSystemWebAppImpl(
profile, ash::SystemWebAppType::TERMINAL, url, params);
return;
}
// TODO(crbug.com/1308961): Migrate to use PWA pinned home tab when ready.
- // For TerminalSSH, if opening a new tab, first pin home tab.
+ // If opening a new tab, first pin home tab.
full_restore::FullRestoreSaveHandler::GetInstance();
GURL home(base::StrCat(
{chrome::kChromeUIUntrustedTerminalURL, kTerminalHomePath}));
@@ -136,6 +138,12 @@
} // namespace
+void RemoveTerminalFromRegistry(PrefService* prefs) {
+ DictionaryPrefUpdate update(prefs, guest_os::prefs::kGuestOsRegistry);
+ base::Value* apps = update.Get();
+ apps->RemoveKey(kCrostiniTerminalSystemAppId);
+}
+
const std::string& GetTerminalDefaultUrl() {
static const base::NoDestructor<std::string> url(base::StrCat(
{chrome::kChromeUIUntrustedTerminalURL, "html/terminal.html"}));
@@ -482,11 +490,6 @@
apps::mojom::MenuItemsPtr menu_items,
apps::mojom::Publisher::GetMenuModelCallback callback,
std::vector<gfx::ImageSkia> images) {
- if (!base::FeatureList::IsEnabled(chromeos::features::kTerminalSSH)) {
- std::move(callback).Run(std::move(menu_items));
- return;
- }
-
ui::ColorProvider* color_provider =
ui::ColorProviderManager::Get().GetColorProviderFor(
ui::NativeTheme::GetInstanceForWeb()->GetColorProviderKey(nullptr));
diff --git a/chrome/browser/ash/crostini/crostini_terminal.h b/chrome/browser/ash/crostini/crostini_terminal.h
index a7e1458..cf4196e 100644
--- a/chrome/browser/ash/crostini/crostini_terminal.h
+++ b/chrome/browser/ash/crostini/crostini_terminal.h
@@ -18,6 +18,10 @@
namespace crostini {
+// web_app::GenerateAppId(/*manifest_id=*/absl::nullopt,
+// GURL("chrome-untrusted://terminal/html/terminal.html"))
+extern const char kCrostiniTerminalSystemAppId[];
+
extern const char kTerminalHomePath[];
extern const char kShortcutKey[];
@@ -105,6 +109,9 @@
kMaxValue = kThemeVariations,
};
+// Remove Terminal app id from crostini.registry.<terminal-app-id>.
+void RemoveTerminalFromRegistry(PrefService* prefs);
+
const std::string& GetTerminalDefaultUrl();
// Generate URL to launch terminal.
diff --git a/chrome/browser/ash/crostini/crostini_util.cc b/chrome/browser/ash/crostini/crostini_util.cc
index 9621ded..584af9d 100644
--- a/chrome/browser/ash/crostini/crostini_util.cc
+++ b/chrome/browser/ash/crostini/crostini_util.cc
@@ -22,7 +22,6 @@
#include "chrome/browser/ash/crostini/crostini_features.h"
#include "chrome/browser/ash/crostini/crostini_manager.h"
#include "chrome/browser/ash/crostini/crostini_pref_names.h"
-#include "chrome/browser/ash/crostini/crostini_terminal.h"
#include "chrome/browser/ash/file_manager/path_util.h"
#include "chrome/browser/ash/guest_os/guest_os_mime_types_service.h"
#include "chrome/browser/ash/guest_os/guest_os_mime_types_service_factory.h"
@@ -53,10 +52,6 @@
namespace crostini {
-// web_app::GenerateAppId(/*manifest_id=*/absl::nullopt,
-// GURL("chrome-untrusted://terminal/html/terminal.html"))
-const char kCrostiniTerminalSystemAppId[] = "fhicihalidkgcimdmhpohldehjmcabcf";
-
const char kCrostiniImageAliasPattern[] = "debian/%s";
const char kCrostiniContainerDefaultVersion[] = "bullseye";
const char kCrostiniContainerFlag[] = "crostini-container-install-version";
@@ -239,8 +234,7 @@
}
bool IsUninstallable(Profile* profile, const std::string& app_id) {
- if (!CrostiniFeatures::Get()->IsEnabled(profile) ||
- app_id == kCrostiniTerminalSystemAppId) {
+ if (!CrostiniFeatures::Get()->IsEnabled(profile)) {
return false;
}
auto* registry_service =
@@ -359,27 +353,6 @@
return std::move(callback).Run(false, "Crostini UI not allowed");
}
- if (!base::FeatureList::IsEnabled(ash::features::kTerminalSSH) &&
- app_id == kCrostiniTerminalSystemAppId) {
- // Terminal supports a single directory as arg. If it exists, convert it
- // to an intent file.
- // TODO(crbug.com/1028898): This can be deleted when TerminalSSH flag
- // is removed, and we never register terminal as a crostini app.
- if (!args.empty() &&
- absl::holds_alternative<storage::FileSystemURL>(args[0])) {
- if (!intent) {
- intent = apps::mojom::Intent::New();
- }
- intent->files = std::vector<apps::mojom::IntentFilePtr>{};
- auto file = apps::mojom::IntentFile::New();
- file->url = absl::get<storage::FileSystemURL>(args[0]).ToGURL();
- intent->files->push_back(std::move(file));
- }
- LaunchTerminalWithIntent(profile, display_id, std::move(intent),
- std::move(callback));
- return;
- }
-
auto* crostini_manager = crostini::CrostiniManager::GetForProfile(profile);
auto* registry_service =
guest_os::GuestOsRegistryServiceFactory::GetForProfile(profile);
diff --git a/chrome/browser/ash/crostini/crostini_util.h b/chrome/browser/ash/crostini/crostini_util.h
index 256a1e4c..b8135ad2 100644
--- a/chrome/browser/ash/crostini/crostini_util.h
+++ b/chrome/browser/ash/crostini/crostini_util.h
@@ -37,10 +37,6 @@
namespace crostini {
-// web_app::GenerateAppId(/*manifest_id=*/absl::nullopt,
-// GURL("chrome-untrusted://terminal/html/terminal.html"))
-extern const char kCrostiniTerminalSystemAppId[];
-
extern const char kCrostiniImageAliasPattern[];
extern const char kCrostiniContainerDefaultVersion[];
extern const char kCrostiniContainerFlag[];
diff --git a/chrome/browser/ash/crostini/throttle/crostini_active_window_throttle_observer.cc b/chrome/browser/ash/crostini/throttle/crostini_active_window_throttle_observer.cc
index 67c3805..5bfc35c 100644
--- a/chrome/browser/ash/crostini/throttle/crostini_active_window_throttle_observer.cc
+++ b/chrome/browser/ash/crostini/throttle/crostini_active_window_throttle_observer.cc
@@ -6,7 +6,7 @@
#include "ash/constants/app_types.h"
#include "ash/public/cpp/window_properties.h"
-#include "chrome/browser/ash/crostini/crostini_util.h"
+#include "chrome/browser/ash/crostini/crostini_terminal.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
diff --git a/chrome/browser/ash/crostini/throttle/crostini_active_window_throttle_observer_unittest.cc b/chrome/browser/ash/crostini/throttle/crostini_active_window_throttle_observer_unittest.cc
index e0f6ab4..66f9286 100644
--- a/chrome/browser/ash/crostini/throttle/crostini_active_window_throttle_observer_unittest.cc
+++ b/chrome/browser/ash/crostini/throttle/crostini_active_window_throttle_observer_unittest.cc
@@ -7,7 +7,7 @@
#include "ash/constants/app_types.h"
#include "ash/public/cpp/window_properties.h"
#include "base/test/task_environment.h"
-#include "chrome/browser/ash/crostini/crostini_util.h"
+#include "chrome/browser/ash/crostini/crostini_terminal.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/test/test_window_delegate.h"
diff --git a/chrome/browser/ash/guest_os/guest_os_registry_service.cc b/chrome/browser/ash/guest_os/guest_os_registry_service.cc
index a139edd..a0455bfe 100644
--- a/chrome/browser/ash/guest_os/guest_os_registry_service.cc
+++ b/chrome/browser/ash/guest_os/guest_os_registry_service.cc
@@ -305,33 +305,6 @@
}
}
-// Creates a Terminal registration using partial values from prefs such as
-// last_launch_time.
-GuestOsRegistryService::Registration GetTerminalRegistration(
- const base::Value* pref) {
- std::string locale =
- l10n_util::NormalizeLocale(g_browser_process->GetApplicationLocale());
- vm_tools::apps::App app;
- SetLocaleString(app.mutable_name(), locale,
- l10n_util::GetStringUTF8(IDS_CROSTINI_TERMINAL_APP_NAME));
- app.add_mime_types(
- extensions::app_file_handler_util::kMimeTypeInodeDirectory);
- SetLocaleStrings(
- app.mutable_keywords(), locale,
- {"linux", "terminal", "crostini",
- l10n_util::GetStringUTF8(IDS_CROSTINI_TERMINAL_APP_SEARCH_TERMS)});
-
- base::Value pref_registration =
- pref ? pref->Clone() : base::Value(base::Value::Type::DICTIONARY);
- PopulatePrefRegistrationFromApp(
- pref_registration,
- GuestOsRegistryService::VmType::ApplicationList_VmType_TERMINA,
- crostini::kCrostiniDefaultVmName, crostini::kCrostiniDefaultContainerName,
- app, ProtoToDictionary(app.name()));
- return GuestOsRegistryService::Registration(
- crostini::kCrostiniTerminalSystemAppId, std::move(pref_registration));
-}
-
std::string GetStringKey(const base::Value& dict,
const base::StringPiece& key) {
if (!dict.is_dict()) {
@@ -574,17 +547,8 @@
const base::Value* apps =
prefs_->GetDictionary(guest_os::prefs::kGuestOsRegistry);
std::map<std::string, GuestOsRegistryService::Registration> result;
- // Register Terminal by merging optional prefs with app values.
- if (!base::FeatureList::IsEnabled(chromeos::features::kTerminalSSH)) {
- result.emplace(crostini::kCrostiniTerminalSystemAppId,
- GetTerminalRegistration(apps->FindKeyOfType(
- crostini::kCrostiniTerminalSystemAppId,
- base::Value::Type::DICTIONARY)));
- }
for (const auto item : apps->DictItems()) {
- if (item.first != crostini::kCrostiniTerminalSystemAppId) {
- result.emplace(item.first, Registration(item.first, item.second.Clone()));
- }
+ result.emplace(item.first, Registration(item.first, item.second.Clone()));
}
return result;
}
@@ -646,11 +610,6 @@
const base::Value* apps =
prefs_->GetDictionary(guest_os::prefs::kGuestOsRegistry);
- if (app_id == crostini::kCrostiniTerminalSystemAppId) {
- return GetTerminalRegistration(apps->FindKeyOfType(
- crostini::kCrostiniTerminalSystemAppId, base::Value::Type::DICTIONARY));
- }
-
const base::Value* pref_registration =
apps->FindKeyOfType(app_id, base::Value::Type::DICTIONARY);
if (!pref_registration) {
@@ -666,10 +625,6 @@
base::flat_map<int, int> num_apps;
for (const auto item : apps->DictItems()) {
- if (item.first == crostini::kCrostiniTerminalSystemAppId) {
- continue;
- }
-
absl::optional<bool> no_display =
item.second.FindBoolKey(guest_os::prefs::kAppNoDisplayKey);
if (no_display && no_display.value()) {
@@ -716,8 +671,7 @@
// Add container-badging to all crostini apps except the terminal, which is
// shared between containers. This is part of the multi-container UI, so is
// guarded by a flag.
- if (app_id != crostini::kCrostiniTerminalSystemAppId &&
- crostini::CrostiniFeatures::Get()->IsMultiContainerAllowed(profile_)) {
+ if (crostini::CrostiniFeatures::Get()->IsMultiContainerAllowed(profile_)) {
auto reg = GetRegistration(app_id);
if (reg && reg->VmType() == VmType::ApplicationList_VmType_TERMINA) {
callback = base::BindOnce(
@@ -888,9 +842,6 @@
base::Value* apps = update.Get();
for (const auto item : apps->DictItems()) {
- if (item.first == crostini::kCrostiniTerminalSystemAppId) {
- continue;
- }
Registration registration(item.first, item.second.Clone());
if (vm_type != registration.VmType()) {
continue;
@@ -1002,9 +953,6 @@
}
for (const auto item : apps->DictItems()) {
- if (item.first == crostini::kCrostiniTerminalSystemAppId) {
- continue;
- }
std::string vm_name =
GetStringKey(item.second, guest_os::prefs::kAppVmNameKey);
std::string container_name =
@@ -1089,16 +1037,8 @@
void GuestOsRegistryService::AppLaunched(const std::string& app_id) {
DictionaryPrefUpdate update(prefs_, guest_os::prefs::kGuestOsRegistry);
base::Value* apps = update.Get();
-
base::Value* app = apps->FindKey(app_id);
- if (!app) {
- DCHECK_EQ(app_id, crostini::kCrostiniTerminalSystemAppId);
- base::Value pref(base::Value::Type::DICTIONARY);
- SetCurrentTime(&pref, guest_os::prefs::kAppLastLaunchTimeKey);
- apps->SetKey(app_id, std::move(pref));
- return;
- }
-
+ DCHECK(app);
SetCurrentTime(app, guest_os::prefs::kAppLastLaunchTimeKey);
}
@@ -1111,8 +1051,6 @@
void GuestOsRegistryService::SetAppScaled(const std::string& app_id,
bool scaled) {
- DCHECK_NE(app_id, crostini::kCrostiniTerminalSystemAppId);
-
DictionaryPrefUpdate update(prefs_, guest_os::prefs::kGuestOsRegistry);
base::Value* apps = update.Get();
diff --git a/chrome/browser/ash/guest_os/guest_os_registry_service_unittest.cc b/chrome/browser/ash/guest_os/guest_os_registry_service_unittest.cc
index 64dc95c..3068c8f 100644
--- a/chrome/browser/ash/guest_os/guest_os_registry_service_unittest.cc
+++ b/chrome/browser/ash/guest_os/guest_os_registry_service_unittest.cc
@@ -6,9 +6,7 @@
#include <stddef.h>
-#include "ash/constants/ash_features.h"
#include "base/test/metrics/histogram_tester.h"
-#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_clock.h"
#include "chrome/browser/ash/crostini/crostini_pref_names.h"
#include "chrome/browser/ash/crostini/crostini_test_helper.h"
@@ -34,7 +32,6 @@
class GuestOsRegistryServiceTest : public testing::Test {
public:
GuestOsRegistryServiceTest() : crostini_test_helper_(&profile_) {
- features_.InitWithFeatures({ash::features::kTerminalSSH}, {});
RecreateService();
}
@@ -85,7 +82,6 @@
content::BrowserTaskEnvironment task_environment_;
TestingProfile profile_;
crostini::CrostiniTestHelper crostini_test_helper_;
- base::test::ScopedFeatureList features_;
std::unique_ptr<GuestOsRegistryService> service_;
};
@@ -266,9 +262,6 @@
app5.set_no_display(true);
*app_list.add_apps() = app5;
- // Force the registry to have a prefs entry for the Terminal.
- service()->AppLaunched(crostini::kCrostiniTerminalSystemAppId);
-
// Update the list of apps so that they can be counted.
service()->UpdateApplicationList(app_list);
diff --git a/chrome/browser/ash/policy/status_collector/device_status_collector.cc b/chrome/browser/ash/policy/status_collector/device_status_collector.cc
index e44eb5d2..9705a12 100644
--- a/chrome/browser/ash/policy/status_collector/device_status_collector.cc
+++ b/chrome/browser/ash/policy/status_collector/device_status_collector.cc
@@ -501,11 +501,6 @@
crostini::GetThreeDayWindowStart(last_launch_time).ToJavaTime());
}
- if (registration.app_id() == crostini::kCrostiniTerminalSystemAppId) {
- app->set_app_type(em::CROSTINI_APP_TYPE_TERMINAL);
- // We do not log package information if the App is the terminal:
- return true;
- }
app->set_app_type(em::CROSTINI_APP_TYPE_INTERACTIVE);
const std::string& package_id = registration.PackageId();
diff --git a/chrome/browser/ash/policy/status_collector/device_status_collector_browsertest.cc b/chrome/browser/ash/policy/status_collector/device_status_collector_browsertest.cc
index 99efa2b..90b65969 100644
--- a/chrome/browser/ash/policy/status_collector/device_status_collector_browsertest.cc
+++ b/chrome/browser/ash/policy/status_collector/device_status_collector_browsertest.cc
@@ -2247,9 +2247,7 @@
testing_profile_->GetPrefs()->SetBoolean(crostini::prefs::kCrostiniEnabled,
true);
scoped_feature_list_.InitWithFeatures(
- {features::kCrostiniAdditionalEnterpriseReporting,
- ash::features::kTerminalSSH},
- {});
+ {features::kCrostiniAdditionalEnterpriseReporting}, {});
const std::string desktop_file_id = "vim";
const std::string package_id =
diff --git a/chrome/browser/ash/policy/status_collector/legacy_device_status_collector.cc b/chrome/browser/ash/policy/status_collector/legacy_device_status_collector.cc
index ccc0a17..72a5570 100644
--- a/chrome/browser/ash/policy/status_collector/legacy_device_status_collector.cc
+++ b/chrome/browser/ash/policy/status_collector/legacy_device_status_collector.cc
@@ -498,11 +498,6 @@
crostini::GetThreeDayWindowStart(last_launch_time).ToJavaTime());
}
- if (registration.app_id() == crostini::kCrostiniTerminalSystemAppId) {
- app->set_app_type(em::CROSTINI_APP_TYPE_TERMINAL);
- // We do not log package information if the App is the terminal:
- return true;
- }
app->set_app_type(em::CROSTINI_APP_TYPE_INTERACTIVE);
const std::string& package_id = registration.PackageId();
diff --git a/chrome/browser/ash/policy/status_collector/legacy_device_status_collector_browsertest.cc b/chrome/browser/ash/policy/status_collector/legacy_device_status_collector_browsertest.cc
index f5ecf48..169651e 100644
--- a/chrome/browser/ash/policy/status_collector/legacy_device_status_collector_browsertest.cc
+++ b/chrome/browser/ash/policy/status_collector/legacy_device_status_collector_browsertest.cc
@@ -2272,9 +2272,7 @@
testing_profile_->GetPrefs()->SetBoolean(crostini::prefs::kCrostiniEnabled,
true);
scoped_feature_list_.InitWithFeatures(
- {features::kCrostiniAdditionalEnterpriseReporting,
- ash::features::kTerminalSSH},
- {});
+ {features::kCrostiniAdditionalEnterpriseReporting}, {});
const std::string desktop_file_id = "vim";
const std::string package_id =
diff --git a/chrome/browser/extensions/api/terminal/terminal_private_api.cc b/chrome/browser/extensions/api/terminal/terminal_private_api.cc
index b990ef5..93b1a24 100644
--- a/chrome/browser/extensions/api/terminal/terminal_private_api.cc
+++ b/chrome/browser/extensions/api/terminal/terminal_private_api.cc
@@ -693,8 +693,6 @@
info.SetBoolKey("tmux_integration",
base::FeatureList::IsEnabled(
chromeos::features::kTerminalTmuxIntegration));
- info.SetBoolKey(
- "ssh", base::FeatureList::IsEnabled(chromeos::features::kTerminalSSH));
return RespondNow(OneArgument(std::move(info)));
}
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
index 3c417182..25a64a2 100644
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
@@ -5748,11 +5748,6 @@
"expiry_milestone": -1
},
{
- "name": "terminal-ssh",
- "owners": [ "[email protected]", "joelhockey", "//chrome/browser/ash/guest_os/OWNERS" ],
- "expiry_milestone": 110
- },
- {
"name": "terminal-tmux-integration",
"owners": [ "lxj", "easy", "//chrome/browser/ash/guest_os/OWNERS" ],
"expiry_milestone": 106
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index cd68a03..52ade08 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -5394,10 +5394,6 @@
"Enables Terminal System App to load from Downloads for developer testing. "
"Only works in dev and canary channels.";
-const char kTerminalSSHName[] = "Terminal SSH tabs";
-const char kTerminalSSHDescription[] =
- "Enables SSH tabs in the Terminal System App.";
-
const char kTerminalTmuxIntegrationName[] = "Terminal tmux integration";
const char kTerminalTmuxIntegrationDescription[] =
"Enables integration with tmux control mode (tmux -CC) in the Terminal "
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index b8e52cde..697d726 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -3083,9 +3083,6 @@
extern const char kTerminalDevName[];
extern const char kTerminalDevDescription[];
-extern const char kTerminalSSHName[];
-extern const char kTerminalSSHDescription[];
-
extern const char kTerminalTmuxIntegrationName[];
extern const char kTerminalTmuxIntegrationDescription[];
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 42a9df7d..1c8b563 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -319,6 +319,7 @@
#include "chrome/browser/ash/crosapi/browser_util.h"
#include "chrome/browser/ash/crosapi/network_settings_service_ash.h"
#include "chrome/browser/ash/crostini/crostini_pref_names.h"
+#include "chrome/browser/ash/crostini/crostini_terminal.h"
#include "chrome/browser/ash/crostini/crostini_util.h"
#include "chrome/browser/ash/cryptauth/client_app_metadata_provider_service.h"
#include "chrome/browser/ash/cryptauth/cryptauth_device_id_provider_impl.h"
@@ -1886,6 +1887,12 @@
profile_prefs->ClearPref(kAccessCodeCastDiscoveredNetworks);
#endif // !BUILDFLAG(IS_ANDROID)
+#if BUILDFLAG(IS_CHROMEOS_ASH)
+ // Added 05/2022.
+ // TODO(crbug.com/1028898): Remove after M110.
+ crostini::RemoveTerminalFromRegistry(profile_prefs);
+#endif
+
// Please don't delete the following line. It is used by PRESUBMIT.py.
// END_MIGRATE_OBSOLETE_PROFILE_PREFS
diff --git a/chrome/browser/ui/app_list/app_service/app_service_app_item.cc b/chrome/browser/ui/app_list/app_service/app_service_app_item.cc
index 67cb372e..400b775a 100644
--- a/chrome/browser/ui/app_list/app_service/app_service_app_item.cc
+++ b/chrome/browser/ui/app_list/app_service/app_service_app_item.cc
@@ -107,8 +107,7 @@
}
// Crostini apps and the Terminal System App start in the crostini folder.
- if (app_type_ == apps::AppType::kCrostini ||
- id() == crostini::kCrostiniTerminalSystemAppId) {
+ if (app_type_ == apps::AppType::kCrostini) {
DCHECK(folder_id().empty());
SetChromeFolderId(ash::kCrostiniFolderId);
}
diff --git a/chrome/browser/ui/app_list/app_service/app_service_app_model_builder_unittest.cc b/chrome/browser/ui/app_list/app_service/app_service_app_model_builder_unittest.cc
index 818a862..bb2c59b 100644
--- a/chrome/browser/ui/app_list/app_service/app_service_app_model_builder_unittest.cc
+++ b/chrome/browser/ui/app_list/app_service/app_service_app_model_builder_unittest.cc
@@ -9,7 +9,6 @@
#include <string>
#include "ash/components/settings/cros_settings_names.h"
-#include "ash/constants/ash_features.h"
#include "ash/public/cpp/app_list/app_list_config.h"
#include "ash/public/cpp/app_list/app_list_types.h"
#include "base/files/file_path.h"
@@ -18,7 +17,6 @@
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
#include "base/test/scoped_command_line.h"
-#include "base/test/scoped_feature_list.h"
#include "base/values.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
@@ -716,10 +714,7 @@
class CrostiniAppTest : public AppServiceAppModelBuilderTest {
public:
- CrostiniAppTest() {
- features_.InitWithFeatures({ash::features::kTerminalSSH}, {});
- }
-
+ CrostiniAppTest() = default;
~CrostiniAppTest() override {}
CrostiniAppTest(const CrostiniAppTest&) = delete;
@@ -778,8 +773,7 @@
existing_item_ids.emplace_back(pair.first);
}
for (const std::string& id : existing_item_ids) {
- if (id == ash::kCrostiniFolderId ||
- id == crostini::kCrostiniTerminalSystemAppId) {
+ if (id == ash::kCrostiniFolderId) {
continue;
}
sync_service_->RemoveItem(id, /*is_uninstall=*/false);
@@ -818,7 +812,6 @@
std::unique_ptr<app_list::AppListSyncableService> sync_service_;
std::unique_ptr<CrostiniTestHelper> test_helper_;
- base::test::ScopedFeatureList features_;
private:
std::unique_ptr<
diff --git a/chrome/browser/ui/app_list/search/app_search_provider.cc b/chrome/browser/ui/app_list/search/app_search_provider.cc
index 47ca023..e7a799f 100644
--- a/chrome/browser/ui/app_list/search/app_search_provider.cc
+++ b/chrome/browser/ui/app_list/search/app_search_provider.cc
@@ -29,8 +29,6 @@
#include "base/time/clock.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/ash/crostini/crostini_features.h"
-#include "chrome/browser/ash/crostini/crostini_manager.h"
#include "chrome/browser/chromeos/extensions/gfx_utils.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profile.h"
@@ -64,10 +62,6 @@
// with extensions and ARC apps, to avoid successive reallocation.
constexpr size_t kMinimumReservedAppsContainerCapacity = 60U;
-// Relevance threshold to use when Crostini has not yet been enabled. This value
-// is somewhat arbitrary, but is roughly equivalent to the 'ter' in 'terminal'.
-constexpr double kCrostiniTerminalRelevanceThreshold = 0.8;
-
// Parameters for FuzzyTokenizedStringMatch.
constexpr bool kUsePrefixOnly = false;
constexpr bool kUseWeightedRatio = false;
@@ -374,15 +368,6 @@
update.Readiness() != apps::Readiness::kDisabledByPolicy);
apps_vector->back()->set_searchable(update.Searchable().value_or(false));
- // Until it's been installed, the Crostini Terminal is hidden and
- // requires a few characters before being shown in search results.
- if (update.AppId() == crostini::kCrostiniTerminalSystemAppId &&
- !crostini::CrostiniFeatures::Get()->IsEnabled(profile())) {
- apps_vector->back()->set_recommendable(false);
- apps_vector->back()->set_relevance_threshold(
- kCrostiniTerminalRelevanceThreshold);
- }
-
for (const std::string& term : update.AdditionalSearchTerms()) {
apps_vector->back()->AddSearchableText(base::UTF8ToUTF16(term));
}
diff --git a/chrome/browser/ui/ash/shelf/app_service/app_service_instance_registry_helper.cc b/chrome/browser/ui/ash/shelf/app_service/app_service_instance_registry_helper.cc
index 6789c35..29980b8b 100644
--- a/chrome/browser/ui/ash/shelf/app_service/app_service_instance_registry_helper.cc
+++ b/chrome/browser/ui/ash/shelf/app_service/app_service_instance_registry_helper.cc
@@ -14,7 +14,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/ash/crostini/crostini_util.h"
#include "chrome/browser/lifetime/browser_shutdown.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -401,11 +400,6 @@
bool AppServiceInstanceRegistryHelper::IsOpenedInBrowser(
const std::string& app_id,
aura::Window* window) const {
- // Crostini Terminal App with the app_id kCrostiniTerminalSystemAppId is a
- // System Web App.
- if (app_id == crostini::kCrostiniTerminalSystemAppId)
- return true;
-
// Windows created by exo with app/startup ids are not browser windows.
if (exo::GetShellApplicationId(window) || exo::GetShellStartupId(window))
return false;
diff --git a/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller_browsertest.cc b/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller_browsertest.cc
index f345824..26131c4 100644
--- a/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller_browsertest.cc
+++ b/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller_browsertest.cc
@@ -4,11 +4,9 @@
#include "chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.h"
-#include "ash/constants/ash_features.h"
#include "ash/public/cpp/shelf_model.h"
#include "ash/public/cpp/shelf_types.h"
#include "base/callback_helpers.h"
-#include "base/test/scoped_feature_list.h"
#include "chrome/browser/ash/crostini/crostini_terminal.h"
#include "chrome/browser/ui/ash/shelf/chrome_shelf_controller.h"
#include "chrome/browser/ui/ash/shelf/chrome_shelf_controller_util.h"
@@ -60,10 +58,6 @@
// which allows us to test app menu with either windows or tabs (shift click).
class AppShortcutShelfItemControllerBrowserTest : public InProcessBrowserTest {
protected:
- AppShortcutShelfItemControllerBrowserTest() {
- features_.InitWithFeatures({ash::features::kTerminalSSH}, {});
- }
-
void SetUpOnMainThread() override {
controller_ = ChromeShelfController::instance();
ASSERT_TRUE(controller_);
@@ -98,7 +92,6 @@
web_app::AppId app_id_;
ash::ShelfID app_shelf_id_;
- base::test::ScopedFeatureList features_;
};
// Test interacting with the app menu without shift key down: the app menu has
diff --git a/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc b/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc
index bfa248d..a48e45e9 100644
--- a/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/ash/crostini/crostini_installer.h"
#include "chrome/browser/ash/crostini/crostini_port_forwarder.h"
#include "chrome/browser/ash/crostini/crostini_pref_names.h"
+#include "chrome/browser/ash/crostini/crostini_terminal.h"
#include "chrome/browser/ash/crostini/crostini_types.mojom.h"
#include "chrome/browser/ash/crostini/crostini_util.h"
#include "chrome/browser/ash/file_manager/path_util.h"
@@ -397,10 +398,9 @@
}
void CrostiniHandler::LaunchTerminal(apps::mojom::IntentPtr intent) {
- crostini::LaunchCrostiniAppWithIntent(
- profile_, crostini::kCrostiniTerminalSystemAppId,
- display::Screen::GetScreen()->GetPrimaryDisplay().id(),
- std::move(intent));
+ crostini::LaunchTerminalWithIntent(
+ profile_, display::Screen::GetScreen()->GetPrimaryDisplay().id(),
+ std::move(intent), base::DoNothing());
}
void CrostiniHandler::HandleRequestContainerUpgradeView(
diff --git a/chrome/browser/web_applications/app_service/web_app_publisher_helper.cc b/chrome/browser/web_applications/app_service/web_app_publisher_helper.cc
index dec63611..c22dc4b 100644
--- a/chrome/browser/web_applications/app_service/web_app_publisher_helper.cc
+++ b/chrome/browser/web_applications/app_service/web_app_publisher_helper.cc
@@ -16,7 +16,6 @@
#include "base/check_op.h"
#include "base/containers/contains.h"
#include "base/containers/extend.h"
-#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/metrics/histogram_base.h"
@@ -80,7 +79,6 @@
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_features.h"
#include "chrome/browser/ash/crostini/crostini_terminal.h"
-#include "chrome/browser/ash/crostini/crostini_util.h"
#include "chrome/browser/ash/file_manager/app_id.h"
#include "chrome/browser/ash/login/demo_mode/demo_session.h"
#include "chrome/browser/chromeos/arc/arc_web_contents_data.h"
@@ -315,17 +313,6 @@
}
}
-// static
-bool WebAppPublisherHelper::Accepts(const std::string& app_id) {
-#if BUILDFLAG(IS_CHROMEOS_ASH)
- // Crostini Terminal System App is handled by Crostini Apps.
- return app_id != crostini::kCrostiniTerminalSystemAppId ||
- base::FeatureList::IsEnabled(chromeos::features::kTerminalSSH);
-#else
- return true;
-#endif
-}
-
void WebAppPublisherHelper::Shutdown() {
registrar_observation_.Reset();
content_settings_observation_.Reset();
@@ -912,7 +899,6 @@
#if BUILDFLAG(IS_CHROMEOS_ASH)
if (app_id == crostini::kCrostiniTerminalSystemAppId) {
- DCHECK(base::FeatureList::IsEnabled(chromeos::features::kTerminalSSH));
int64_t display_id =
window_info ? window_info->display_id : display::kInvalidDisplayId;
crostini::LaunchTerminalWithIntent(
@@ -965,7 +951,6 @@
#if BUILDFLAG(IS_CHROMEOS_ASH)
// Terminal SWA has custom launch code and manages its own restore data.
if (params.app_id == crostini::kCrostiniTerminalSystemAppId) {
- DCHECK(base::FeatureList::IsEnabled(chromeos::features::kTerminalSSH));
crostini::LaunchTerminalHome(profile_, params.display_id);
return nullptr;
}
@@ -1161,7 +1146,7 @@
const std::string& app_id,
blink::mojom::DisplayMode display_mode) {
const WebApp* web_app = GetWebApp(app_id);
- if (!web_app || !Accepts(app_id)) {
+ if (!web_app) {
return;
}
@@ -1174,7 +1159,7 @@
const std::string& app_id,
RunOnOsLoginMode run_on_os_login_mode) {
const WebApp* web_app = GetWebApp(app_id);
- if (!web_app || !Accepts(app_id)) {
+ if (!web_app) {
return;
}
@@ -1234,21 +1219,21 @@
void WebAppPublisherHelper::OnWebAppFileHandlerApprovalStateChanged(
const AppId& app_id) {
const WebApp* web_app = GetWebApp(app_id);
- if (web_app && Accepts(app_id)) {
+ if (web_app) {
delegate_->PublishWebApp(CreateWebApp(web_app));
}
}
void WebAppPublisherHelper::OnWebAppInstalled(const AppId& app_id) {
const WebApp* web_app = GetWebApp(app_id);
- if (web_app && Accepts(app_id)) {
+ if (web_app) {
delegate_->PublishWebApp(CreateWebApp(web_app));
}
}
void WebAppPublisherHelper::OnWebAppInstalledWithOsHooks(const AppId& app_id) {
const WebApp* web_app = GetWebApp(app_id);
- if (web_app && Accepts(app_id)) {
+ if (web_app) {
delegate_->PublishWebApp(CreateWebApp(web_app));
}
}
@@ -1257,14 +1242,14 @@
const AppId& app_id,
base::StringPiece old_name) {
const WebApp* web_app = GetWebApp(app_id);
- if (web_app && Accepts(app_id)) {
+ if (web_app) {
delegate_->PublishWebApp(CreateWebApp(web_app));
}
}
void WebAppPublisherHelper::OnWebAppWillBeUninstalled(const AppId& app_id) {
const WebApp* web_app = GetWebApp(app_id);
- if (!web_app || !Accepts(app_id)) {
+ if (!web_app) {
return;
}
@@ -1293,7 +1278,7 @@
const AppId& app_id,
bool is_locally_installed) {
const WebApp* web_app = GetWebApp(app_id);
- if (!web_app || !Accepts(app_id)) {
+ if (!web_app) {
return;
}
@@ -1304,7 +1289,7 @@
const std::string& app_id,
const base::Time& last_launch_time) {
const WebApp* web_app = GetWebApp(app_id);
- if (!web_app || !Accepts(app_id)) {
+ if (!web_app) {
return;
}
@@ -1330,7 +1315,7 @@
void WebAppPublisherHelper::OnWebAppDisabledStateChanged(const AppId& app_id,
bool is_disabled) {
const WebApp* web_app = GetWebApp(app_id);
- if (!web_app || !Accepts(app_id)) {
+ if (!web_app) {
return;
}
@@ -1359,7 +1344,7 @@
// enabled app.
if (provider_->policy_manager().IsWebAppInDisabledList(id)) {
const WebApp* web_app = GetWebApp(id);
- if (!web_app || !Accepts(id)) {
+ if (!web_app) {
continue;
}
auto app = std::make_unique<apps::App>(app_type(), web_app->app_id());
@@ -1427,7 +1412,7 @@
}
const WebApp* web_app = GetWebApp(app_id.value());
- if (!web_app || !Accepts(app_id.value())) {
+ if (!web_app) {
return;
}
@@ -1454,7 +1439,7 @@
}
const WebApp* web_app = GetWebApp(app_id.value());
- if (!web_app || !Accepts(app_id.value())) {
+ if (!web_app) {
return;
}
@@ -1477,8 +1462,7 @@
}
for (const WebApp& web_app : registrar().GetApps()) {
- if (primary_pattern.Matches(web_app.start_url()) &&
- Accepts(web_app.app_id())) {
+ if (primary_pattern.Matches(web_app.start_url())) {
auto app = std::make_unique<apps::App>(app_type(), web_app.app_id());
app->permissions = CreatePermissions(&web_app);
delegate_->PublishWebApp(std::move(app));
@@ -1669,7 +1653,7 @@
const std::string& app_id,
const std::string& notification_id) {
const WebApp* web_app = GetWebApp(app_id);
- if (!web_app || !Accepts(app_id)) {
+ if (!web_app) {
return false;
}
diff --git a/chrome/browser/web_applications/app_service/web_app_publisher_helper.h b/chrome/browser/web_applications/app_service/web_app_publisher_helper.h
index 023e334..11024d4 100644
--- a/chrome/browser/web_applications/app_service/web_app_publisher_helper.h
+++ b/chrome/browser/web_applications/app_service/web_app_publisher_helper.h
@@ -135,9 +135,6 @@
ConvertUninstallSourceToWebAppUninstallSource(
apps::mojom::UninstallSource uninstall_source);
- // Returns true if the app is published as a web app.
- static bool Accepts(const std::string& app_id);
-
// Must be called before profile keyed services are destroyed.
void Shutdown();
diff --git a/chrome/browser/web_applications/app_service/web_apps.cc b/chrome/browser/web_applications/app_service/web_apps.cc
index dc6714d..1af6c14 100644
--- a/chrome/browser/web_applications/app_service/web_apps.cc
+++ b/chrome/browser/web_applications/app_service/web_apps.cc
@@ -8,7 +8,6 @@
#include "base/callback.h"
#include "base/callback_helpers.h"
-#include "base/feature_list.h"
#include "chrome/browser/apps/app_service/app_launch_params.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/intent_util.h"
@@ -29,7 +28,6 @@
#include "components/webapps/browser/installable/installable_metrics.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
-#include "ash/constants/ash_features.h"
#include "ash/public/cpp/app_menu_constants.h"
#include "ash/webui/projector_app/public/cpp/projector_app_constants.h" // nogncheck
#include "base/bind.h"
@@ -38,7 +36,6 @@
#include "chrome/browser/apps/app_service/menu_util.h"
#include "chrome/browser/ash/crosapi/browser_util.h"
#include "chrome/browser/ash/crostini/crostini_terminal.h"
-#include "chrome/browser/ash/crostini/crostini_util.h"
#include "chrome/browser/web_applications/web_app_icon_manager.h"
#include "chrome/grit/generated_resources.h"
#include "components/services/app_service/public/cpp/app_registry_cache.h"
@@ -117,10 +114,6 @@
return provider_->registrar().GetAppById(app_id);
}
-bool WebApps::Accepts(const std::string& app_id) const {
- return WebAppPublisherHelper::Accepts(app_id);
-}
-
void WebApps::Initialize(
const mojo::Remote<apps::mojom::AppService>& app_service) {
DCHECK(profile_);
@@ -317,9 +310,7 @@
std::vector<apps::AppPtr> apps;
for (const WebApp& web_app : provider_->registrar().GetApps()) {
- if (Accepts(web_app.app_id())) {
- apps.push_back(publisher_helper().CreateWebApp(&web_app));
- }
+ apps.push_back(publisher_helper().CreateWebApp(&web_app));
}
return apps;
}
@@ -331,9 +322,7 @@
}
for (const WebApp& web_app : provider_->registrar().GetApps()) {
- if (Accepts(web_app.app_id())) {
- apps_out->push_back(publisher_helper().ConvertWebApp(&web_app));
- }
+ apps_out->push_back(publisher_helper().ConvertWebApp(&web_app));
}
}
@@ -424,7 +413,6 @@
}
if (app_id == crostini::kCrostiniTerminalSystemAppId) {
- DCHECK(base::FeatureList::IsEnabled(chromeos::features::kTerminalSSH));
crostini::AddTerminalMenuItems(profile_, &menu_items);
}
@@ -445,7 +433,6 @@
}
if (app_id == crostini::kCrostiniTerminalSystemAppId) {
- DCHECK(base::FeatureList::IsEnabled(chromeos::features::kTerminalSSH));
crostini::AddTerminalMenuShortcuts(profile_, ash::LAUNCH_APP_SHORTCUT_FIRST,
std::move(menu_items),
std::move(callback));
@@ -540,7 +527,6 @@
const std::string& shortcut_id,
int64_t display_id) {
if (app_id == crostini::kCrostiniTerminalSystemAppId) {
- DCHECK(base::FeatureList::IsEnabled(chromeos::features::kTerminalSSH));
if (crostini::ExecuteTerminalMenuShortcutCommand(profile_, shortcut_id,
display_id)) {
return;
diff --git a/chrome/browser/web_applications/app_service/web_apps.h b/chrome/browser/web_applications/app_service/web_apps.h
index bc742532..2f92ef35 100644
--- a/chrome/browser/web_applications/app_service/web_apps.h
+++ b/chrome/browser/web_applications/app_service/web_apps.h
@@ -69,8 +69,6 @@
protected:
const WebApp* GetWebApp(const AppId& app_id) const;
- bool Accepts(const std::string& app_id) const;
-
const mojo::RemoteSet<apps::mojom::Subscriber>& subscribers() const {
return subscribers_;
}