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() {} | |
stevenjb
2013/12/19 18:57:44
Null constructors really shouldn't be necessary fo
binjin
2013/12/20 13:35:49
Done.
| |
31 virtual ~Delegate() {} | |
32 | |
33 virtual void LogoutCurrentUser() = 0; | |
34 virtual base::TimeTicks GetCurrentTime() const = 0; | |
35 virtual void ShowDialog(views::DialogDelegate* dialog) = 0; | |
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 bool Accept() OVERRIDE; | |
46 virtual ui::ModalType GetModalType() const OVERRIDE; | |
47 virtual string16 GetWindowTitle() const OVERRIDE; | |
48 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; | |
49 virtual void OnClosed() OVERRIDE; | |
50 virtual void DeleteDelegate() OVERRIDE; | |
51 | |
52 void Show(base::TimeDelta duration); | |
53 | |
54 // The duration of the confirmation dialog can be changed while the dialog | |
55 // is still showing. This method is only expected to be called when the | |
56 // preference for confirmation dialog duration changed. | |
stevenjb
2013/12/19 18:57:44
nit: 'changes' or 'has changed'
binjin
2013/12/20 13:35:49
Done.
| |
57 void UpdateDialogDuration(base::TimeDelta duration); | |
58 | |
59 private: | |
60 void LogoutCurrentUser(); | |
61 void UpdateCountdown(); | |
62 | |
63 views::Label* text_label_; | |
64 | |
65 base::TimeTicks countdown_start_time_; | |
66 base::TimeDelta duration_; | |
67 | |
68 base::RepeatingTimer<LogoutConfirmationDialogView> timer_; | |
69 | |
70 LogoutButtonTray* owner_; | |
71 | |
72 Delegate* delegate_; | |
73 | |
74 DISALLOW_COPY_AND_ASSIGN(LogoutConfirmationDialogView); | |
75 }; | |
76 | |
77 } // namespace internal | |
78 } // namespace ash | |
79 | |
80 #endif // ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_CONFIRMATION_DIALOG_VIEW_H_ | |
OLD | NEW |