Commit 418db2f4 authored by Jason Lin's avatar Jason Lin Committed by Commit Bot

Rename two names in plugin_vm_util.h

* kPluginVmAppId -> kPluginVmShelfAppId: This id is also used by Plugin
  VM installer as the shelf id on the window. Rename to make it clearer.
* IsPluginVmWindow() -> IsPluginVmAppWindow(): This function only return
  true for the Plugin VM app window but not the installer window. Rename
  to make it clearer.

Bug: 1087726
Change-Id: Ib7cf899133ed970bd795c859ac740f5c15f77b23
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2247460Reviewed-by: default avatarTimothy Loh <timloh@chromium.org>
Reviewed-by: default avatarNancy Wang <nancylingwang@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Jason Lin <lxj@google.com>
Cr-Commit-Position: refs/heads/master@{#779549}
parent f40b218b
...@@ -246,7 +246,7 @@ void RecordAppLaunch(const std::string& app_id, ...@@ -246,7 +246,7 @@ void RecordAppLaunch(const std::string& app_id,
} else if (app_id == ash::kInternalAppIdDiscover) { } else if (app_id == ash::kInternalAppIdDiscover) {
RecordBuiltInAppLaunch(BuiltInAppName::kDiscover, launch_source); RecordBuiltInAppLaunch(BuiltInAppName::kDiscover, launch_source);
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
} else if (app_id == plugin_vm::kPluginVmAppId) { } else if (app_id == plugin_vm::kPluginVmShelfAppId) {
RecordBuiltInAppLaunch(BuiltInAppName::kPluginVm, launch_source); RecordBuiltInAppLaunch(BuiltInAppName::kPluginVm, launch_source);
#endif // OS_CHROMEOS #endif // OS_CHROMEOS
} else if (app_id == ash::kReleaseNotesAppId) { } else if (app_id == ash::kReleaseNotesAppId) {
...@@ -268,7 +268,7 @@ void RecordBuiltInAppSearchResult(const std::string& app_id) { ...@@ -268,7 +268,7 @@ void RecordBuiltInAppSearchResult(const std::string& app_id) {
base::UmaHistogramEnumeration("Apps.AppListSearchResultInternalApp.Show", base::UmaHistogramEnumeration("Apps.AppListSearchResultInternalApp.Show",
BuiltInAppName::kDiscover); BuiltInAppName::kDiscover);
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
} else if (app_id == plugin_vm::kPluginVmAppId) { } else if (app_id == plugin_vm::kPluginVmShelfAppId) {
base::UmaHistogramEnumeration("Apps.AppListSearchResultInternalApp.Show", base::UmaHistogramEnumeration("Apps.AppListSearchResultInternalApp.Show",
BuiltInAppName::kPluginVm); BuiltInAppName::kPluginVm);
#endif // OS_CHROMEOS #endif // OS_CHROMEOS
......
...@@ -87,7 +87,7 @@ void PopulatePermissions(apps::mojom::App* app, Profile* profile) { ...@@ -87,7 +87,7 @@ void PopulatePermissions(apps::mojom::App* app, Profile* profile) {
apps::mojom::AppPtr GetPluginVmApp(Profile* profile, bool allowed) { apps::mojom::AppPtr GetPluginVmApp(Profile* profile, bool allowed) {
apps::mojom::AppPtr app = apps::PublisherBase::MakeApp( apps::mojom::AppPtr app = apps::PublisherBase::MakeApp(
apps::mojom::AppType::kPluginVm, plugin_vm::kPluginVmAppId, apps::mojom::AppType::kPluginVm, plugin_vm::kPluginVmShelfAppId,
allowed ? apps::mojom::Readiness::kReady allowed ? apps::mojom::Readiness::kReady
: apps::mojom::Readiness::kDisabledByPolicy, : apps::mojom::Readiness::kDisabledByPolicy,
l10n_util::GetStringUTF8(IDS_PLUGIN_VM_APP_NAME), l10n_util::GetStringUTF8(IDS_PLUGIN_VM_APP_NAME),
...@@ -167,7 +167,7 @@ void PluginVmApps::Launch(const std::string& app_id, ...@@ -167,7 +167,7 @@ void PluginVmApps::Launch(const std::string& app_id,
int32_t event_flags, int32_t event_flags,
apps::mojom::LaunchSource launch_source, apps::mojom::LaunchSource launch_source,
int64_t display_id) { int64_t display_id) {
DCHECK_EQ(plugin_vm::kPluginVmAppId, app_id); DCHECK_EQ(plugin_vm::kPluginVmShelfAppId, app_id);
if (plugin_vm::IsPluginVmEnabled(profile_)) { if (plugin_vm::IsPluginVmEnabled(profile_)) {
plugin_vm::PluginVmManagerFactory::GetForProfile(profile_)->LaunchPluginVm( plugin_vm::PluginVmManagerFactory::GetForProfile(profile_)->LaunchPluginVm(
base::DoNothing()); base::DoNothing());
...@@ -189,7 +189,7 @@ void PluginVmApps::SetPermission(const std::string& app_id, ...@@ -189,7 +189,7 @@ void PluginVmApps::SetPermission(const std::string& app_id,
apps::mojom::AppPtr app = apps::mojom::App::New(); apps::mojom::AppPtr app = apps::mojom::App::New();
app->app_type = apps::mojom::AppType::kPluginVm; app->app_type = apps::mojom::AppType::kPluginVm;
app->app_id = plugin_vm::kPluginVmAppId; app->app_id = plugin_vm::kPluginVmShelfAppId;
PopulatePermissions(app.get(), profile_); PopulatePermissions(app.get(), profile_);
Publish(std::move(app), subscribers_); Publish(std::move(app), subscribers_);
} }
...@@ -216,7 +216,7 @@ void PluginVmApps::GetMenuModel(const std::string& app_id, ...@@ -216,7 +216,7 @@ void PluginVmApps::GetMenuModel(const std::string& app_id,
AddCommandItem(ash::MENU_CLOSE, IDS_SHELF_CONTEXT_MENU_CLOSE, &menu_items); AddCommandItem(ash::MENU_CLOSE, IDS_SHELF_CONTEXT_MENU_CLOSE, &menu_items);
} }
if (app_id == plugin_vm::kPluginVmAppId && if (app_id == plugin_vm::kPluginVmShelfAppId &&
plugin_vm::IsPluginVmRunning(profile_)) { plugin_vm::IsPluginVmRunning(profile_)) {
AddCommandItem(ash::SHUTDOWN_GUEST_OS, IDS_PLUGIN_VM_SHUT_DOWN_MENU_ITEM, AddCommandItem(ash::SHUTDOWN_GUEST_OS, IDS_PLUGIN_VM_SHUT_DOWN_MENU_ITEM,
&menu_items); &menu_items);
...@@ -232,7 +232,7 @@ void PluginVmApps::OnPluginVmAllowedChanged(bool is_allowed) { ...@@ -232,7 +232,7 @@ void PluginVmApps::OnPluginVmAllowedChanged(bool is_allowed) {
apps::mojom::AppPtr app = apps::mojom::App::New(); apps::mojom::AppPtr app = apps::mojom::App::New();
app->app_type = apps::mojom::AppType::kPluginVm; app->app_type = apps::mojom::AppType::kPluginVm;
app->app_id = plugin_vm::kPluginVmAppId; app->app_id = plugin_vm::kPluginVmShelfAppId;
SetAppAllowed(app.get(), is_allowed); SetAppAllowed(app.get(), is_allowed);
Publish(std::move(app), subscribers_); Publish(std::move(app), subscribers_);
} }
...@@ -241,7 +241,7 @@ void PluginVmApps::OnPluginVmConfiguredChanged() { ...@@ -241,7 +241,7 @@ void PluginVmApps::OnPluginVmConfiguredChanged() {
// Only changed fields need to be republished. // Only changed fields need to be republished.
apps::mojom::AppPtr app = apps::mojom::App::New(); apps::mojom::AppPtr app = apps::mojom::App::New();
app->app_type = apps::mojom::AppType::kPluginVm; app->app_type = apps::mojom::AppType::kPluginVm;
app->app_id = plugin_vm::kPluginVmAppId; app->app_id = plugin_vm::kPluginVmShelfAppId;
SetShowInAppManagement(app.get(), plugin_vm::IsPluginVmConfigured(profile_)); SetShowInAppManagement(app.get(), plugin_vm::IsPluginVmConfigured(profile_));
Publish(std::move(app), subscribers_); Publish(std::move(app), subscribers_);
} }
......
...@@ -104,7 +104,7 @@ void PluginVmServiceProvider::ShowSettingsPage( ...@@ -104,7 +104,7 @@ void PluginVmServiceProvider::ShowSettingsPage(
Profile* profile = ProfileManager::GetPrimaryUserProfile(); Profile* profile = ProfileManager::GetPrimaryUserProfile();
if (request.subpage_path() == kShowSettingsPageDetails) { if (request.subpage_path() == kShowSettingsPageDetails) {
chrome::ShowAppManagementPage( chrome::ShowAppManagementPage(
profile, plugin_vm::kPluginVmAppId, profile, plugin_vm::kPluginVmShelfAppId,
AppManagementEntryPoint::kDBusServicePluginVm); AppManagementEntryPoint::kDBusServicePluginVm);
} else if (request.subpage_path() == kShowSettingsPageSharedPaths) { } else if (request.subpage_path() == kShowSettingsPageSharedPaths) {
chrome::SettingsWindowManager::GetInstance()->ShowOSSettings( chrome::SettingsWindowManager::GetInstance()->ShowOSSettings(
......
...@@ -57,7 +57,7 @@ PluginVmEngagementMetricsService::PluginVmEngagementMetricsService( ...@@ -57,7 +57,7 @@ PluginVmEngagementMetricsService::PluginVmEngagementMetricsService(
return; return;
guest_os_engagement_metrics_ = guest_os_engagement_metrics_ =
std::make_unique<guest_os::GuestOsEngagementMetrics>( std::make_unique<guest_os::GuestOsEngagementMetrics>(
profile->GetPrefs(), base::BindRepeating(IsPluginVmWindow), profile->GetPrefs(), base::BindRepeating(IsPluginVmAppWindow),
prefs::kEngagementPrefsPrefix, kUmaPrefix); prefs::kEngagementPrefsPrefix, kUmaPrefix);
} }
......
...@@ -66,7 +66,7 @@ void FocusAllPluginVmWindows() { ...@@ -66,7 +66,7 @@ void FocusAllPluginVmWindows() {
DCHECK(shelf_model); DCHECK(shelf_model);
AppWindowLauncherItemController* launcher_item_controller = AppWindowLauncherItemController* launcher_item_controller =
shelf_model->GetAppWindowLauncherItemController( shelf_model->GetAppWindowLauncherItemController(
ash::ShelfID(kPluginVmAppId)); ash::ShelfID(kPluginVmShelfAppId));
if (!launcher_item_controller) { if (!launcher_item_controller) {
return; return;
} }
......
...@@ -155,10 +155,10 @@ TEST_F(PluginVmFilesTest, LaunchPluginVmApp) { ...@@ -155,10 +155,10 @@ TEST_F(PluginVmFilesTest, LaunchPluginVmApp) {
auto launcher_item_controller = auto launcher_item_controller =
std::make_unique<AppWindowLauncherItemController>( std::make_unique<AppWindowLauncherItemController>(
ash::ShelfID(kPluginVmAppId)); ash::ShelfID(kPluginVmShelfAppId));
ui::test::MockBaseWindow mock_window; ui::test::MockBaseWindow mock_window;
launcher_item_controller->AddWindow(&mock_window); launcher_item_controller->AddWindow(&mock_window);
shelf_model.SetShelfItemDelegate(ash::ShelfID(kPluginVmAppId), shelf_model.SetShelfItemDelegate(ash::ShelfID(kPluginVmShelfAppId),
std::move(launcher_item_controller)); std::move(launcher_item_controller));
vm_tools::cicerone::LaunchContainerApplicationResponse response; vm_tools::cicerone::LaunchContainerApplicationResponse response;
response.set_success(true); response.set_success(true);
......
...@@ -133,8 +133,8 @@ void PluginVmManagerImpl::LaunchPluginVm(LaunchPluginVmCallback callback) { ...@@ -133,8 +133,8 @@ void PluginVmManagerImpl::LaunchPluginVm(LaunchPluginVmCallback callback) {
ChromeLauncherController::instance() ChromeLauncherController::instance()
->GetShelfSpinnerController() ->GetShelfSpinnerController()
->AddSpinnerToShelf( ->AddSpinnerToShelf(
kPluginVmAppId, kPluginVmShelfAppId,
std::make_unique<ShelfSpinnerItemController>(kPluginVmAppId)); std::make_unique<ShelfSpinnerItemController>(kPluginVmShelfAppId));
} }
// Launching Plugin Vm goes through the following steps: // Launching Plugin Vm goes through the following steps:
...@@ -243,7 +243,8 @@ void PluginVmManagerImpl::OnVmStateChanged( ...@@ -243,7 +243,8 @@ void PluginVmManagerImpl::OnVmStateChanged(
// The previous seneschal handle is no longer valid. // The previous seneschal handle is no longer valid.
seneschal_server_handle_ = 0; seneschal_server_handle_ = 0;
ChromeLauncherController::instance()->Close(ash::ShelfID(kPluginVmAppId)); ChromeLauncherController::instance()->Close(
ash::ShelfID(kPluginVmShelfAppId));
} }
auto* engagement_metrics_service = auto* engagement_metrics_service =
...@@ -514,7 +515,7 @@ void PluginVmManagerImpl::LaunchFailed(PluginVmLaunchResult result) { ...@@ -514,7 +515,7 @@ void PluginVmManagerImpl::LaunchFailed(PluginVmLaunchResult result) {
ChromeLauncherController::instance() ChromeLauncherController::instance()
->GetShelfSpinnerController() ->GetShelfSpinnerController()
->CloseSpinner(kPluginVmAppId); ->CloseSpinner(kPluginVmShelfAppId);
pending_start_vm_ = false; pending_start_vm_ = false;
pending_vm_tools_installed_ = false; pending_vm_tools_installed_ = false;
......
...@@ -232,7 +232,7 @@ TEST_F(PluginVmManagerImplTest, OnStateChangedRunningStoppedSuspended) { ...@@ -232,7 +232,7 @@ TEST_F(PluginVmManagerImplTest, OnStateChangedRunningStoppedSuspended) {
// Signals for RUNNING, then STOPPED. // Signals for RUNNING, then STOPPED.
test_helper_->OpenShelfItem(); test_helper_->OpenShelfItem();
EXPECT_TRUE( EXPECT_TRUE(
chrome_launcher_controller_->IsOpen(ash::ShelfID(kPluginVmAppId))); chrome_launcher_controller_->IsOpen(ash::ShelfID(kPluginVmShelfAppId)));
NotifyVmStateChanged(vm_tools::plugin_dispatcher::VmState::VM_STATE_RUNNING); NotifyVmStateChanged(vm_tools::plugin_dispatcher::VmState::VM_STATE_RUNNING);
task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
...@@ -246,7 +246,7 @@ TEST_F(PluginVmManagerImplTest, OnStateChangedRunningStoppedSuspended) { ...@@ -246,7 +246,7 @@ TEST_F(PluginVmManagerImplTest, OnStateChangedRunningStoppedSuspended) {
task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
EXPECT_EQ(plugin_vm_manager_->seneschal_server_handle(), 0ul); EXPECT_EQ(plugin_vm_manager_->seneschal_server_handle(), 0ul);
EXPECT_FALSE( EXPECT_FALSE(
chrome_launcher_controller_->IsOpen(ash::ShelfID(kPluginVmAppId))); chrome_launcher_controller_->IsOpen(ash::ShelfID(kPluginVmShelfAppId)));
// Signals for RUNNING, then SUSPENDED. // Signals for RUNNING, then SUSPENDED.
NotifyVmStateChanged(vm_tools::plugin_dispatcher::VmState::VM_STATE_RUNNING); NotifyVmStateChanged(vm_tools::plugin_dispatcher::VmState::VM_STATE_RUNNING);
...@@ -264,7 +264,7 @@ TEST_F(PluginVmManagerImplTest, LaunchPluginVmSpinner) { ...@@ -264,7 +264,7 @@ TEST_F(PluginVmManagerImplTest, LaunchPluginVmSpinner) {
EXPECT_TRUE(IsPluginVmAllowedForProfile(testing_profile_.get())); EXPECT_TRUE(IsPluginVmAllowedForProfile(testing_profile_.get()));
// No spinner before doing anything // No spinner before doing anything
EXPECT_FALSE(SpinnerController()->HasApp(kPluginVmAppId)); EXPECT_FALSE(SpinnerController()->HasApp(kPluginVmShelfAppId));
SetListVmsResponse(vm_tools::plugin_dispatcher::VmState::VM_STATE_STOPPED); SetListVmsResponse(vm_tools::plugin_dispatcher::VmState::VM_STATE_STOPPED);
...@@ -272,17 +272,17 @@ TEST_F(PluginVmManagerImplTest, LaunchPluginVmSpinner) { ...@@ -272,17 +272,17 @@ TEST_F(PluginVmManagerImplTest, LaunchPluginVmSpinner) {
task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
// Spinner exists for first launch. // Spinner exists for first launch.
EXPECT_TRUE(SpinnerController()->HasApp(kPluginVmAppId)); EXPECT_TRUE(SpinnerController()->HasApp(kPluginVmShelfAppId));
// The actual flow would've launched a real window. // The actual flow would've launched a real window.
test_helper_->OpenShelfItem(); test_helper_->OpenShelfItem();
EXPECT_FALSE(SpinnerController()->HasApp(kPluginVmAppId)); EXPECT_FALSE(SpinnerController()->HasApp(kPluginVmShelfAppId));
test_helper_->CloseShelfItem(); test_helper_->CloseShelfItem();
plugin_vm_manager_->LaunchPluginVm(base::DoNothing()); plugin_vm_manager_->LaunchPluginVm(base::DoNothing());
task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
// A second launch shouldn't show a spinner. // A second launch shouldn't show a spinner.
EXPECT_FALSE(SpinnerController()->HasApp(kPluginVmAppId)); EXPECT_FALSE(SpinnerController()->HasApp(kPluginVmShelfAppId));
} }
TEST_F(PluginVmManagerImplTest, LaunchPluginVmFromSuspending) { TEST_F(PluginVmManagerImplTest, LaunchPluginVmFromSuspending) {
...@@ -301,7 +301,7 @@ TEST_F(PluginVmManagerImplTest, LaunchPluginVmFromSuspending) { ...@@ -301,7 +301,7 @@ TEST_F(PluginVmManagerImplTest, LaunchPluginVmFromSuspending) {
EXPECT_TRUE(VmPluginDispatcherClient().list_vms_called()); EXPECT_TRUE(VmPluginDispatcherClient().list_vms_called());
EXPECT_FALSE(VmPluginDispatcherClient().start_vm_called()); EXPECT_FALSE(VmPluginDispatcherClient().start_vm_called());
EXPECT_FALSE(VmPluginDispatcherClient().show_vm_called()); EXPECT_FALSE(VmPluginDispatcherClient().show_vm_called());
EXPECT_TRUE(SpinnerController()->HasApp(kPluginVmAppId)); EXPECT_TRUE(SpinnerController()->HasApp(kPluginVmShelfAppId));
// The launch process continues once the operation completes. // The launch process continues once the operation completes.
NotifyVmStateChanged( NotifyVmStateChanged(
......
...@@ -41,7 +41,7 @@ class FakeShelfItemDelegate : public ash::ShelfItemDelegate { ...@@ -41,7 +41,7 @@ class FakeShelfItemDelegate : public ash::ShelfItemDelegate {
int64_t display_id) override {} int64_t display_id) override {}
void Close() override { void Close() override {
ChromeLauncherController::instance()->CloseLauncherItem( ChromeLauncherController::instance()->CloseLauncherItem(
ash::ShelfID(kPluginVmAppId)); ash::ShelfID(kPluginVmShelfAppId));
} }
}; };
...@@ -139,7 +139,7 @@ void PluginVmTestHelper::AllowPluginVm() { ...@@ -139,7 +139,7 @@ void PluginVmTestHelper::AllowPluginVm() {
} }
void PluginVmTestHelper::OpenShelfItem() { void PluginVmTestHelper::OpenShelfItem() {
ash::ShelfID shelf_id(kPluginVmAppId); ash::ShelfID shelf_id(kPluginVmShelfAppId);
std::unique_ptr<ash::ShelfItemDelegate> delegate = std::unique_ptr<ash::ShelfItemDelegate> delegate =
std::make_unique<FakeShelfItemDelegate>(shelf_id); std::make_unique<FakeShelfItemDelegate>(shelf_id);
ChromeLauncherController* laucher_controller = ChromeLauncherController* laucher_controller =
...@@ -157,7 +157,8 @@ void PluginVmTestHelper::OpenShelfItem() { ...@@ -157,7 +157,8 @@ void PluginVmTestHelper::OpenShelfItem() {
} }
void PluginVmTestHelper::CloseShelfItem() { void PluginVmTestHelper::CloseShelfItem() {
ChromeLauncherController::instance()->Close(ash::ShelfID(kPluginVmAppId)); ChromeLauncherController::instance()->Close(
ash::ShelfID(kPluginVmShelfAppId));
} }
} // namespace plugin_vm } // namespace plugin_vm
...@@ -123,10 +123,10 @@ bool IsPluginVmRunning(Profile* profile) { ...@@ -123,10 +123,10 @@ bool IsPluginVmRunning(Profile* profile) {
->vm_state() == ->vm_state() ==
vm_tools::plugin_dispatcher::VmState::VM_STATE_RUNNING && vm_tools::plugin_dispatcher::VmState::VM_STATE_RUNNING &&
ChromeLauncherController::instance()->IsOpen( ChromeLauncherController::instance()->IsOpen(
ash::ShelfID(kPluginVmAppId)); ash::ShelfID(kPluginVmShelfAppId));
} }
bool IsPluginVmWindow(const aura::Window* window) { bool IsPluginVmAppWindow(const aura::Window* window) {
const std::string* app_id = exo::GetShellApplicationId(window); const std::string* app_id = exo::GetShellApplicationId(window);
if (!app_id) if (!app_id)
return false; return false;
......
...@@ -28,7 +28,7 @@ class PluginVmPolicySubscription; ...@@ -28,7 +28,7 @@ class PluginVmPolicySubscription;
// This is used by both the Plugin VM app and its installer. // This is used by both the Plugin VM app and its installer.
// Generated as crx_file::id_util::GenerateId("org.chromium.plugin_vm"); // Generated as crx_file::id_util::GenerateId("org.chromium.plugin_vm");
constexpr char kPluginVmAppId[] = "lgjpclljbbmphhnalkeplcmnjpfmmaek"; constexpr char kPluginVmShelfAppId[] = "lgjpclljbbmphhnalkeplcmnjpfmmaek";
// Name of the Plugin VM. // Name of the Plugin VM.
constexpr char kPluginVmName[] = "PvmDefault"; constexpr char kPluginVmName[] = "PvmDefault";
...@@ -74,7 +74,7 @@ void ShowPluginVmInstallerView(Profile* profile); ...@@ -74,7 +74,7 @@ void ShowPluginVmInstallerView(Profile* profile);
// Checks if an window is for the Plugin VM app. Note that it returns false for // Checks if an window is for the Plugin VM app. Note that it returns false for
// the Plugin VM installer. // the Plugin VM installer.
bool IsPluginVmWindow(const aura::Window* window); bool IsPluginVmAppWindow(const aura::Window* window);
// Retrieves the license key to be used for Plugin VM. If // Retrieves the license key to be used for Plugin VM. If
// none is set this will return an empty string. // none is set this will return an empty string.
......
...@@ -130,7 +130,7 @@ void AppServiceContextMenu::ExecuteCommand(int command_id, int event_flags) { ...@@ -130,7 +130,7 @@ void AppServiceContextMenu::ExecuteCommand(int command_id, int event_flags) {
if (app_id() == crostini::GetTerminalId()) { if (app_id() == crostini::GetTerminalId()) {
crostini::CrostiniManager::GetForProfile(profile())->StopVm( crostini::CrostiniManager::GetForProfile(profile())->StopVm(
crostini::kCrostiniDefaultVmName, base::DoNothing()); crostini::kCrostiniDefaultVmName, base::DoNothing());
} else if (app_id() == plugin_vm::kPluginVmAppId) { } else if (app_id() == plugin_vm::kPluginVmShelfAppId) {
plugin_vm::PluginVmManagerFactory::GetForProfile(profile()) plugin_vm::PluginVmManagerFactory::GetForProfile(profile())
->StopPluginVm(plugin_vm::kPluginVmName, /*force=*/false); ->StopPluginVm(plugin_vm::kPluginVmName, /*force=*/false);
} else { } else {
......
...@@ -83,7 +83,7 @@ void AppServiceAppWindowCrostiniTracker::OnWindowVisibilityChanged( ...@@ -83,7 +83,7 @@ void AppServiceAppWindowCrostiniTracker::OnWindowVisibilityChanged(
// Crostini shouldn't need to know about ARC app windows. // Crostini shouldn't need to know about ARC app windows.
if (wm::GetTransientParent(window) || if (wm::GetTransientParent(window) ||
arc::GetWindowTaskId(window) != arc::kNoTaskId || arc::GetWindowTaskId(window) != arc::kNoTaskId ||
plugin_vm::IsPluginVmWindow(window)) { plugin_vm::IsPluginVmAppWindow(window)) {
return; return;
} }
...@@ -202,7 +202,7 @@ std::string AppServiceAppWindowCrostiniTracker::GetShelfAppId( ...@@ -202,7 +202,7 @@ std::string AppServiceAppWindowCrostiniTracker::GetShelfAppId(
// Crostini shouldn't need to know about ARC app windows. // Crostini shouldn't need to know about ARC app windows.
if (wm::GetTransientParent(window) || if (wm::GetTransientParent(window) ||
arc::GetWindowTaskId(window) != arc::kNoTaskId || arc::GetWindowTaskId(window) != arc::kNoTaskId ||
plugin_vm::IsPluginVmWindow(window)) { plugin_vm::IsPluginVmAppWindow(window)) {
return std::string(); return std::string();
} }
......
...@@ -221,7 +221,7 @@ void AppServiceAppWindowLauncherController::OnWindowVisibilityChanged( ...@@ -221,7 +221,7 @@ void AppServiceAppWindowLauncherController::OnWindowVisibilityChanged(
crostini_tracker_->OnWindowVisibilityChanged(window, shelf_id.app_id); crostini_tracker_->OnWindowVisibilityChanged(window, shelf_id.app_id);
// This will match both the Plugin VM App window and installer. // This will match both the Plugin VM App window and installer.
if (shelf_id.app_id == plugin_vm::kPluginVmAppId) { if (shelf_id.app_id == plugin_vm::kPluginVmShelfAppId) {
// Plugin VM can only be used on the primary profile. // Plugin VM can only be used on the primary profile.
MultiUserWindowManagerHelper::GetWindowManager()->SetWindowOwner( MultiUserWindowManagerHelper::GetWindowManager()->SetWindowOwner(
window, window,
...@@ -564,8 +564,8 @@ ash::ShelfID AppServiceAppWindowLauncherController::GetShelfId( ...@@ -564,8 +564,8 @@ ash::ShelfID AppServiceAppWindowLauncherController::GetShelfId(
return ash::ShelfID(shelf_app_id); return ash::ShelfID(shelf_app_id);
} }
if (plugin_vm::IsPluginVmWindow(window)) if (plugin_vm::IsPluginVmAppWindow(window))
return ash::ShelfID(plugin_vm::kPluginVmAppId); return ash::ShelfID(plugin_vm::kPluginVmShelfAppId);
ash::ShelfID shelf_id; ash::ShelfID shelf_id;
if (arc_tracker_) if (arc_tracker_)
......
...@@ -146,7 +146,7 @@ void AppServiceShelfContextMenu::ExecuteCommand(int command_id, ...@@ -146,7 +146,7 @@ void AppServiceShelfContextMenu::ExecuteCommand(int command_id,
if (item().id.app_id == crostini::GetTerminalId()) { if (item().id.app_id == crostini::GetTerminalId()) {
crostini::CrostiniManager::GetForProfile(controller()->profile()) crostini::CrostiniManager::GetForProfile(controller()->profile())
->StopVm(crostini::kCrostiniDefaultVmName, base::DoNothing()); ->StopVm(crostini::kCrostiniDefaultVmName, base::DoNothing());
} else if (item().id.app_id == plugin_vm::kPluginVmAppId) { } else if (item().id.app_id == plugin_vm::kPluginVmShelfAppId) {
plugin_vm::PluginVmManagerFactory::GetForProfile( plugin_vm::PluginVmManagerFactory::GetForProfile(
controller()->profile()) controller()->profile())
->StopPluginVm(plugin_vm::kPluginVmName, /*force=*/false); ->StopPluginVm(plugin_vm::kPluginVmName, /*force=*/false);
......
...@@ -176,7 +176,7 @@ void CrostiniAppWindowShelfController::OnWindowVisibilityChanging( ...@@ -176,7 +176,7 @@ void CrostiniAppWindowShelfController::OnWindowVisibilityChanging(
// know about them. // know about them.
if (wm::GetTransientParent(window) || if (wm::GetTransientParent(window) ||
arc::GetWindowTaskId(window) != arc::kNoTaskId || arc::GetWindowTaskId(window) != arc::kNoTaskId ||
plugin_vm::IsPluginVmWindow(window)) { plugin_vm::IsPluginVmAppWindow(window)) {
DCHECK(aura_window_to_app_window_.find(window) == DCHECK(aura_window_to_app_window_.find(window) ==
aura_window_to_app_window_.end()); aura_window_to_app_window_.end());
auto it = observed_windows_.find(window); auto it = observed_windows_.find(window);
......
...@@ -99,9 +99,9 @@ void InternalAppWindowShelfController::OnWindowVisibilityChanging( ...@@ -99,9 +99,9 @@ void InternalAppWindowShelfController::OnWindowVisibilityChanging(
ash::ShelfID::Deserialize(window->GetProperty(ash::kShelfIDKey)); ash::ShelfID::Deserialize(window->GetProperty(ash::kShelfIDKey));
if (shelf_id.IsNull()) { if (shelf_id.IsNull()) {
if (!plugin_vm::IsPluginVmWindow(window)) if (!plugin_vm::IsPluginVmAppWindow(window))
return; return;
shelf_id = ash::ShelfID(plugin_vm::kPluginVmAppId); shelf_id = ash::ShelfID(plugin_vm::kPluginVmShelfAppId);
window->SetProperty(ash::kShelfIDKey, window->SetProperty(ash::kShelfIDKey,
new std::string(shelf_id.Serialize())); new std::string(shelf_id.Serialize()));
window->SetProperty(ash::kAppIDKey, new std::string(shelf_id.app_id)); window->SetProperty(ash::kAppIDKey, new std::string(shelf_id.app_id));
...@@ -147,7 +147,7 @@ void InternalAppWindowShelfController::RegisterAppWindow( ...@@ -147,7 +147,7 @@ void InternalAppWindowShelfController::RegisterAppWindow(
// Plugin VM is only allowed on the primary profile. If the user switches // Plugin VM is only allowed on the primary profile. If the user switches
// profile while it is launching, we associate it with the primary profile, // profile while it is launching, we associate it with the primary profile,
// which hides the window, and don't show it on the shelf. // which hides the window, and don't show it on the shelf.
if (shelf_id.app_id == plugin_vm::kPluginVmAppId) if (shelf_id.app_id == plugin_vm::kPluginVmShelfAppId)
window_owner = user_manager::UserManager::Get()->GetPrimaryUser(); window_owner = user_manager::UserManager::Get()->GetPrimaryUser();
else else
window_owner = user_manager::UserManager::Get()->GetActiveUser(); window_owner = user_manager::UserManager::Get()->GetActiveUser();
......
...@@ -77,7 +77,8 @@ void plugin_vm::ShowPluginVmInstallerView(Profile* profile) { ...@@ -77,7 +77,8 @@ void plugin_vm::ShowPluginVmInstallerView(Profile* profile) {
views::DialogDelegate::CreateDialogWidget(g_plugin_vm_installer_view, views::DialogDelegate::CreateDialogWidget(g_plugin_vm_installer_view,
nullptr, nullptr); nullptr, nullptr);
g_plugin_vm_installer_view->GetWidget()->GetNativeWindow()->SetProperty( g_plugin_vm_installer_view->GetWidget()->GetNativeWindow()->SetProperty(
ash::kShelfIDKey, ash::ShelfID(plugin_vm::kPluginVmAppId).Serialize()); ash::kShelfIDKey,
ash::ShelfID(plugin_vm::kPluginVmShelfAppId).Serialize());
} }
g_plugin_vm_installer_view->SetButtonRowInsets(kButtonRowInsets); g_plugin_vm_installer_view->SetButtonRowInsets(kButtonRowInsets);
g_plugin_vm_installer_view->GetWidget()->Show(); g_plugin_vm_installer_view->GetWidget()->Show();
......
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