Commit be82cc81 authored by David Munro's avatar David Munro Committed by Commit Bot

crostini: Show title for installer + upgrader when alt-tabbing

Bug: chromium:1105298
Test: manual

Change-Id: I890e2ae4f7b5b2a49f999aa957c4923d613c19a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2301690
Commit-Queue: David Munro <davidmunro@google.com>
Reviewed-by: default avatarNicholas Verne <nverne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#789849}
parent 4008d73c
......@@ -13,7 +13,11 @@
#include "chrome/browser/chromeos/crostini/crostini_shelf_utils.h"
#include "chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "ui/aura/window.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/ui_base_types.h"
#include "ui/chromeos/devicetype_utils.h"
namespace {
// The dialog content area size. Note that the height is less than the design
......@@ -51,7 +55,7 @@ void CrostiniInstallerDialog::Show(Profile* profile,
CrostiniInstallerDialog::CrostiniInstallerDialog(
Profile* profile,
OnLoadedCallback on_loaded_callback)
: SystemWebDialogDelegate(GetUrl(), /*title=*/base::string16()),
: SystemWebDialogDelegate(GetUrl(), /*title=*/{}),
profile_(profile),
on_loaded_callback_(std::move(on_loaded_callback)) {}
......@@ -115,6 +119,9 @@ void CrostiniInstallerDialog::OnCloseContents(content::WebContents* source,
}
void CrostiniInstallerDialog::OnWebContentsFinishedLoad() {
DCHECK(dialog_window());
dialog_window()->SetTitle(l10n_util::GetStringFUTF16(
IDS_CROSTINI_INSTALLER_TITLE, ui::GetChromeOSDeviceName()));
if (!on_loaded_callback_.is_null()) {
DCHECK(installer_ui_);
std::move(on_loaded_callback_).Run(installer_ui_);
......
......@@ -13,6 +13,9 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chromeos/crostini_upgrader/crostini_upgrader_ui.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "ui/aura/window.h"
#include "ui/base/l10n/l10n_util.h"
namespace {
// The dialog content area size. Note that the height is less than the design
......@@ -53,7 +56,7 @@ CrostiniUpgraderDialog::CrostiniUpgraderDialog(
Profile* profile,
base::OnceClosure launch_closure,
bool only_run_launch_closure_on_restart)
: SystemWebDialogDelegate{GetUrl(), /*title=*/{}},
: SystemWebDialogDelegate(GetUrl(), /*title=*/{}),
profile_(profile),
only_run_launch_closure_on_restart_(only_run_launch_closure_on_restart),
launch_closure_{std::move(launch_closure)} {
......@@ -170,4 +173,10 @@ void CrostiniUpgraderDialog::EmitUpgradeDialogEventHistogram(
base::UmaHistogramEnumeration("Crostini.UpgradeDialogEvent", event);
}
void CrostiniUpgraderDialog::OnWebContentsFinishedLoad() {
DCHECK(dialog_window());
dialog_window()->SetTitle(
l10n_util::GetStringUTF16(IDS_CROSTINI_UPGRADER_TITLE));
}
} // namespace chromeos
......@@ -51,6 +51,7 @@ class CrostiniUpgraderDialog : public SystemWebDialogDelegate {
void OnDialogShown(content::WebUI* webui) override;
void OnCloseContents(content::WebContents* source,
bool* out_close_dialog) override;
void OnWebContentsFinishedLoad() override;
CrostiniUpgraderUI* upgrader_ui_ = nullptr; // Not owned.
Profile* profile_; // Not owned
......
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