Chromium Code Reviews| Index: ash/system/logout_button/logout_button_tray.cc |
| diff --git a/ash/system/logout_button/logout_button_tray.cc b/ash/system/logout_button/logout_button_tray.cc |
| index c06073040c5c26822b641ecb479f29c65cae088f..e38d850446fb6e631c43b72cf3290574774a3a57 100644 |
| --- a/ash/system/logout_button/logout_button_tray.cc |
| +++ b/ash/system/logout_button/logout_button_tray.cc |
| @@ -6,6 +6,7 @@ |
| #include "ash/shelf/shelf_types.h" |
| #include "ash/shell.h" |
| +#include "ash/system/logout_button/logout_confirmation_dialog_view.h" |
| #include "ash/system/status_area_widget.h" |
| #include "ash/system/tray/system_tray_delegate.h" |
|
bartfab (slow)
2013/10/24 13:11:02
No longer used.
binjin
2013/10/25 13:03:10
Done.
|
| #include "ash/system/tray/system_tray_notifier.h" |
| @@ -98,7 +99,8 @@ LogoutButtonTray::LogoutButtonTray(StatusAreaWidget* status_area_widget) |
| : TrayBackgroundView(status_area_widget), |
| button_(NULL), |
| login_status_(user::LOGGED_IN_NONE), |
| - show_logout_button_in_tray_(false) { |
| + show_logout_button_in_tray_(false), |
| + confirm_dialog_(NULL) { |
| button_ = new LogoutButton(this); |
| tray_container()->AddChildView(button_); |
| tray_container()->set_border(NULL); |
| @@ -110,6 +112,26 @@ LogoutButtonTray::~LogoutButtonTray() { |
| RemoveLogoutButtonObserver(this); |
| } |
| +void LogoutButtonTray::ShowConfirmDialog() { |
|
bartfab (slow)
2013/10/24 13:11:02
How about calling this EnsureConfirmationDialogSho
binjin
2013/10/25 13:03:10
Done.
|
| + if (!confirm_dialog_) { |
| + confirm_dialog_ = new LogoutConfirmationDialogView(this); |
| + confirm_dialog_->InitAndShow(); |
| + } |
| +} |
| + |
| +void LogoutButtonTray::CloseConfirmDialog() { |
|
bartfab (slow)
2013/10/24 13:11:02
How about calling this EnsureConfirmationDialogClo
binjin
2013/10/25 13:03:10
Done.
|
| + if (!confirm_dialog_) { |
| + confirm_dialog_->GetWidget()->Close(); |
| + } |
| +} |
| + |
| +void LogoutButtonTray::RemoveConfirmDialogInstance( |
| + LogoutConfirmationDialogView *instance) { |
| + if (confirm_dialog_ == instance) { |
|
bartfab (slow)
2013/10/24 13:11:02
- No curly braces for single-line conditionals.
-
binjin
2013/10/25 13:03:10
Done.
|
| + confirm_dialog_ = NULL; |
| + } |
| +} |
| + |
| void LogoutButtonTray::SetShelfAlignment(ShelfAlignment alignment) { |
| TrayBackgroundView::SetShelfAlignment(alignment); |
| tray_container()->set_border(NULL); |
| @@ -135,7 +157,7 @@ void LogoutButtonTray::OnShowLogoutButtonInTrayChanged(bool show) { |
| void LogoutButtonTray::ButtonPressed(views::Button* sender, |
| const ui::Event& event) { |
| DCHECK_EQ(sender, button_); |
| - Shell::GetInstance()->system_tray_delegate()->SignOut(); |
| + ShowConfirmDialog(); |
| } |
| void LogoutButtonTray::UpdateAfterLoginStatusChange( |
| @@ -152,6 +174,9 @@ void LogoutButtonTray::UpdateVisibility() { |
| SetVisible(show_logout_button_in_tray_ && |
| login_status_ != user::LOGGED_IN_NONE && |
| login_status_ != user::LOGGED_IN_LOCKED); |
| + if (!show_logout_button_in_tray_) { |
|
bartfab (slow)
2013/10/24 13:11:02
No curly braces for single-line conditionals.
binjin
2013/10/25 13:03:10
Done.
|
| + CloseConfirmDialog(); |
| + } |
| } |
| } // namespace internal |