Commit 21a6b95b authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

cbuiv crostini: use new WidgetDelegate setters

This change also removes some now-unneeded instance vars.

Bug: 1075649
Change-Id: Ibac05c4b28f6f89f40bb153ba63bd3f46d075b00
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2252920
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781506}
parent 17797d94
...@@ -60,21 +60,6 @@ bool CrostiniAnsibleSoftwareConfigView::Accept() { ...@@ -60,21 +60,6 @@ bool CrostiniAnsibleSoftwareConfigView::Accept() {
return true; return true;
} }
base::string16 CrostiniAnsibleSoftwareConfigView::GetWindowTitle() const {
switch (state_) {
case State::CONFIGURING:
return l10n_util::GetStringUTF16(
IDS_CROSTINI_ANSIBLE_SOFTWARE_CONFIG_LABEL);
case State::ERROR:
return l10n_util::GetStringUTF16(
IDS_CROSTINI_ANSIBLE_SOFTWARE_CONFIG_ERROR_LABEL);
case State::ERROR_OFFLINE:
return l10n_util::GetStringFUTF16(
IDS_CROSTINI_ANSIBLE_SOFTWARE_CONFIG_ERROR_OFFLINE_LABEL,
ui::GetChromeOSDeviceName());
}
}
base::string16 CrostiniAnsibleSoftwareConfigView::GetSubtextLabel() const { base::string16 CrostiniAnsibleSoftwareConfigView::GetSubtextLabel() const {
switch (state_) { switch (state_) {
case State::CONFIGURING: case State::CONFIGURING:
...@@ -142,27 +127,22 @@ CrostiniAnsibleSoftwareConfigView::CrostiniAnsibleSoftwareConfigView( ...@@ -142,27 +127,22 @@ CrostiniAnsibleSoftwareConfigView::CrostiniAnsibleSoftwareConfigView(
set_margins(provider->GetDialogInsetsForContentType( set_margins(provider->GetDialogInsetsForContentType(
views::DialogContentType::TEXT, views::DialogContentType::CONTROL)); views::DialogContentType::TEXT, views::DialogContentType::CONTROL));
subtext_label_ = new views::Label( auto subtext_label = std::make_unique<views::Label>();
l10n_util::GetStringUTF16(IDS_CROSTINI_ANSIBLE_SOFTWARE_CONFIG_SUBTEXT)); subtext_label->SetMultiLine(true);
subtext_label_->SetMultiLine(true); subtext_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
subtext_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); subtext_label_ = AddChildView(std::move(subtext_label));
AddChildView(subtext_label_);
// Add infinite progress bar. // Add infinite progress bar.
// TODO(crbug.com/1000173): add progress reporting and display text above // TODO(crbug.com/1000173): add progress reporting and display text above
// progress bar indicating current process. // progress bar indicating current process.
progress_bar_ = new views::ProgressBar(); auto progress_bar = std::make_unique<views::ProgressBar>();
progress_bar_->SetVisible(true);
// Values outside the range [0,1] display an infinite loading animation. // Values outside the range [0,1] display an infinite loading animation.
progress_bar_->SetValue(-1); progress_bar->SetValue(-1);
AddChildView(progress_bar_); progress_bar_ = AddChildView(std::move(progress_bar));
chrome::RecordDialogCreation( chrome::RecordDialogCreation(
chrome::DialogIdentifier::CROSTINI_ANSIBLE_SOFTWARE_CONFIG); chrome::DialogIdentifier::CROSTINI_ANSIBLE_SOFTWARE_CONFIG);
OnStateChanged();
// In the initial state (CONFIGURING), there are no buttons and hence no set
// labels.
SetButtons(ui::DIALOG_BUTTON_NONE);
} }
CrostiniAnsibleSoftwareConfigView::~CrostiniAnsibleSoftwareConfigView() { CrostiniAnsibleSoftwareConfigView::~CrostiniAnsibleSoftwareConfigView() {
...@@ -170,7 +150,25 @@ CrostiniAnsibleSoftwareConfigView::~CrostiniAnsibleSoftwareConfigView() { ...@@ -170,7 +150,25 @@ CrostiniAnsibleSoftwareConfigView::~CrostiniAnsibleSoftwareConfigView() {
g_crostini_ansible_software_configuration_view = nullptr; g_crostini_ansible_software_configuration_view = nullptr;
} }
// static
base::string16 CrostiniAnsibleSoftwareConfigView::GetWindowTitleForState(
State state) {
switch (state) {
case State::CONFIGURING:
return l10n_util::GetStringUTF16(
IDS_CROSTINI_ANSIBLE_SOFTWARE_CONFIG_LABEL);
case State::ERROR:
return l10n_util::GetStringUTF16(
IDS_CROSTINI_ANSIBLE_SOFTWARE_CONFIG_ERROR_LABEL);
case State::ERROR_OFFLINE:
return l10n_util::GetStringFUTF16(
IDS_CROSTINI_ANSIBLE_SOFTWARE_CONFIG_ERROR_OFFLINE_LABEL,
ui::GetChromeOSDeviceName());
}
}
void CrostiniAnsibleSoftwareConfigView::OnStateChanged() { void CrostiniAnsibleSoftwareConfigView::OnStateChanged() {
SetTitle(GetWindowTitleForState(state_));
progress_bar_->SetVisible(state_ == State::CONFIGURING); progress_bar_->SetVisible(state_ == State::CONFIGURING);
subtext_label_->SetText(GetSubtextLabel()); subtext_label_->SetText(GetSubtextLabel());
SetButtons(state_ == State::CONFIGURING SetButtons(state_ == State::CONFIGURING
...@@ -185,6 +183,6 @@ void CrostiniAnsibleSoftwareConfigView::OnStateChanged() { ...@@ -185,6 +183,6 @@ void CrostiniAnsibleSoftwareConfigView::OnStateChanged() {
: l10n_util::GetStringUTF16( : l10n_util::GetStringUTF16(
IDS_CROSTINI_ANSIBLE_SOFTWARE_CONFIG_RETRY_BUTTON)); IDS_CROSTINI_ANSIBLE_SOFTWARE_CONFIG_RETRY_BUTTON));
DialogModelChanged(); DialogModelChanged();
GetWidget()->UpdateWindowTitle(); if (GetWidget())
GetWidget()->SetSize(GetWidget()->non_client_view()->GetPreferredSize()); GetWidget()->SetSize(GetWidget()->non_client_view()->GetPreferredSize());
} }
...@@ -22,7 +22,6 @@ class CrostiniAnsibleSoftwareConfigView ...@@ -22,7 +22,6 @@ class CrostiniAnsibleSoftwareConfigView
public: public:
// views::DialogDelegateView: // views::DialogDelegateView:
bool Accept() override; bool Accept() override;
base::string16 GetWindowTitle() const override;
gfx::Size CalculatePreferredSize() const override; gfx::Size CalculatePreferredSize() const override;
// crostini::AnsibleManagementService::Observer: // crostini::AnsibleManagementService::Observer:
...@@ -42,6 +41,8 @@ class CrostiniAnsibleSoftwareConfigView ...@@ -42,6 +41,8 @@ class CrostiniAnsibleSoftwareConfigView
ERROR_OFFLINE, ERROR_OFFLINE,
}; };
static base::string16 GetWindowTitleForState(State state);
void OnStateChanged(); void OnStateChanged();
base::string16 GetSubtextLabel() const; base::string16 GetSubtextLabel() const;
......
...@@ -42,32 +42,17 @@ views::Widget* CrostiniForceCloseView::Show( ...@@ -42,32 +42,17 @@ views::Widget* CrostiniForceCloseView::Show(
gfx::NativeView closable_view, gfx::NativeView closable_view,
base::OnceClosure force_close_callback) { base::OnceClosure force_close_callback) {
views::Widget* dialog_widget = views::DialogDelegate::CreateDialogWidget( views::Widget* dialog_widget = views::DialogDelegate::CreateDialogWidget(
new CrostiniForceCloseView(app_name, std::move(force_close_callback)), new CrostiniForceCloseView(base::UTF8ToUTF16(app_name),
std::move(force_close_callback)),
closable_window, closable_view); closable_window, closable_view);
dialog_widget->Show(); dialog_widget->Show();
return dialog_widget; return dialog_widget;
} }
bool CrostiniForceCloseView::Accept() {
std::move(force_close_callback_).Run();
return true;
}
ui::ModalType CrostiniForceCloseView::GetModalType() const { ui::ModalType CrostiniForceCloseView::GetModalType() const {
return ui::ModalType::MODAL_TYPE_WINDOW; return ui::ModalType::MODAL_TYPE_WINDOW;
} }
bool CrostiniForceCloseView::ShouldShowCloseButton() const {
return false;
}
base::string16 CrostiniForceCloseView::GetWindowTitle() const {
return app_name_.empty()
? l10n_util::GetStringUTF16(IDS_CROSTINI_FORCE_CLOSE_TITLE_UNKNOWN)
: l10n_util::GetStringFUTF16(IDS_CROSTINI_FORCE_CLOSE_TITLE_KNOWN,
app_name_);
}
gfx::Size CrostiniForceCloseView::CalculatePreferredSize() const { gfx::Size CrostiniForceCloseView::CalculatePreferredSize() const {
const int dialog_width = ChromeLayoutProvider::Get()->GetDistanceMetric( const int dialog_width = ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH) - DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH) -
...@@ -76,13 +61,18 @@ gfx::Size CrostiniForceCloseView::CalculatePreferredSize() const { ...@@ -76,13 +61,18 @@ gfx::Size CrostiniForceCloseView::CalculatePreferredSize() const {
} }
CrostiniForceCloseView::CrostiniForceCloseView( CrostiniForceCloseView::CrostiniForceCloseView(
const std::string& app_name, const base::string16& app_name,
base::OnceClosure force_close_callback) base::OnceClosure force_close_callback) {
: app_name_(base::UTF8ToUTF16(app_name)), SetShowCloseButton(false);
force_close_callback_(std::move(force_close_callback)) { SetTitle(
app_name.empty()
? l10n_util::GetStringUTF16(IDS_CROSTINI_FORCE_CLOSE_TITLE_UNKNOWN)
: l10n_util::GetStringFUTF16(IDS_CROSTINI_FORCE_CLOSE_TITLE_KNOWN,
app_name));
SetButtonLabel( SetButtonLabel(
ui::DIALOG_BUTTON_OK, ui::DIALOG_BUTTON_OK,
l10n_util::GetStringUTF16(IDS_CROSTINI_FORCE_CLOSE_ACCEPT_BUTTON)); l10n_util::GetStringUTF16(IDS_CROSTINI_FORCE_CLOSE_ACCEPT_BUTTON));
SetAcceptCallback(std::move(force_close_callback));
views::LayoutProvider* provider = views::LayoutProvider::Get(); views::LayoutProvider* provider = views::LayoutProvider::Get();
SetLayoutManager(std::make_unique<views::BoxLayout>( SetLayoutManager(std::make_unique<views::BoxLayout>(
...@@ -93,10 +83,10 @@ CrostiniForceCloseView::CrostiniForceCloseView( ...@@ -93,10 +83,10 @@ CrostiniForceCloseView::CrostiniForceCloseView(
views::DialogContentType::TEXT, views::DialogContentType::TEXT)); views::DialogContentType::TEXT, views::DialogContentType::TEXT));
views::Label* message_label = new views::Label( views::Label* message_label = new views::Label(
app_name_.empty() app_name.empty()
? l10n_util::GetStringUTF16(IDS_CROSTINI_FORCE_CLOSE_BODY_UNKNOWN) ? l10n_util::GetStringUTF16(IDS_CROSTINI_FORCE_CLOSE_BODY_UNKNOWN)
: l10n_util::GetStringFUTF16(IDS_CROSTINI_FORCE_CLOSE_BODY_KNOWN, : l10n_util::GetStringFUTF16(IDS_CROSTINI_FORCE_CLOSE_BODY_KNOWN,
app_name_)); app_name));
message_label->SetMultiLine(true); message_label->SetMultiLine(true);
message_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); message_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
AddChildView(message_label); AddChildView(message_label);
......
...@@ -6,8 +6,13 @@ ...@@ -6,8 +6,13 @@
#define CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_FORCE_CLOSE_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_FORCE_CLOSE_VIEW_H_
#include "base/callback.h" #include "base/callback.h"
#include "ui/base/ui_base_types.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include <string>
namespace views { namespace views {
class Widget; class Widget;
} }
...@@ -32,25 +37,15 @@ class CrostiniForceCloseView : public views::BubbleDialogDelegateView { ...@@ -32,25 +37,15 @@ class CrostiniForceCloseView : public views::BubbleDialogDelegateView {
base::OnceClosure force_close_callback); base::OnceClosure force_close_callback);
// BubbleDialogDelegateView overrides. // BubbleDialogDelegateView overrides.
bool Accept() override;
ui::ModalType GetModalType() const override; ui::ModalType GetModalType() const override;
bool ShouldShowCloseButton() const override;
base::string16 GetWindowTitle() const override;
gfx::Size CalculatePreferredSize() const override; gfx::Size CalculatePreferredSize() const override;
private: private:
CrostiniForceCloseView(const std::string& app_name, CrostiniForceCloseView(const base::string16& app_name,
base::OnceClosure force_close_callback); base::OnceClosure force_close_callback);
~CrostiniForceCloseView() override; ~CrostiniForceCloseView() override;
// Then name of this application which we will display to the user. If we
// don't know the app's name, this will be the empty string.
base::string16 app_name_;
// The callback to invoke if the user chooses to force close.
base::OnceClosure force_close_callback_;
DISALLOW_COPY_AND_ASSIGN(CrostiniForceCloseView); DISALLOW_COPY_AND_ASSIGN(CrostiniForceCloseView);
}; };
......
...@@ -32,15 +32,6 @@ void CrostiniPackageInstallFailureView::Show(const std::string& error_message) { ...@@ -32,15 +32,6 @@ void CrostiniPackageInstallFailureView::Show(const std::string& error_message) {
->Show(); ->Show();
} }
bool CrostiniPackageInstallFailureView::ShouldShowCloseButton() const {
return false;
}
base::string16 CrostiniPackageInstallFailureView::GetWindowTitle() const {
return l10n_util::GetStringUTF16(
IDS_CROSTINI_PACKAGE_INSTALL_FAILURE_VIEW_TITLE);
}
gfx::Size CrostiniPackageInstallFailureView::CalculatePreferredSize() const { gfx::Size CrostiniPackageInstallFailureView::CalculatePreferredSize() const {
const int dialog_width = ChromeLayoutProvider::Get()->GetDistanceMetric( const int dialog_width = ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH) - DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH) -
...@@ -50,6 +41,8 @@ gfx::Size CrostiniPackageInstallFailureView::CalculatePreferredSize() const { ...@@ -50,6 +41,8 @@ gfx::Size CrostiniPackageInstallFailureView::CalculatePreferredSize() const {
CrostiniPackageInstallFailureView::CrostiniPackageInstallFailureView( CrostiniPackageInstallFailureView::CrostiniPackageInstallFailureView(
const std::string& error_message) { const std::string& error_message) {
SetShowCloseButton(false);
SetTitle(IDS_CROSTINI_PACKAGE_INSTALL_FAILURE_VIEW_TITLE);
SetButtons(ui::DIALOG_BUTTON_OK); SetButtons(ui::DIALOG_BUTTON_OK);
views::LayoutProvider* provider = views::LayoutProvider::Get(); views::LayoutProvider* provider = views::LayoutProvider::Get();
SetLayoutManager(std::make_unique<views::BoxLayout>( SetLayoutManager(std::make_unique<views::BoxLayout>(
......
...@@ -14,8 +14,6 @@ class CrostiniPackageInstallFailureView ...@@ -14,8 +14,6 @@ class CrostiniPackageInstallFailureView
static void Show(const std::string& error_message); static void Show(const std::string& error_message);
// BubbleDialogDelegateView overrides. // BubbleDialogDelegateView overrides.
bool ShouldShowCloseButton() const override;
base::string16 GetWindowTitle() const override;
gfx::Size CalculatePreferredSize() const override; gfx::Size CalculatePreferredSize() const override;
private: private:
......
...@@ -60,14 +60,6 @@ bool CrostiniRecoveryView::Show(Profile* profile, ...@@ -60,14 +60,6 @@ bool CrostiniRecoveryView::Show(Profile* profile,
return g_crostini_recovery_view->can_launch_apps_; return g_crostini_recovery_view->can_launch_apps_;
} }
base::string16 CrostiniRecoveryView::GetWindowTitle() const {
return l10n_util::GetStringUTF16(IDS_CROSTINI_RECOVERY_TITLE);
}
bool CrostiniRecoveryView::ShouldShowCloseButton() const {
return false;
}
bool CrostiniRecoveryView::IsDialogButtonEnabled( bool CrostiniRecoveryView::IsDialogButtonEnabled(
ui::DialogButton button) const { ui::DialogButton button) const {
// Buttons are disabled after Accept or Cancel have been clicked. // Buttons are disabled after Accept or Cancel have been clicked.
...@@ -149,6 +141,8 @@ CrostiniRecoveryView::CrostiniRecoveryView( ...@@ -149,6 +141,8 @@ CrostiniRecoveryView::CrostiniRecoveryView(
SetButtonLabel( SetButtonLabel(
ui::DIALOG_BUTTON_CANCEL, ui::DIALOG_BUTTON_CANCEL,
l10n_util::GetStringUTF16(IDS_CROSTINI_RECOVERY_TERMINAL_BUTTON)); l10n_util::GetStringUTF16(IDS_CROSTINI_RECOVERY_TERMINAL_BUTTON));
SetShowCloseButton(false);
SetTitle(IDS_CROSTINI_RECOVERY_TITLE);
views::LayoutProvider* provider = views::LayoutProvider::Get(); views::LayoutProvider* provider = views::LayoutProvider::Get();
SetLayoutManager(std::make_unique<views::BoxLayout>( SetLayoutManager(std::make_unique<views::BoxLayout>(
......
...@@ -24,8 +24,6 @@ class CrostiniRecoveryView : public views::BubbleDialogDelegateView { ...@@ -24,8 +24,6 @@ class CrostiniRecoveryView : public views::BubbleDialogDelegateView {
crostini::LaunchCrostiniAppCallback callback); crostini::LaunchCrostiniAppCallback callback);
// views::DialogDelegateView: // views::DialogDelegateView:
base::string16 GetWindowTitle() const override;
bool ShouldShowCloseButton() const override;
gfx::Size CalculatePreferredSize() const override; gfx::Size CalculatePreferredSize() const override;
bool Accept() override; bool Accept() override;
bool Cancel() override; bool Cancel() override;
......
...@@ -50,15 +50,6 @@ void CrostiniUninstallerView::Show(Profile* profile) { ...@@ -50,15 +50,6 @@ void CrostiniUninstallerView::Show(Profile* profile) {
g_crostini_uninstaller_view->GetWidget()->Show(); g_crostini_uninstaller_view->GetWidget()->Show();
} }
base::string16 CrostiniUninstallerView::GetWindowTitle() const {
const base::string16 device_type = ui::GetChromeOSDeviceName();
return l10n_util::GetStringUTF16(IDS_CROSTINI_UNINSTALLER_TITLE);
}
bool CrostiniUninstallerView::ShouldShowCloseButton() const {
return false;
}
bool CrostiniUninstallerView::Accept() { bool CrostiniUninstallerView::Accept() {
state_ = State::UNINSTALLING; state_ = State::UNINSTALLING;
SetButtons(ui::DIALOG_BUTTON_NONE); SetButtons(ui::DIALOG_BUTTON_NONE);
...@@ -101,6 +92,8 @@ CrostiniUninstallerView* CrostiniUninstallerView::GetActiveViewForTesting() { ...@@ -101,6 +92,8 @@ CrostiniUninstallerView* CrostiniUninstallerView::GetActiveViewForTesting() {
CrostiniUninstallerView::CrostiniUninstallerView(Profile* profile) CrostiniUninstallerView::CrostiniUninstallerView(Profile* profile)
: profile_(profile) { : profile_(profile) {
SetShowCloseButton(false);
SetTitle(IDS_CROSTINI_UNINSTALLER_TITLE);
SetButtonLabel( SetButtonLabel(
ui::DIALOG_BUTTON_OK, ui::DIALOG_BUTTON_OK,
l10n_util::GetStringUTF16(IDS_CROSTINI_UNINSTALLER_UNINSTALL_BUTTON)); l10n_util::GetStringUTF16(IDS_CROSTINI_UNINSTALLER_UNINSTALL_BUTTON));
......
...@@ -34,8 +34,6 @@ class CrostiniUninstallerView : public views::BubbleDialogDelegateView { ...@@ -34,8 +34,6 @@ class CrostiniUninstallerView : public views::BubbleDialogDelegateView {
static void Show(Profile* profile); static void Show(Profile* profile);
// views::DialogDelegateView: // views::DialogDelegateView:
base::string16 GetWindowTitle() const override;
bool ShouldShowCloseButton() const override;
bool Accept() override; bool Accept() override;
bool Cancel() override; bool Cancel() override;
gfx::Size CalculatePreferredSize() const override; gfx::Size CalculatePreferredSize() const override;
......
...@@ -46,14 +46,6 @@ void CrostiniUpdateComponentView::Show(Profile* profile) { ...@@ -46,14 +46,6 @@ void CrostiniUpdateComponentView::Show(Profile* profile) {
g_crostini_upgrade_view->GetWidget()->Show(); g_crostini_upgrade_view->GetWidget()->Show();
} }
base::string16 CrostiniUpdateComponentView::GetWindowTitle() const {
return l10n_util::GetStringUTF16(IDS_CROSTINI_TERMINA_UPDATE_REQUIRED);
}
bool CrostiniUpdateComponentView::ShouldShowCloseButton() const {
return false;
}
gfx::Size CrostiniUpdateComponentView::CalculatePreferredSize() const { gfx::Size CrostiniUpdateComponentView::CalculatePreferredSize() const {
const int dialog_width = ChromeLayoutProvider::Get()->GetDistanceMetric( const int dialog_width = ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_STANDALONE_BUBBLE_PREFERRED_WIDTH) - DISTANCE_STANDALONE_BUBBLE_PREFERRED_WIDTH) -
...@@ -69,6 +61,8 @@ CrostiniUpdateComponentView::GetActiveViewForTesting() { ...@@ -69,6 +61,8 @@ CrostiniUpdateComponentView::GetActiveViewForTesting() {
CrostiniUpdateComponentView::CrostiniUpdateComponentView() { CrostiniUpdateComponentView::CrostiniUpdateComponentView() {
SetButtons(ui::DIALOG_BUTTON_OK); SetButtons(ui::DIALOG_BUTTON_OK);
SetShowCloseButton(false);
SetTitle(IDS_CROSTINI_TERMINA_UPDATE_REQUIRED);
views::LayoutProvider* provider = views::LayoutProvider::Get(); views::LayoutProvider* provider = views::LayoutProvider::Get();
SetLayoutManager(std::make_unique<views::BoxLayout>( SetLayoutManager(std::make_unique<views::BoxLayout>(
......
...@@ -20,8 +20,6 @@ class CrostiniUpdateComponentView : public views::BubbleDialogDelegateView { ...@@ -20,8 +20,6 @@ class CrostiniUpdateComponentView : public views::BubbleDialogDelegateView {
static void Show(Profile* profile); static void Show(Profile* profile);
// views::DialogDelegateView: // views::DialogDelegateView:
base::string16 GetWindowTitle() const override;
bool ShouldShowCloseButton() const override;
gfx::Size CalculatePreferredSize() const override; gfx::Size CalculatePreferredSize() const override;
static CrostiniUpdateComponentView* GetActiveViewForTesting(); static CrostiniUpdateComponentView* GetActiveViewForTesting();
......
...@@ -90,14 +90,6 @@ void CrostiniUpdateFilesystemView::Show(Profile* profile) { ...@@ -90,14 +90,6 @@ void CrostiniUpdateFilesystemView::Show(Profile* profile) {
g_crostini_update_filesystem_view_dialog->GetWidget()->Show(); g_crostini_update_filesystem_view_dialog->GetWidget()->Show();
} }
base::string16 CrostiniUpdateFilesystemView::GetWindowTitle() const {
return l10n_util::GetStringUTF16(IDS_CROSTINI_UPGRADING_LABEL);
}
bool CrostiniUpdateFilesystemView::ShouldShowCloseButton() const {
return false;
}
gfx::Size CrostiniUpdateFilesystemView::CalculatePreferredSize() const { gfx::Size CrostiniUpdateFilesystemView::CalculatePreferredSize() const {
const int dialog_width = ChromeLayoutProvider::Get()->GetDistanceMetric( const int dialog_width = ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_STANDALONE_BUBBLE_PREFERRED_WIDTH) - DISTANCE_STANDALONE_BUBBLE_PREFERRED_WIDTH) -
...@@ -114,6 +106,8 @@ CrostiniUpdateFilesystemView::GetActiveViewForTesting() { ...@@ -114,6 +106,8 @@ CrostiniUpdateFilesystemView::GetActiveViewForTesting() {
CrostiniUpdateFilesystemView::CrostiniUpdateFilesystemView() { CrostiniUpdateFilesystemView::CrostiniUpdateFilesystemView() {
constexpr int kDialogSpacingVertical = 32; constexpr int kDialogSpacingVertical = 32;
SetShowCloseButton(false);
SetTitle(IDS_CROSTINI_UPGRADING_LABEL);
SetButtons(ui::DIALOG_BUTTON_OK); SetButtons(ui::DIALOG_BUTTON_OK);
views::LayoutProvider* provider = views::LayoutProvider::Get(); views::LayoutProvider* provider = views::LayoutProvider::Get();
......
...@@ -20,8 +20,6 @@ class CrostiniUpdateFilesystemView : public views::BubbleDialogDelegateView { ...@@ -20,8 +20,6 @@ class CrostiniUpdateFilesystemView : public views::BubbleDialogDelegateView {
static void Show(Profile* profile); static void Show(Profile* profile);
// views::DialogDelegateView: // views::DialogDelegateView:
base::string16 GetWindowTitle() const override;
bool ShouldShowCloseButton() const override;
gfx::Size CalculatePreferredSize() const override; gfx::Size CalculatePreferredSize() const override;
static CrostiniUpdateFilesystemView* GetActiveViewForTesting(); static CrostiniUpdateFilesystemView* GetActiveViewForTesting();
......
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