Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_UI_IDLE_LOGOUT_DIALOG_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_UI_IDLE_LOGOUT_DIALOG_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/memory/scoped_ptr.h" | |
|
tfarina
2012/03/14 16:45:47
nit: remove, unused here.
rkc
2012/03/14 22:35:32
Done.
| |
| 10 #include "base/string16.h" | |
|
tfarina
2012/03/14 16:45:47
nit: this comes from from dialog_delegate.h below,
rkc
2012/03/14 22:35:32
Done.
| |
| 11 #include "base/timer.h" | |
| 12 #include "ui/views/controls/label.h" | |
|
tfarina
2012/03/14 16:45:47
nit: just forward declare this instead.
rkc
2012/03/14 22:35:32
Done.
| |
| 13 #include "ui/views/window/dialog_delegate.h" | |
| 14 | |
| 15 namespace base { | |
| 16 class TimeDelta; | |
| 17 } | |
| 18 | |
| 19 // A class to show the logout on idle dialog if the machine is in retail mode. | |
| 20 class IdleLogoutDialog : public views::DialogDelegateView { | |
|
tfarina
2012/03/14 16:45:47
nit: As many other views dialog, I'd name this as
rkc
2012/03/14 22:35:32
Done.
| |
| 21 public: | |
| 22 static void ShowIdleLogoutDialog(); | |
|
tfarina
2012/03/14 16:45:47
nit: This names is redundant. I think it's better
rkc
2012/03/14 22:35:32
Show/CloseDialog seem more appropriate; renaming t
| |
| 23 static void CloseIdleLogoutDialog(); | |
| 24 | |
| 25 // views::DialogDelegateView: | |
| 26 virtual int GetDialogButtons() const OVERRIDE; | |
| 27 virtual ui::ModalType GetModalType() const OVERRIDE; | |
| 28 virtual string16 GetWindowTitle() const OVERRIDE; | |
| 29 virtual views::View* GetContentsView() OVERRIDE; | |
| 30 virtual void DeleteDelegate() OVERRIDE; | |
| 31 | |
| 32 // views::View | |
| 33 virtual void Layout() OVERRIDE; | |
| 34 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
| 35 | |
| 36 private: | |
| 37 IdleLogoutDialog(); | |
| 38 | |
| 39 // Calls init after checking if the class is still alive. | |
| 40 static void CallInit(IdleLogoutDialog** dialog); | |
| 41 // Adds the labels and adds them to the layout. | |
| 42 void Init(); | |
| 43 | |
| 44 void Show(); | |
| 45 void Close(); | |
| 46 | |
| 47 void UpdateCountdownTimer(); | |
| 48 | |
| 49 // Indicate that this instance has been 'closed' and should not be used. | |
| 50 void set_closed() { *instance_holder_ = NULL; } | |
| 51 // If our instance holder holds NULL, means we've been closed already. | |
| 52 bool is_closed() { return NULL == *instance_holder_; } | |
|
tfarina
2012/03/14 16:45:47
nit: bool is_closed() const { ... };
rkc
2012/03/14 22:35:32
Done.
| |
| 53 | |
| 54 views::Label* restart_label_; | |
| 55 views::Label* warning_label_; | |
| 56 | |
| 57 // Time at which the countdown is over and we should close the dialog. | |
| 58 base::Time countdown_end_time_; | |
| 59 | |
| 60 base::RepeatingTimer<IdleLogoutDialog> timer_; | |
| 61 | |
| 62 // Holds a pointer to our instance; if we are closed, we set this to hold | |
| 63 // a NULL value, indicating that our instance is been 'closed' and should | |
| 64 // not be used further. The delete will happen async to the closing. | |
| 65 IdleLogoutDialog** instance_holder_; | |
| 66 | |
| 67 DISALLOW_COPY_AND_ASSIGN(IdleLogoutDialog); | |
| 68 }; | |
| 69 | |
| 70 #endif // CHROME_BROWSER_CHROMEOS_UI_IDLE_LOGOUT_DIALOG_H_ | |
| OLD | NEW |