Commit 02e9b760 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Chromium LUCI CQ

cb chromeos: remove some WidgetDelegate overrides in ToastDialogView

Bug: 1075649
Change-Id: I362bc9bc9416a941821d2213473d618539729026
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2615204Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841335}
parent 031f8124
......@@ -40,10 +40,13 @@ constexpr int kDialogTitleMarginEndDp = 0;
} // namespace
ToastDialogView::ToastDialogView(const base::string16& app_name,
base::OnceClosure dismissed_callback)
: app_name_(app_name) {
DialogDelegate::SetButtons(ui::DIALOG_BUTTON_NONE);
DialogDelegate::SetCloseCallback(std::move(dismissed_callback));
base::OnceClosure dismissed_callback) {
SetButtons(ui::DIALOG_BUTTON_NONE);
SetCloseCallback(std::move(dismissed_callback));
SetModalType(ui::MODAL_TYPE_NONE);
SetShowCloseButton(true);
SetTitle(l10n_util::GetStringFUTF16(
IDS_LOCK_SCREEN_NOTE_APP_TOAST_DIALOG_TITLE, app_name));
chrome::RecordDialogCreation(
chrome::DialogIdentifier::LOCK_SCREEN_NOTE_APP_TOAST);
......@@ -59,7 +62,7 @@ ToastDialogView::ToastDialogView(const base::string16& app_name,
SetLayoutManager(std::make_unique<views::FillLayout>());
auto* label = new views::Label(l10n_util::GetStringFUTF16(
IDS_LOCK_SCREEN_NOTE_APP_TOAST_DIALOG_MESSAGE, app_name_));
IDS_LOCK_SCREEN_NOTE_APP_TOAST_DIALOG_MESSAGE, app_name));
label->SetMultiLine(true);
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label->SetEnabledColor(SkColorSetARGB(138, 0, 0, 0));
......@@ -75,15 +78,6 @@ ToastDialogView::ToastDialogView(const base::string16& app_name,
ToastDialogView::~ToastDialogView() = default;
ui::ModalType ToastDialogView::GetModalType() const {
return ui::MODAL_TYPE_NONE;
}
base::string16 ToastDialogView::GetWindowTitle() const {
return l10n_util::GetStringFUTF16(IDS_LOCK_SCREEN_NOTE_APP_TOAST_DIALOG_TITLE,
app_name_);
}
void ToastDialogView::AddedToWidget() {
std::unique_ptr<views::Label> title =
views::BubbleFrameView::CreateDefaultTitleLabel(GetWindowTitle());
......@@ -92,10 +86,6 @@ void ToastDialogView::AddedToWidget() {
GetBubbleFrameView()->SetTitleView(std::move(title));
}
bool ToastDialogView::ShouldShowCloseButton() const {
return true;
}
void ToastDialogView::OnBeforeBubbleWidgetInit(
views::Widget::InitParams* params,
views::Widget* widget) const {
......
......@@ -22,17 +22,11 @@ class ToastDialogView : public views::BubbleDialogDelegateView {
~ToastDialogView() override;
// views::BubbleDialogDelegateView:
ui::ModalType GetModalType() const override;
base::string16 GetWindowTitle() const override;
void AddedToWidget() override;
bool ShouldShowCloseButton() const override;
void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params,
views::Widget* widget) const override;
private:
// The name of the app for which the dialog is shown.
const base::string16 app_name_;
// Callback to be called when the user closes the dialog.
base::OnceClosure dismissed_callback_;
......
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