Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: ash/system/chromeos/session/logout_confirmation_dialog.cc

Issue 1729723003: Reland: Remove DialogDelegate::OnClosed() which is redundant with (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: with fix Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/system/chromeos/session/logout_confirmation_dialog.h" 5 #include "ash/system/chromeos/session/logout_confirmation_dialog.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/chromeos/session/logout_confirmation_controller.h" 8 #include "ash/system/chromeos/session/logout_confirmation_controller.h"
9 #include "ash/system/tray/tray_constants.h" 9 #include "ash/system/tray/tray_constants.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 56
57 LogoutConfirmationDialog::~LogoutConfirmationDialog() { 57 LogoutConfirmationDialog::~LogoutConfirmationDialog() {
58 } 58 }
59 59
60 void LogoutConfirmationDialog::Update(base::TimeTicks logout_time) { 60 void LogoutConfirmationDialog::Update(base::TimeTicks logout_time) {
61 logout_time_ = logout_time; 61 logout_time_ = logout_time;
62 UpdateLabel(); 62 UpdateLabel();
63 } 63 }
64 64
65 void LogoutConfirmationDialog::ControllerGone() {
66 controller_ = nullptr;
67 GetWidget()->Close();
68 }
69
65 bool LogoutConfirmationDialog::Accept() { 70 bool LogoutConfirmationDialog::Accept() {
66 logout_time_ = controller_->clock()->NowTicks(); 71 logout_time_ = controller_->clock()->NowTicks();
67 UpdateLabel(); 72 UpdateLabel();
68 controller_->OnLogoutConfirmed(); 73 controller_->OnLogoutConfirmed();
69 return true; 74 return true;
70 } 75 }
71 76
72 ui::ModalType LogoutConfirmationDialog::GetModalType() const { 77 ui::ModalType LogoutConfirmationDialog::GetModalType() const {
73 return ui::MODAL_TYPE_SYSTEM; 78 return ui::MODAL_TYPE_SYSTEM;
74 } 79 }
75 80
76 base::string16 LogoutConfirmationDialog::GetWindowTitle() const { 81 base::string16 LogoutConfirmationDialog::GetWindowTitle() const {
77 return l10n_util::GetStringUTF16(IDS_ASH_LOGOUT_CONFIRMATION_TITLE); 82 return l10n_util::GetStringUTF16(IDS_ASH_LOGOUT_CONFIRMATION_TITLE);
78 } 83 }
79 84
80 base::string16 LogoutConfirmationDialog::GetDialogButtonLabel( 85 base::string16 LogoutConfirmationDialog::GetDialogButtonLabel(
81 ui::DialogButton button) const { 86 ui::DialogButton button) const {
82 if (button == ui::DIALOG_BUTTON_OK) 87 if (button == ui::DIALOG_BUTTON_OK)
83 return l10n_util::GetStringUTF16(IDS_ASH_LOGOUT_CONFIRMATION_BUTTON); 88 return l10n_util::GetStringUTF16(IDS_ASH_LOGOUT_CONFIRMATION_BUTTON);
84 return views::DialogDelegateView::GetDialogButtonLabel(button); 89 return views::DialogDelegateView::GetDialogButtonLabel(button);
85 } 90 }
86 91
87 void LogoutConfirmationDialog::OnClosed() { 92 void LogoutConfirmationDialog::WindowClosing() {
88 update_timer_.Stop(); 93 update_timer_.Stop();
89 controller_->OnDialogClosed(); 94 if (controller_)
90 } 95 controller_->OnDialogClosed();
91
92 void LogoutConfirmationDialog::DeleteDelegate() {
93 delete this;
94 } 96 }
95 97
96 void LogoutConfirmationDialog::UpdateLabel() { 98 void LogoutConfirmationDialog::UpdateLabel() {
97 const base::TimeDelta time_remaining = 99 const base::TimeDelta time_remaining =
98 logout_time_ - controller_->clock()->NowTicks(); 100 logout_time_ - controller_->clock()->NowTicks();
99 if (time_remaining >= base::TimeDelta::FromMilliseconds(kHalfSecondInMs)) { 101 if (time_remaining >= base::TimeDelta::FromMilliseconds(kHalfSecondInMs)) {
100 label_->SetText(l10n_util::GetStringFUTF16( 102 label_->SetText(l10n_util::GetStringFUTF16(
101 IDS_ASH_LOGOUT_CONFIRMATION_WARNING, 103 IDS_ASH_LOGOUT_CONFIRMATION_WARNING,
102 ui::TimeFormat::Detailed(ui::TimeFormat::FORMAT_DURATION, 104 ui::TimeFormat::Detailed(ui::TimeFormat::FORMAT_DURATION,
103 ui::TimeFormat::LENGTH_LONG, 105 ui::TimeFormat::LENGTH_LONG,
104 10, 106 10,
105 time_remaining))); 107 time_remaining)));
106 } else { 108 } else {
107 label_->SetText(l10n_util::GetStringUTF16( 109 label_->SetText(l10n_util::GetStringUTF16(
108 IDS_ASH_LOGOUT_CONFIRMATION_WARNING_NOW)); 110 IDS_ASH_LOGOUT_CONFIRMATION_WARNING_NOW));
109 update_timer_.Stop(); 111 update_timer_.Stop();
110 } 112 }
111 } 113 }
112 114
113 } // namespace ash 115 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/session/logout_confirmation_dialog.h ('k') | chrome/browser/chromeos/enrollment_dialog_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698