Commit bea79a0f authored by Tim Zheng's avatar Tim Zheng Committed by Commit Bot

Launch Crostini apps with display scaled up.

This CL adds logic to check the app preference and to send app launch
request with display scaled up if the preference is set to scaled
display.

BUG=chromium:839242
TEST=Manually tested on an eve device.

Change-Id: I054d384161219a1596aee4366d9bc56962b87eb3
Reviewed-on: https://chromium-review.googlesource.com/1232754Reviewed-by: default avatarNicholas Verne <nverne@chromium.org>
Commit-Queue: Tim Zheng <timzheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592587}
parent cac7f08e
......@@ -857,12 +857,17 @@ void CrostiniManager::LaunchContainerApplication(
std::string container_name,
std::string desktop_file_id,
const std::vector<std::string>& files,
bool display_scaled,
LaunchContainerApplicationCallback callback) {
vm_tools::cicerone::LaunchContainerApplicationRequest request;
request.set_owner_id(owner_id_);
request.set_vm_name(std::move(vm_name));
request.set_container_name(std::move(container_name));
request.set_desktop_file_id(std::move(desktop_file_id));
if (display_scaled) {
request.set_display_scaling(
vm_tools::cicerone::LaunchContainerApplicationRequest::SCALED);
}
std::copy(
files.begin(), files.end(),
google::protobuf::RepeatedFieldBackInserter(request.mutable_files()));
......
......@@ -264,6 +264,7 @@ class CrostiniManager : public KeyedService,
std::string container_name,
std::string desktop_file_id,
const std::vector<std::string>& files,
bool display_scaled,
LaunchContainerApplicationCallback callback);
// Asynchronously gets app icons as specified by their desktop file ids.
......
......@@ -115,7 +115,8 @@ void LaunchContainerApplication(
const std::string& app_id,
crostini::CrostiniRegistryService::Registration registration,
int64_t display_id,
const std::vector<std::string>& files) {
const std::vector<std::string>& files,
bool display_scaled) {
ChromeLauncherController* chrome_launcher_controller =
ChromeLauncherController::instance();
DCHECK_NE(chrome_launcher_controller, nullptr);
......@@ -125,7 +126,7 @@ void LaunchContainerApplication(
observer->OnAppLaunchRequested(app_id, display_id);
crostini::CrostiniManager::GetForProfile(profile)->LaunchContainerApplication(
registration.VmName(), registration.ContainerName(),
registration.DesktopFileId(), files,
registration.DesktopFileId(), files, display_scaled,
base::BindOnce(OnContainerApplicationLaunched, app_id));
}
......@@ -324,9 +325,9 @@ void LaunchCrostiniApp(Profile* profile,
base::BindOnce(&ShowTerminal, launch_params, vsh_in_crosh_url, browser);
} else {
RecordAppLaunchHistogram(CrostiniAppLaunchAppType::kRegisteredApp);
launch_closure =
base::BindOnce(&LaunchContainerApplication, profile, app_id,
std::move(*registration), display_id, std::move(files));
launch_closure = base::BindOnce(
&LaunchContainerApplication, profile, app_id, std::move(*registration),
display_id, std::move(files), registration->IsScaled());
}
// Update the last launched time.
......
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