OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_SYSTEM_LOGOUT_CONFIRMATION_LOGOUT_CONFIRMATION_CONTROLLER_H_ | |
6 #define ASH_SYSTEM_LOGOUT_CONFIRMATION_LOGOUT_CONFIRMATION_CONTROLLER_H_ | |
7 | |
8 #include "ash/ash_export.h" | |
9 #include "base/basictypes.h" | |
10 #include "base/callback.h" | |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/time/time.h" | |
13 #include "base/timer/timer.h" | |
14 | |
15 namespace base { | |
16 class TickClock; | |
17 } | |
18 | |
19 namespace ash { | |
20 namespace internal { | |
21 | |
22 class LogoutConfirmationDialog; | |
23 | |
24 // This class shows a dialog asking the user to confirm or deny logout and | |
25 // terminates the session if the user either confirms or allows the countdown | |
26 // shown in the dialog to expire. | |
27 // It is guaranteed that no more than one confirmation dialog will be visible at | |
28 // any given time. If there are multiple requests to show a confirmation dialog | |
29 // at the same time, the dialog whose countdown expires first is shown. | |
30 class ASH_EXPORT LogoutConfirmationController { | |
31 public: | |
32 LogoutConfirmationController(scoped_ptr<base::TickClock> clock, | |
stevenjb
2014/02/27 17:58:44
Are we passing in clock (instead of constructing i
bartfab (slow)
2014/02/28 12:13:49
Done.
| |
33 const base::Closure& logout_closure); | |
34 virtual ~LogoutConfirmationController(); | |
stevenjb
2014/02/27 17:58:44
This doesn't appear to need to be virtual.
bartfab (slow)
2014/02/28 12:13:49
You were right in the version of the CL you looked
| |
35 | |
36 base::TickClock* Clock() const; | |
stevenjb
2014/02/27 17:58:44
This can be:
base::TickClock* clock() const { re
bartfab (slow)
2014/02/28 12:13:49
Done.
| |
37 | |
38 // 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 // the current dialog's |logout_time_|. | |
41 void ConfirmLogout(base::TimeTicks logout_time); | |
42 | |
43 // Called by the |dialog_| when the user confirms logout. | |
44 void OnLogoutConfirmed(); | |
stevenjb
2014/02/27 17:58:44
WS
bartfab (slow)
2014/02/28 12:13:49
Done.
| |
45 // Called by the |dialog_| when it is closed. | |
46 void OnDialogClosed(); | |
47 | |
48 private: | |
49 scoped_ptr<base::TickClock> clock_; | |
50 base::Closure logout_closure_; | |
51 | |
52 base::TimeTicks logout_time_; | |
53 LogoutConfirmationDialog* dialog_; | |
stevenjb
2014/02/27 17:58:44
Comment ownership of raw pointer. (Views hierarchy
bartfab (slow)
2014/02/28 12:13:49
Done.
| |
54 base::Timer logout_timer_; | |
55 | |
56 DISALLOW_COPY_AND_ASSIGN(LogoutConfirmationController); | |
57 }; | |
58 | |
59 } // namespace internal | |
60 } // namespace ash | |
61 | |
62 #endif // ASH_SYSTEM_LOGOUT_CONFIRMATION_LOGOUT_CONFIRMATION_CONTROLLER_H_ | |
OLD | NEW |