OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CHROMEOS_UI_IDLE_LOGOUT_DIALOG_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_UI_IDLE_LOGOUT_DIALOG_VIEW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_UI_IDLE_LOGOUT_DIALOG_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_UI_IDLE_LOGOUT_DIALOG_VIEW_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // A class to show the logout on idle dialog if the machine is in retail mode. | 40 // A class to show the logout on idle dialog if the machine is in retail mode. |
41 class IdleLogoutDialogView : public views::DialogDelegateView { | 41 class IdleLogoutDialogView : public views::DialogDelegateView { |
42 public: | 42 public: |
43 static void ShowDialog(); | 43 static void ShowDialog(); |
44 static void CloseDialog(); | 44 static void CloseDialog(); |
45 | 45 |
46 // views::DialogDelegateView: | 46 // views::DialogDelegateView: |
47 virtual int GetDialogButtons() const OVERRIDE; | 47 virtual int GetDialogButtons() const OVERRIDE; |
48 virtual ui::ModalType GetModalType() const OVERRIDE; | 48 virtual ui::ModalType GetModalType() const OVERRIDE; |
49 virtual string16 GetWindowTitle() const OVERRIDE; | 49 virtual string16 GetWindowTitle() const OVERRIDE; |
| 50 virtual bool Close() OVERRIDE; |
50 | 51 |
51 private: | 52 private: |
52 friend class MockIdleLogoutSettingsProvider; | 53 friend class MockIdleLogoutSettingsProvider; |
53 friend class IdleLogoutDialogViewTest; | 54 friend class IdleLogoutDialogViewTest; |
54 FRIEND_TEST_ALL_PREFIXES(IdleLogoutDialogViewTest, ShowDialogAndCloseView); | 55 FRIEND_TEST_ALL_PREFIXES(IdleLogoutDialogViewTest, ShowDialogAndCloseView); |
55 FRIEND_TEST_ALL_PREFIXES(IdleLogoutDialogViewTest, | 56 FRIEND_TEST_ALL_PREFIXES(IdleLogoutDialogViewTest, |
56 ShowDialogAndCloseViewClose); | 57 ShowDialogAndCloseViewClose); |
57 | 58 |
58 IdleLogoutDialogView(); | 59 IdleLogoutDialogView(); |
59 virtual ~IdleLogoutDialogView(); | 60 virtual ~IdleLogoutDialogView(); |
60 | 61 |
61 // Adds the labels and adds them to the layout. | 62 // Adds the labels and adds them to the layout. |
62 void InitAndShow(); | 63 void InitAndShow(); |
63 | 64 |
64 void Show(); | 65 void Show(); |
65 void Close(); | |
66 | 66 |
67 void UpdateCountdown(); | 67 void UpdateCountdown(); |
68 | 68 |
69 // For testing. | 69 // For testing. |
70 static IdleLogoutDialogView* current_instance(); | 70 static IdleLogoutDialogView* current_instance(); |
71 static void set_settings_provider(IdleLogoutSettingsProvider* provider); | 71 static void set_settings_provider(IdleLogoutSettingsProvider* provider); |
72 | 72 |
73 views::Label* restart_label_; | 73 views::Label* restart_label_; |
74 | 74 |
75 // Time at which the countdown is over and we should close the dialog. | 75 // Time at which the countdown is over and we should close the dialog. |
76 base::Time countdown_end_time_; | 76 base::Time countdown_end_time_; |
77 | 77 |
78 base::RepeatingTimer<IdleLogoutDialogView> timer_; | 78 base::RepeatingTimer<IdleLogoutDialogView> timer_; |
79 | 79 |
80 base::WeakPtrFactory<IdleLogoutDialogView> weak_ptr_factory_; | 80 base::WeakPtrFactory<IdleLogoutDialogView> weak_ptr_factory_; |
81 | 81 |
82 static IdleLogoutSettingsProvider* provider_; | 82 static IdleLogoutSettingsProvider* provider_; |
83 | 83 |
84 DISALLOW_COPY_AND_ASSIGN(IdleLogoutDialogView); | 84 DISALLOW_COPY_AND_ASSIGN(IdleLogoutDialogView); |
85 }; | 85 }; |
86 | 86 |
87 } // namespace chromeos | 87 } // namespace chromeos |
88 | 88 |
89 #endif // CHROME_BROWSER_CHROMEOS_UI_IDLE_LOGOUT_DIALOG_VIEW_H_ | 89 #endif // CHROME_BROWSER_CHROMEOS_UI_IDLE_LOGOUT_DIALOG_VIEW_H_ |
OLD | NEW |