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/memory/weak_ptr.h" | |
bartfab (slow)
2013/12/10 12:41:16
Nit: Actually not needed once you remove |owner| a
binjin
2013/12/12 13:56:55
Done.
| |
12 #include "base/time/time.h" | |
13 #include "base/timer/timer.h" | |
14 #include "ui/views/window/dialog_delegate.h" | |
15 | |
16 namespace views { | |
17 class Label; | |
18 } | |
19 | |
20 namespace ash { | |
21 namespace internal { | |
22 | |
23 class LogoutButtonTray; | |
bartfab (slow)
2013/12/10 12:41:16
Nit: Actually not needed once you remove |owner| a
| |
24 class LogoutConfirmationDialogView; | |
bartfab (slow)
2013/12/10 12:41:16
Nit: This is not needed. You are about to declare
binjin
2013/12/12 13:56:55
Done.
| |
25 | |
26 // This class implements dialog view for logout confirmation. | |
27 class ASH_EXPORT LogoutConfirmationDialogView : | |
28 public views::DialogDelegateView { | |
29 public: | |
30 | |
bartfab (slow)
2013/12/10 12:41:16
Nit: No blank line needed here.
binjin
2013/12/12 13:56:55
Done.
| |
31 // This class provide setting and interface for LogoutConfirmationDialogView. | |
32 // It's supposed to be overridden for testing purpose. | |
33 class ASH_EXPORT LogoutConfirmationDelegate { | |
34 public: | |
35 LogoutConfirmationDelegate(); | |
36 virtual ~LogoutConfirmationDelegate(); | |
37 | |
38 virtual void LogoutCurrentUser(); | |
39 virtual base::TimeTicks GetCurrentTime(); | |
40 virtual base::TimeDelta GetUpdateInterval(); | |
41 | |
42 private: | |
43 DISALLOW_COPY_AND_ASSIGN(LogoutConfirmationDelegate); | |
44 }; | |
45 | |
46 LogoutConfirmationDialogView(base::WeakPtr<LogoutButtonTray> owner, | |
bartfab (slow)
2013/12/10 12:41:16
Nit 1: As noted in my comment for LogoutButtonTray
| |
47 LogoutConfirmationDelegate* delegate); | |
48 virtual ~LogoutConfirmationDialogView(); | |
49 | |
50 // views::DialogDelegateView: | |
51 virtual void DeleteDelegate() OVERRIDE; | |
52 virtual bool Accept() OVERRIDE; | |
53 virtual ui::ModalType GetModalType() const OVERRIDE; | |
54 virtual string16 GetWindowTitle() const OVERRIDE; | |
55 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; | |
56 | |
57 void Show(base::TimeDelta duration); | |
58 void UpdateDialogDuration(base::TimeDelta duration); | |
59 | |
60 private: | |
61 void LogoutCurrentUser(); | |
62 void UpdateCountdown(); | |
63 | |
64 views::Label* text_label_; | |
65 | |
66 base::TimeTicks countdown_start_time_; | |
67 base::TimeDelta duration_; | |
68 | |
69 base::RepeatingTimer<LogoutConfirmationDialogView> timer_; | |
70 | |
71 base::WeakPtr<LogoutButtonTray> owner_; | |
bartfab (slow)
2013/12/10 12:41:16
Nit: As noted in my comment for LogoutButtonTray,
| |
72 | |
73 LogoutConfirmationDelegate* delegate_; // Not owned | |
bartfab (slow)
2013/12/10 12:41:16
Nit 1: No need for the "Not owned" comment. I know
binjin
2013/12/12 13:56:55
Done.
| |
74 | |
75 DISALLOW_COPY_AND_ASSIGN(LogoutConfirmationDialogView); | |
76 }; | |
77 | |
78 } // namespace internal | |
79 } // namespace ash | |
80 | |
81 #endif // ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_CONFIRMATION_DIALOG_VIEW_H_ | |
OLD | NEW |