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

Unified Diff: ash/system/logout_button/logout_confirmation_dialog_view.h

Issue 40053002: Implements the dialog view for logout button tray in public sessions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 11 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_button/logout_confirmation_dialog_view.h
diff --git a/ash/system/logout_button/logout_confirmation_dialog_view.h b/ash/system/logout_button/logout_confirmation_dialog_view.h
new file mode 100644
index 0000000000000000000000000000000000000000..05f0e1fae77fd8d0bab058e4d1d4a21a665272b5
--- /dev/null
+++ b/ash/system/logout_button/logout_confirmation_dialog_view.h
@@ -0,0 +1,77 @@
+// Copyright (c) 2013 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_BUTTON_LOGOUT_CONFIRMATION_DIALOG_VIEW_H_
+#define ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_CONFIRMATION_DIALOG_VIEW_H_
+
+#include "ash/ash_export.h"
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/time/time.h"
+#include "base/timer/timer.h"
+#include "ui/views/window/dialog_delegate.h"
+
+namespace views {
+class Label;
+}
+
+namespace ash {
+namespace internal {
+
+class LogoutButtonTray;
+
+// This class implements dialog view for logout confirmation.
+class ASH_EXPORT LogoutConfirmationDialogView
+ : public views::DialogDelegateView {
+ public:
+ class ASH_EXPORT Delegate {
+ public:
+ virtual ~Delegate() {}
+
+ virtual void LogoutCurrentUser() = 0;
+ virtual base::TimeTicks GetCurrentTime() const = 0;
+ virtual void ShowDialog(views::DialogDelegate* dialog) = 0;
+ };
+
+ LogoutConfirmationDialogView(LogoutButtonTray* owner, Delegate* delegate);
+ virtual ~LogoutConfirmationDialogView();
+
+ // views::DialogDelegateView:
+ virtual bool Accept() OVERRIDE;
+ virtual ui::ModalType GetModalType() const OVERRIDE;
+ virtual base::string16 GetWindowTitle() const OVERRIDE;
+ virtual base::string16
+ GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE;
+ virtual void OnClosed() OVERRIDE;
+ virtual void DeleteDelegate() OVERRIDE;
+
+ void Show(base::TimeDelta duration);
+
+ // The duration of the confirmation dialog can be changed while the dialog
+ // is still showing. This method is only expected to be called when the
+ // preference for confirmation dialog duration has changed.
+ void UpdateDialogDuration(base::TimeDelta duration);
+
+ private:
+ void LogoutCurrentUser();
+ void UpdateCountdown();
+
+ views::Label* text_label_;
+
+ base::TimeTicks countdown_start_time_;
+ base::TimeDelta duration_;
+
+ base::RepeatingTimer<LogoutConfirmationDialogView> timer_;
+
+ LogoutButtonTray* owner_;
+
+ Delegate* delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(LogoutConfirmationDialogView);
+};
+
+} // namespace internal
+} // namespace ash
+
+#endif // ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_CONFIRMATION_DIALOG_VIEW_H_
« no previous file with comments | « ash/system/logout_button/logout_button_tray_unittest.cc ('k') | ash/system/logout_button/logout_confirmation_dialog_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698