0

Desk Templates: Lacros unsupported message

This CL checks the list of unsupported windows and displays a Lacros
specific message in the dialog when a Lacros window is identified.

Fixed: 1306289
Test: manual
Change-Id: I264168474c0ee1a023367ec8f8c08324beef3da6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3531053
Reviewed-by: Sammie Quon <sammiequon@chromium.org>
Commit-Queue: Richard Chui <richui@chromium.org>
Auto-Submit: Richard Chui <richui@chromium.org>
Cr-Commit-Position: refs/heads/main@{#982398}
This commit is contained in:
Richard Chui
2022-03-17 20:43:47 +00:00
committed by Chromium LUCI CQ
parent c9b41b95c1
commit 35e6289995
4 changed files with 19 additions and 3 deletions

@ -1871,6 +1871,9 @@ This file contains the strings for ash.
<message name="IDS_ASH_DESKS_TEMPLATES_DELETE_DIALOG_TITLE" desc="The text of the title of the desks templates delete dialog, which shows up when trying to delete a template.">
Delete template?
</message>
<message name="IDS_ASH_DESKS_TEMPLATES_UNSUPPORTED_LACROS_DIALOG_DESCRIPTION" desc="The text of the description of the desks templates unsupported apps dialog, which shows up when trying to save a desk that contains an unsupported app (i.e. Crostini app).">
Lacros windows aren't currently supported. Other apps will be saved.
</message>
<message name="IDS_ASH_DESKS_TEMPLATES_UNSUPPORTED_LINUX_APPS_DIALOG_DESCRIPTION" desc="The text of the description of the desks templates unsupported apps dialog, which shows up when trying to save a desk that contains an unsupported app (i.e. Crostini app).">
Linux apps arent currently supported. Other apps will be saved.
</message>

@ -0,0 +1 @@
ac5ac60f1df14eab58e8a94244722f33be076cb9

@ -25,8 +25,8 @@ DeskTemplate::~DeskTemplate() = default;
// static
bool DeskTemplate::IsAppTypeSupported(aura::Window* window) {
// For now we'll crostini and lacros windows in desk template. We'll also
// ignore ARC apps unless the flag is turned on.
// For now we'll ignore crostini and lacros windows in desk template. We'll
// also ignore ARC apps unless the flag is turned on.
const AppType app_type =
static_cast<AppType>(window->GetProperty(aura::client::kAppType));
switch (app_type) {

@ -4,6 +4,7 @@
#include "ash/wm/desks/templates/desks_templates_dialog_controller.h"
#include "ash/constants/app_types.h"
#include "ash/public/cpp/desks_templates_delegate.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
@ -15,6 +16,7 @@
#include "ash/wm/overview/overview_controller.h"
#include "ash/wm/overview/overview_grid.h"
#include "base/bind.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/env.h"
#include "ui/aura/window.h"
#include "ui/base/l10n/l10n_util.h"
@ -151,10 +153,17 @@ void DesksTemplatesDialogController::ShowUnsupportedAppsDialog(
unsupported_apps_template_ = std::move(desk_template);
size_t incognito_window_count = 0;
bool contains_lacros_window = false;
auto* delegate = Shell::Get()->desks_templates_delegate();
// TODO(shidi): The caller of ShowUnsupportedAppsDialog should provide us
// with the incognito window count to avoid double looping.
for (auto* window : unsupported_apps) {
if (static_cast<AppType>(window->GetProperty(aura::client::kAppType)) ==
AppType::LACROS) {
contains_lacros_window = true;
break;
}
if (delegate->IsIncognitoWindow(window))
++incognito_window_count;
}
@ -163,7 +172,10 @@ void DesksTemplatesDialogController::ShowUnsupportedAppsDialog(
// are linux apps.
std::u16string app_description;
int app_description_id;
if (incognito_window_count == 0) {
if (contains_lacros_window) {
app_description_id =
IDS_ASH_DESKS_TEMPLATES_UNSUPPORTED_LACROS_DIALOG_DESCRIPTION;
} else if (incognito_window_count == 0) {
app_description_id =
IDS_ASH_DESKS_TEMPLATES_UNSUPPORTED_LINUX_APPS_DIALOG_DESCRIPTION;
} else if (incognito_window_count != unsupported_apps.size()) {