| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 } else { | 50 } else { |
| 51 dialog_->Update(logout_time_); | 51 dialog_->Update(logout_time_); |
| 52 } | 52 } |
| 53 | 53 |
| 54 logout_timer_.Start(FROM_HERE, | 54 logout_timer_.Start(FROM_HERE, |
| 55 logout_time_ - clock_->NowTicks(), | 55 logout_time_ - clock_->NowTicks(), |
| 56 logout_closure_); | 56 logout_closure_); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void LogoutConfirmationController::SetClockForTesting( | 59 void LogoutConfirmationController::SetClockForTesting( |
| 60 scoped_ptr<base::TickClock> clock) { | 60 std::unique_ptr<base::TickClock> clock) { |
| 61 clock_ = std::move(clock); | 61 clock_ = std::move(clock); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void LogoutConfirmationController::OnLockStateChanged(bool locked) { | 64 void LogoutConfirmationController::OnLockStateChanged(bool locked) { |
| 65 if (!locked || logout_time_.is_null()) | 65 if (!locked || logout_time_.is_null()) |
| 66 return; | 66 return; |
| 67 | 67 |
| 68 // If the screen is locked while a confirmation dialog is being shown, close | 68 // If the screen is locked while a confirmation dialog is being shown, close |
| 69 // the dialog. | 69 // the dialog. |
| 70 logout_time_ = base::TimeTicks(); | 70 logout_time_ = base::TimeTicks(); |
| 71 if (dialog_) | 71 if (dialog_) |
| 72 dialog_->GetWidget()->Close(); | 72 dialog_->GetWidget()->Close(); |
| 73 logout_timer_.Stop(); | 73 logout_timer_.Stop(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void LogoutConfirmationController::OnLogoutConfirmed() { | 76 void LogoutConfirmationController::OnLogoutConfirmed() { |
| 77 logout_timer_.Stop(); | 77 logout_timer_.Stop(); |
| 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 |