Skip to content

Commit

Permalink
cb chromeos: remove some WidgetDelegate overrides in ToastDialogView
Browse files Browse the repository at this point in the history
Bug: 1075649
Change-Id: I362bc9bc9416a941821d2213473d618539729026
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2615204
Reviewed-by: Toni Baržić <tbarzic@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841335}
  • Loading branch information
Elly Fong-Jones authored and Chromium LUCI CQ committed Jan 8, 2021
1 parent 031f812 commit 02e9b76
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 24 deletions.
26 changes: 8 additions & 18 deletions chrome/browser/chromeos/lock_screen_apps/toast_dialog_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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));
Expand All @@ -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());
Expand All @@ -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 {
Expand Down
6 changes: 0 additions & 6 deletions chrome/browser/chromeos/lock_screen_apps/toast_dialog_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_;

Expand Down

0 comments on commit 02e9b76

Please sign in to comment.