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..d6199d078aca54801b5f163fbfaf41c980f9a380 |
--- /dev/null |
+++ b/ash/system/logout_button/logout_confirmation_dialog_view.h |
@@ -0,0 +1,81 @@ |
+// 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/memory/weak_ptr.h" |
bartfab (slow)
2013/12/10 12:41:16
Nit: Actually not needed once you remove |owner| a
binjin
2013/12/12 13:56:55
Done.
|
+#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; |
bartfab (slow)
2013/12/10 12:41:16
Nit: Actually not needed once you remove |owner| a
|
+class LogoutConfirmationDialogView; |
bartfab (slow)
2013/12/10 12:41:16
Nit: This is not needed. You are about to declare
binjin
2013/12/12 13:56:55
Done.
|
+ |
+// This class implements dialog view for logout confirmation. |
+class ASH_EXPORT LogoutConfirmationDialogView : |
+ public views::DialogDelegateView { |
+ public: |
+ |
bartfab (slow)
2013/12/10 12:41:16
Nit: No blank line needed here.
binjin
2013/12/12 13:56:55
Done.
|
+ // This class provide setting and interface for LogoutConfirmationDialogView. |
+ // It's supposed to be overridden for testing purpose. |
+ class ASH_EXPORT LogoutConfirmationDelegate { |
+ public: |
+ LogoutConfirmationDelegate(); |
+ virtual ~LogoutConfirmationDelegate(); |
+ |
+ virtual void LogoutCurrentUser(); |
+ virtual base::TimeTicks GetCurrentTime(); |
+ virtual base::TimeDelta GetUpdateInterval(); |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(LogoutConfirmationDelegate); |
+ }; |
+ |
+ LogoutConfirmationDialogView(base::WeakPtr<LogoutButtonTray> owner, |
bartfab (slow)
2013/12/10 12:41:16
Nit 1: As noted in my comment for LogoutButtonTray
|
+ LogoutConfirmationDelegate* delegate); |
+ virtual ~LogoutConfirmationDialogView(); |
+ |
+ // views::DialogDelegateView: |
+ virtual void DeleteDelegate() OVERRIDE; |
+ virtual bool Accept() OVERRIDE; |
+ virtual ui::ModalType GetModalType() const OVERRIDE; |
+ virtual string16 GetWindowTitle() const OVERRIDE; |
+ virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; |
+ |
+ void Show(base::TimeDelta duration); |
+ 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_; |
+ |
+ base::WeakPtr<LogoutButtonTray> owner_; |
bartfab (slow)
2013/12/10 12:41:16
Nit: As noted in my comment for LogoutButtonTray,
|
+ |
+ LogoutConfirmationDelegate* delegate_; // Not owned |
bartfab (slow)
2013/12/10 12:41:16
Nit 1: No need for the "Not owned" comment. I know
binjin
2013/12/12 13:56:55
Done.
|
+ |
+ DISALLOW_COPY_AND_ASSIGN(LogoutConfirmationDialogView); |
+}; |
+ |
+} // namespace internal |
+} // namespace ash |
+ |
+#endif // ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_CONFIRMATION_DIALOG_VIEW_H_ |