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

Unified 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: Review comments. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/ui/idle_logout_dialog.h
diff --git a/chrome/browser/chromeos/ui/idle_logout_dialog.h b/chrome/browser/chromeos/ui/idle_logout_dialog.h
new file mode 100644
index 0000000000000000000000000000000000000000..a443a110f1408cbf6a3e2b861afa44e28a098f74
--- /dev/null
+++ b/chrome/browser/chromeos/ui/idle_logout_dialog.h
@@ -0,0 +1,70 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_UI_IDLE_LOGOUT_DIALOG_H_
+#define CHROME_BROWSER_CHROMEOS_UI_IDLE_LOGOUT_DIALOG_H_
+#pragma once
+
+#include "base/memory/scoped_ptr.h"
+#include "base/string16.h"
+#include "base/timer.h"
+#include "ui/views/controls/label.h"
+#include "ui/views/window/dialog_delegate.h"
+
+namespace base {
+class TimeDelta;
+}
+
+// A class to show the logout on idle dialog if the machine is in retail mode.
+class IdleLogoutDialog : public views::DialogDelegateView {
+ public:
+ static void ShowIdleLogoutDialog();
+ static void CloseIdleLogoutDialog();
+
+ // views::DialogDelegateView:
+ virtual int GetDialogButtons() const OVERRIDE;
+ virtual ui::ModalType GetModalType() const OVERRIDE;
+ virtual string16 GetWindowTitle() const OVERRIDE;
+ virtual views::View* GetContentsView() OVERRIDE;
+ virtual void DeleteDelegate() OVERRIDE;
+
+ // views::View
+ virtual void Layout() OVERRIDE;
+ virtual gfx::Size GetPreferredSize() OVERRIDE;
+
+ // Indicate that this instance has been 'closed' and should not be used.
+ void set_closed() { *instance_holder_ = NULL; }
sky 2012/03/12 23:33:38 Don't expose this in the public section.
rkc 2012/03/12 23:57:51 Done.
+ // If our instance holder holds NULL, means we've been closed already.
+ bool is_closed() { return NULL == *instance_holder_; }
+
+ private:
+ IdleLogoutDialog();
+
+ // Closure that calls init after checking if the class is still alive.
+ friend void CallInit(IdleLogoutDialog** dialog);
+ // Adds the labels and adds them to the layout.
+ void Init();
+
+ void Show();
+ void Close();
+
+ void UpdateCountdownTimer();
+
+ views::Label* restart_label_;
+ views::Label* warning_label_;
+
+ // Time at which the countdown is over and we should close the dialog.
+ base::Time countdown_end_time_;
+
+ base::RepeatingTimer<IdleLogoutDialog> timer_;
+
+ // Holds a pointer to our instance; if we are closed, we set this to hold
+ // a NULL value, indicating that our instance is been 'closed' and should
+ // not be used further. The delete will happen async to the closing.
+ IdleLogoutDialog** instance_holder_;
+
+ DISALLOW_COPY_AND_ASSIGN(IdleLogoutDialog);
+};
+
+#endif // CHROME_BROWSER_CHROMEOS_UI_IDLE_LOGOUT_DIALOG_H_

Powered by Google App Engine
This is Rietveld 408576698