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

Unified Diff: ash/common/system/chromeos/session/logout_confirmation_controller.h

Issue 2108793002: mash: Convert system tray logout button to wm common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more review comments, fix mash_unittests Created 4 years, 6 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/common/system/chromeos/session/logout_confirmation_controller.h
diff --git a/ash/system/chromeos/session/logout_confirmation_controller.h b/ash/common/system/chromeos/session/logout_confirmation_controller.h
similarity index 77%
rename from ash/system/chromeos/session/logout_confirmation_controller.h
rename to ash/common/system/chromeos/session/logout_confirmation_controller.h
index 2eaa919d54b9a41b528a0183c551eb7df9ad13f2..8634bc03b654e1dbaecba702377d3554aa5b2691 100644
--- a/ash/system/chromeos/session/logout_confirmation_controller.h
+++ b/ash/common/system/chromeos/session/logout_confirmation_controller.h
@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef ASH_SYSTEM_CHROMEOS_SESSION_LOGOUT_CONFIRMATION_CONTROLLER_H_
-#define ASH_SYSTEM_CHROMEOS_SESSION_LOGOUT_CONFIRMATION_CONTROLLER_H_
+#ifndef ASH_COMMON_SYSTEM_CHROMEOS_SESSION_LOGOUT_CONFIRMATION_CONTROLLER_H_
+#define ASH_COMMON_SYSTEM_CHROMEOS_SESSION_LOGOUT_CONFIRMATION_CONTROLLER_H_
#include <memory>
#include "ash/ash_export.h"
#include "ash/common/shell_observer.h"
+#include "ash/common/system/chromeos/session/last_window_closed_observer.h"
#include "base/callback.h"
#include "base/macros.h"
#include "base/time/time.h"
@@ -25,10 +26,16 @@ 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 ShellObserver {
+//
+// In public sessions, asks the user to end the session when the last window is
+// closed.
+class ASH_EXPORT LogoutConfirmationController
+ : public ShellObserver,
+ public LastWindowClosedObserver {
public:
// The |logout_closure| must be safe to call as long as |this| is alive.
explicit LogoutConfirmationController(const base::Closure& logout_closure);
@@ -55,6 +62,9 @@ class ASH_EXPORT LogoutConfirmationController : public ShellObserver {
LogoutConfirmationDialog* dialog_for_testing() const { return dialog_; }
private:
+ // LastWindowClosedObserver:
+ void OnLastWindowClosed() override;
+
std::unique_ptr<base::TickClock> clock_;
base::Closure logout_closure_;
@@ -67,4 +77,4 @@ class ASH_EXPORT LogoutConfirmationController : public ShellObserver {
} // namespace ash
-#endif // ASH_SYSTEM_CHROMEOS_SESSION_LOGOUT_CONFIRMATION_CONTROLLER_H_
+#endif // ASH_COMMON_SYSTEM_CHROMEOS_SESSION_LOGOUT_CONFIRMATION_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698