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

Unified Diff: ash/system/logout_confirmation/logout_confirmation_controller.h

Issue 178183005: Add LogoutConfirmationController to show LogoutConfirmationDialogs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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: ash/system/logout_confirmation/logout_confirmation_controller.h
diff --git a/ash/system/logout_confirmation/logout_confirmation_controller.h b/ash/system/logout_confirmation/logout_confirmation_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..99baa86e23da5fad291773150bddc0b25a2a3570
--- /dev/null
+++ b/ash/system/logout_confirmation/logout_confirmation_controller.h
@@ -0,0 +1,62 @@
+// Copyright 2014 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 ASH_SYSTEM_LOGOUT_CONFIRMATION_LOGOUT_CONFIRMATION_CONTROLLER_H_
+#define ASH_SYSTEM_LOGOUT_CONFIRMATION_LOGOUT_CONFIRMATION_CONTROLLER_H_
+
+#include "ash/ash_export.h"
+#include "base/basictypes.h"
+#include "base/callback.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/time/time.h"
+#include "base/timer/timer.h"
+
+namespace base {
+class TickClock;
+}
+
+namespace ash {
+namespace internal {
+
+class LogoutConfirmationDialog;
+
+// This class shows a dialog asking the user to confirm or deny logout and
+// terminates the session if the user either confirms or allows the countdown
+// shown in the dialog to expire.
+// It is guaranteed that no more than one confirmation dialog will be visible at
+// any given time. If there are multiple requests to show a confirmation dialog
+// at the same time, the dialog whose countdown expires first is shown.
+class ASH_EXPORT LogoutConfirmationController {
+ public:
+ LogoutConfirmationController(scoped_ptr<base::TickClock> clock,
stevenjb 2014/02/27 17:58:44 Are we passing in clock (instead of constructing i
bartfab (slow) 2014/02/28 12:13:49 Done.
+ const base::Closure& logout_closure);
+ virtual ~LogoutConfirmationController();
stevenjb 2014/02/27 17:58:44 This doesn't appear to need to be virtual.
bartfab (slow) 2014/02/28 12:13:49 You were right in the version of the CL you looked
+
+ base::TickClock* Clock() const;
stevenjb 2014/02/27 17:58:44 This can be: base::TickClock* clock() const { re
bartfab (slow) 2014/02/28 12:13:49 Done.
+
+ // Shows a LogoutConfirmationDialog. If a confirmation dialog is already being
+ // shown, it is closed and a new one opened if |logout_time| is earlier than
+ // the current dialog's |logout_time_|.
+ void ConfirmLogout(base::TimeTicks logout_time);
+
+ // Called by the |dialog_| when the user confirms logout.
+ void OnLogoutConfirmed();
stevenjb 2014/02/27 17:58:44 WS
bartfab (slow) 2014/02/28 12:13:49 Done.
+ // Called by the |dialog_| when it is closed.
+ void OnDialogClosed();
+
+ private:
+ scoped_ptr<base::TickClock> clock_;
+ base::Closure logout_closure_;
+
+ base::TimeTicks logout_time_;
+ LogoutConfirmationDialog* dialog_;
stevenjb 2014/02/27 17:58:44 Comment ownership of raw pointer. (Views hierarchy
bartfab (slow) 2014/02/28 12:13:49 Done.
+ base::Timer logout_timer_;
+
+ DISALLOW_COPY_AND_ASSIGN(LogoutConfirmationController);
+};
+
+} // namespace internal
+} // namespace ash
+
+#endif // ASH_SYSTEM_LOGOUT_CONFIRMATION_LOGOUT_CONFIRMATION_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698