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 #ifndef ASH_SYSTEM_CHROMEOS_SESSION_LOGOUT_CONFIRMATION_CONTROLLER_H_ | 5 #ifndef ASH_SYSTEM_CHROMEOS_SESSION_LOGOUT_CONFIRMATION_CONTROLLER_H_ |
6 #define ASH_SYSTEM_CHROMEOS_SESSION_LOGOUT_CONFIRMATION_CONTROLLER_H_ | 6 #define ASH_SYSTEM_CHROMEOS_SESSION_LOGOUT_CONFIRMATION_CONTROLLER_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
9 #include "ash/shell_observer.h" | 11 #include "ash/shell_observer.h" |
10 #include "base/callback.h" | 12 #include "base/callback.h" |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
14 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
15 | 16 |
16 namespace base { | 17 namespace base { |
17 class TickClock; | 18 class TickClock; |
18 } | 19 } |
19 | 20 |
20 namespace ash { | 21 namespace ash { |
21 | 22 |
22 class LogoutConfirmationDialog; | 23 class LogoutConfirmationDialog; |
(...skipping 10 matching lines...) Expand all Loading... |
33 explicit LogoutConfirmationController(const base::Closure& logout_closure); | 34 explicit LogoutConfirmationController(const base::Closure& logout_closure); |
34 ~LogoutConfirmationController() override; | 35 ~LogoutConfirmationController() override; |
35 | 36 |
36 base::TickClock* clock() const { return clock_.get(); } | 37 base::TickClock* clock() const { return clock_.get(); } |
37 | 38 |
38 // Shows a LogoutConfirmationDialog. If a confirmation dialog is already being | 39 // Shows a LogoutConfirmationDialog. If a confirmation dialog is already being |
39 // shown, it is closed and a new one opened if |logout_time| is earlier than | 40 // shown, it is closed and a new one opened if |logout_time| is earlier than |
40 // the current dialog's |logout_time_|. | 41 // the current dialog's |logout_time_|. |
41 void ConfirmLogout(base::TimeTicks logout_time); | 42 void ConfirmLogout(base::TimeTicks logout_time); |
42 | 43 |
43 void SetClockForTesting(scoped_ptr<base::TickClock> clock); | 44 void SetClockForTesting(std::unique_ptr<base::TickClock> clock); |
44 | 45 |
45 // ShellObserver: | 46 // ShellObserver: |
46 void OnLockStateChanged(bool locked) override; | 47 void OnLockStateChanged(bool locked) override; |
47 | 48 |
48 // Called by the |dialog_| when the user confirms logout. | 49 // Called by the |dialog_| when the user confirms logout. |
49 void OnLogoutConfirmed(); | 50 void OnLogoutConfirmed(); |
50 | 51 |
51 // Called by the |dialog_| when it is closed. | 52 // Called by the |dialog_| when it is closed. |
52 void OnDialogClosed(); | 53 void OnDialogClosed(); |
53 | 54 |
54 LogoutConfirmationDialog* dialog_for_testing() const { return dialog_; } | 55 LogoutConfirmationDialog* dialog_for_testing() const { return dialog_; } |
55 | 56 |
56 private: | 57 private: |
57 scoped_ptr<base::TickClock> clock_; | 58 std::unique_ptr<base::TickClock> clock_; |
58 base::Closure logout_closure_; | 59 base::Closure logout_closure_; |
59 | 60 |
60 base::TimeTicks logout_time_; | 61 base::TimeTicks logout_time_; |
61 LogoutConfirmationDialog* dialog_; // Owned by the Views hierarchy. | 62 LogoutConfirmationDialog* dialog_; // Owned by the Views hierarchy. |
62 base::Timer logout_timer_; | 63 base::Timer logout_timer_; |
63 | 64 |
64 DISALLOW_COPY_AND_ASSIGN(LogoutConfirmationController); | 65 DISALLOW_COPY_AND_ASSIGN(LogoutConfirmationController); |
65 }; | 66 }; |
66 | 67 |
67 } // namespace ash | 68 } // namespace ash |
68 | 69 |
69 #endif // ASH_SYSTEM_CHROMEOS_SESSION_LOGOUT_CONFIRMATION_CONTROLLER_H_ | 70 #endif // ASH_SYSTEM_CHROMEOS_SESSION_LOGOUT_CONFIRMATION_CONTROLLER_H_ |
OLD | NEW |