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_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 virtual ~Delegate() {} | |
31 | |
32 virtual void LogoutCurrentUser() = 0; | |
33 virtual base::TimeTicks GetCurrentTime() const = 0; | |
34 virtual void ShowDialog(views::DialogDelegate* dialog) = 0; | |
35 }; | |
36 | |
37 LogoutConfirmationDialogView(LogoutButtonTray* owner, Delegate* delegate); | |
38 virtual ~LogoutConfirmationDialogView(); | |
39 | |
40 // views::DialogDelegateView: | |
41 virtual bool Accept() OVERRIDE; | |
42 virtual ui::ModalType GetModalType() const OVERRIDE; | |
43 virtual base::string16 GetWindowTitle() const OVERRIDE; | |
44 virtual base::string16 | |
45 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; | |
46 virtual void OnClosed() OVERRIDE; | |
47 virtual void DeleteDelegate() OVERRIDE; | |
48 | |
49 void Show(base::TimeDelta duration); | |
50 | |
51 // The duration of the confirmation dialog can be changed while the dialog | |
52 // is still showing. This method is only expected to be called when the | |
53 // preference for confirmation dialog duration has changed. | |
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 |