Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: chrome/browser/chromeos/ui/idle_logout_dialog.h

Issue 9665031: Change the idle logout dialog over to use views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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"
10 #include "base/string16.h"
11 #include "base/timer.h"
12 #include "ui/views/controls/label.h"
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 {
21 public:
22 static void ShowIdleLogoutDialog();
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 // Closure that calls init after checking if the class is still alive.
40 friend 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_; }
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698