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" | |
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; | |
24 class LogoutConfirmationDialogView; | |
25 | |
26 // This class provide setting and interface for LogoutConfirmationDialogView. | |
27 // It's supposed to be overridden for testing purpose. | |
28 class ASH_EXPORT LogoutConfirmationSettingsProvider { | |
bartfab (slow)
2013/12/03 19:46:04
1) This should be an inner class of LogoutConfirma
binjin
2013/12/05 10:08:05
Done.
| |
29 public: | |
30 LogoutConfirmationSettingsProvider(); | |
31 virtual ~LogoutConfirmationSettingsProvider(); | |
32 | |
33 virtual void LogoutCurrentUser(LogoutConfirmationDialogView* dialog); | |
34 virtual base::TimeTicks GetCurrentTime(); | |
35 virtual base::TimeDelta GetUpdateInterval(); | |
36 | |
37 private: | |
38 DISALLOW_COPY_AND_ASSIGN(LogoutConfirmationSettingsProvider); | |
39 }; | |
40 | |
41 // This class implements dialog view for logout confirmation. | |
42 class ASH_EXPORT LogoutConfirmationDialogView : | |
43 public views::DialogDelegateView { | |
44 public: | |
45 LogoutConfirmationDialogView(base::WeakPtr<LogoutButtonTray> owner); | |
46 virtual ~LogoutConfirmationDialogView(); | |
47 | |
48 // views::DialogDelegateView: | |
49 virtual void DeleteDelegate() OVERRIDE; | |
50 virtual bool Accept() OVERRIDE; | |
51 virtual ui::ModalType GetModalType() const OVERRIDE; | |
52 virtual string16 GetWindowTitle() const OVERRIDE; | |
53 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; | |
54 | |
55 void Show(base::TimeDelta duration); | |
56 void UpdateDialogDuration(base::TimeDelta duration); | |
57 | |
58 static void SetProvider(LogoutConfirmationSettingsProvider* provider); | |
59 static LogoutConfirmationSettingsProvider* GetProvider(); | |
60 | |
61 private: | |
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_; | |
72 | |
73 static LogoutConfirmationSettingsProvider* provider_; | |
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 |