OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 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_BUTTON_LOGOUT_CONFIRMATION_DIALOG_VIEW_H_ | |
6 #define ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_CONFIRMATION_DIALOG_VIEW_H_ | |
7 | |
8 #include "ash/ash_export.h" | |
9 #include "base/basictypes.h" | |
10 #include "base/compiler_specific.h" | |
11 #include "base/time/time.h" | |
12 #include "base/timer/timer.h" | |
13 #include "ui/views/window/dialog_delegate.h" | |
14 | |
15 namespace views { | |
16 class Label; | |
17 } | |
18 | |
19 namespace ash { | |
20 namespace internal { | |
21 | |
22 class LogoutButtonTray; | |
23 | |
24 // This class implements dialog view for logout confirmation. | |
25 class ASH_EXPORT LogoutConfirmationDialogView | |
26 : public views::DialogDelegateView { | |
27 public: | |
28 class ASH_EXPORT Delegate { | |
29 public: | |
30 Delegate(); | |
31 virtual ~Delegate(); | |
32 | |
33 virtual void LogoutCurrentUser(); | |
34 virtual base::TimeTicks GetCurrentTime() const; | |
35 virtual base::TimeDelta GetUpdateInterval() const; | |
bartfab (slow)
2013/12/17 13:21:03
Nit: AFAICT, this is never overridden. Hence, it c
binjin
2013/12/17 14:58:08
I prefer to keep GetUpdateInterval() in the delega
bartfab (slow)
2013/12/17 15:57:46
Remember that each method you add to the Delegate
binjin
2013/12/18 18:13:14
Done.
| |
36 | |
37 private: | |
38 DISALLOW_COPY_AND_ASSIGN(Delegate); | |
39 }; | |
40 | |
41 LogoutConfirmationDialogView(LogoutButtonTray* owner, Delegate* delegate); | |
42 virtual ~LogoutConfirmationDialogView(); | |
43 | |
44 // views::DialogDelegateView: | |
45 virtual void DeleteDelegate() OVERRIDE; | |
46 virtual bool Accept() OVERRIDE; | |
47 virtual ui::ModalType GetModalType() const OVERRIDE; | |
48 virtual string16 GetWindowTitle() const OVERRIDE; | |
49 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; | |
50 virtual void OnClosed() OVERRIDE; | |
51 | |
52 void Show(base::TimeDelta duration); | |
53 | |
54 void UpdateDialogDuration(base::TimeDelta duration); | |
55 | |
56 private: | |
57 void LogoutCurrentUser(); | |
58 void UpdateCountdown(); | |
59 | |
60 views::Label* text_label_; | |
61 | |
62 base::TimeTicks countdown_start_time_; | |
63 base::TimeDelta duration_; | |
64 | |
65 base::RepeatingTimer<LogoutConfirmationDialogView> timer_; | |
66 | |
67 LogoutButtonTray* owner_; | |
68 | |
69 Delegate* delegate_; | |
70 | |
71 DISALLOW_COPY_AND_ASSIGN(LogoutConfirmationDialogView); | |
72 }; | |
73 | |
74 } // namespace internal | |
75 } // namespace ash | |
76 | |
77 #endif // ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_CONFIRMATION_DIALOG_VIEW_H_ | |
OLD | NEW |