| OLD | NEW |
| 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_controller.h" | 5 #include "ash/system/chromeos/session/logout_confirmation_controller.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/session/session_state_delegate.h" | 9 #include "ash/session/session_state_delegate.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 dialog_(NULL), | 23 dialog_(NULL), |
| 24 logout_timer_(false, false) { | 24 logout_timer_(false, false) { |
| 25 if (Shell::HasInstance()) | 25 if (Shell::HasInstance()) |
| 26 Shell::GetInstance()->AddShellObserver(this); | 26 Shell::GetInstance()->AddShellObserver(this); |
| 27 } | 27 } |
| 28 | 28 |
| 29 LogoutConfirmationController::~LogoutConfirmationController() { | 29 LogoutConfirmationController::~LogoutConfirmationController() { |
| 30 if (Shell::HasInstance()) | 30 if (Shell::HasInstance()) |
| 31 Shell::GetInstance()->RemoveShellObserver(this); | 31 Shell::GetInstance()->RemoveShellObserver(this); |
| 32 if (dialog_) | 32 if (dialog_) |
| 33 dialog_->GetWidget()->Close(); | 33 dialog_->ControllerGone(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void LogoutConfirmationController::ConfirmLogout( | 36 void LogoutConfirmationController::ConfirmLogout( |
| 37 base::TimeTicks logout_time) { | 37 base::TimeTicks logout_time) { |
| 38 if (!logout_time_.is_null() && logout_time >= logout_time_) { | 38 if (!logout_time_.is_null() && logout_time >= logout_time_) { |
| 39 // If a confirmation dialog is already being shown and its countdown expires | 39 // If a confirmation dialog is already being shown and its countdown expires |
| 40 // no later than the |logout_time| requested now, keep the current dialog | 40 // no later than the |logout_time| requested now, keep the current dialog |
| 41 // open. | 41 // open. |
| 42 return; | 42 return; |
| 43 } | 43 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 logout_closure_.Run(); | 78 logout_closure_.Run(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void LogoutConfirmationController::OnDialogClosed() { | 81 void LogoutConfirmationController::OnDialogClosed() { |
| 82 logout_time_ = base::TimeTicks(); | 82 logout_time_ = base::TimeTicks(); |
| 83 dialog_ = NULL; | 83 dialog_ = NULL; |
| 84 logout_timer_.Stop(); | 84 logout_timer_.Stop(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace ash | 87 } // namespace ash |
| OLD | NEW |