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_VIEW_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_UI_IDLE_LOGOUT_DIALOG_VIEW_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/timer.h" |
| 10 #include "ui/views/window/dialog_delegate.h" |
| 11 |
| 12 namespace base { |
| 13 class TimeDelta; |
| 14 } |
| 15 namespace views { |
| 16 class Label; |
| 17 } |
| 18 |
| 19 // A class to show the logout on idle dialog if the machine is in retail mode. |
| 20 class IdleLogoutDialogView : public views::DialogDelegateView { |
| 21 public: |
| 22 static void ShowDialog(); |
| 23 static void CloseDialog(); |
| 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 private: |
| 33 IdleLogoutDialogView(); |
| 34 virtual ~IdleLogoutDialogView(); |
| 35 |
| 36 // Calls init after checking if the class is still alive. |
| 37 static void CallInit(IdleLogoutDialogView** dialog); |
| 38 // Adds the labels and adds them to the layout. |
| 39 void Init(); |
| 40 |
| 41 void Show(); |
| 42 void Close(); |
| 43 |
| 44 void UpdateCountdownTimer(); |
| 45 |
| 46 // Indicate that this instance has been 'closed' and should not be used. |
| 47 void set_closed() { *instance_holder_ = NULL; } |
| 48 // If our instance holder holds NULL, means we've been closed already. |
| 49 bool is_closed() const { return NULL == *instance_holder_; } |
| 50 |
| 51 views::Label* restart_label_; |
| 52 views::Label* warning_label_; |
| 53 |
| 54 // Time at which the countdown is over and we should close the dialog. |
| 55 base::Time countdown_end_time_; |
| 56 |
| 57 base::RepeatingTimer<IdleLogoutDialogView> timer_; |
| 58 |
| 59 // Holds a pointer to our instance; if we are closed, we set this to hold |
| 60 // a NULL value, indicating that our instance is been 'closed' and should |
| 61 // not be used further. The delete will happen async to the closing. |
| 62 IdleLogoutDialogView** instance_holder_; |
| 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(IdleLogoutDialogView); |
| 65 }; |
| 66 |
| 67 #endif // CHROME_BROWSER_CHROMEOS_UI_IDLE_LOGOUT_DIALOG_VIEW_H_ |
OLD | NEW |