logout_confirmation_dialog.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_SYSTEM_SESSION_LOGOUT_CONFIRMATION_DIALOG_H_
  5. #define ASH_SYSTEM_SESSION_LOGOUT_CONFIRMATION_DIALOG_H_
  6. #include "base/time/time.h"
  7. #include "base/timer/timer.h"
  8. #include "ui/views/window/dialog_delegate.h"
  9. namespace views {
  10. class Label;
  11. }
  12. namespace ash {
  13. class LogoutConfirmationController;
  14. // A dialog that asks the user to confirm or deny logout. The dialog shows a
  15. // countdown and informs the user that a logout will happen automatically if no
  16. // choice is made before the countdown has expired.
  17. class LogoutConfirmationDialog : public views::DialogDelegateView {
  18. public:
  19. LogoutConfirmationDialog(LogoutConfirmationController* controller,
  20. base::TimeTicks logout_time);
  21. LogoutConfirmationDialog(const LogoutConfirmationDialog&) = delete;
  22. LogoutConfirmationDialog& operator=(const LogoutConfirmationDialog&) = delete;
  23. ~LogoutConfirmationDialog() override;
  24. void Update(base::TimeTicks logout_time);
  25. // Called when |controller_| is no longer valid.
  26. void ControllerGone();
  27. // views::WidgetDelegate:
  28. void WindowClosing() override;
  29. // views::View:
  30. gfx::Size CalculatePreferredSize() const override;
  31. const char* GetClassName() const override;
  32. private:
  33. void UpdateLabel();
  34. void OnDialogAccepted();
  35. LogoutConfirmationController* controller_;
  36. base::TimeTicks logout_time_;
  37. views::Label* label_;
  38. base::RepeatingTimer update_timer_;
  39. };
  40. } // namespace ash
  41. #endif // ASH_SYSTEM_SESSION_LOGOUT_CONFIRMATION_DIALOG_H_