OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_ | 5 #ifndef ASH_SYSTEM_SESSION_LOGOUT_BUTTON_TRAY_H_ |
6 #define ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_ | 6 #define ASH_SYSTEM_SESSION_LOGOUT_BUTTON_TRAY_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/system/logout_button/logout_button_observer.h" | 9 #include "ash/system/session/logout_button_observer.h" |
10 #include "ash/system/logout_button/logout_confirmation_dialog_view.h" | |
11 #include "ash/system/tray/tray_background_view.h" | 10 #include "ash/system/tray/tray_background_view.h" |
12 #include "ash/system/user/login_status.h" | 11 #include "ash/system/user/login_status.h" |
13 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
14 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "base/time/time.h" | 14 #include "base/time/time.h" |
17 #include "ui/views/controls/button/button.h" | 15 #include "ui/views/controls/button/button.h" |
18 | 16 |
19 namespace views { | 17 namespace views { |
20 class LabelButton; | 18 class LabelButton; |
21 } | 19 } |
22 | 20 |
23 namespace ash { | 21 namespace ash { |
24 namespace internal { | 22 namespace internal { |
25 | 23 |
(...skipping 18 matching lines...) Expand all Loading... |
44 // LogoutButtonObserver: | 42 // LogoutButtonObserver: |
45 virtual void OnShowLogoutButtonInTrayChanged(bool show) OVERRIDE; | 43 virtual void OnShowLogoutButtonInTrayChanged(bool show) OVERRIDE; |
46 virtual void OnLogoutDialogDurationChanged(base::TimeDelta duration) OVERRIDE; | 44 virtual void OnLogoutDialogDurationChanged(base::TimeDelta duration) OVERRIDE; |
47 | 45 |
48 // views::ButtonListener: | 46 // views::ButtonListener: |
49 virtual void ButtonPressed(views::Button* sender, | 47 virtual void ButtonPressed(views::Button* sender, |
50 const ui::Event& event) OVERRIDE; | 48 const ui::Event& event) OVERRIDE; |
51 | 49 |
52 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); | 50 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); |
53 | 51 |
54 // Nullify the pointer to confirmation dialog, this is expected to be called | |
55 // when the confirmation dialog is going to be destroyed. | |
56 // Note: the confirmation dialog is not owned by LogoutButtonTray. | |
57 void ReleaseConfirmationDialog(); | |
58 | |
59 void SetDelegateForTest( | |
60 scoped_ptr<LogoutConfirmationDialogView::Delegate> delegate); | |
61 | |
62 private: | 52 private: |
63 friend class LogoutConfirmationDialogTest; | |
64 | |
65 bool IsConfirmationDialogShowing() const; | |
66 void EnsureConfirmationDialogIsShowing(); | |
67 void EnsureConfirmationDialogIsClosed(); | |
68 | |
69 void UpdateVisibility(); | 53 void UpdateVisibility(); |
70 | 54 |
71 views::LabelButton* button_; // Not owned. | 55 views::LabelButton* button_; |
72 user::LoginStatus login_status_; | 56 user::LoginStatus login_status_; |
73 bool show_logout_button_in_tray_; | 57 bool show_logout_button_in_tray_; |
74 base::TimeDelta dialog_duration_; | 58 base::TimeDelta dialog_duration_; |
75 | 59 |
76 LogoutConfirmationDialogView* confirmation_dialog_; // Not owned. | |
77 scoped_ptr<LogoutConfirmationDialogView::Delegate> confirmation_delegate_; | |
78 | |
79 DISALLOW_COPY_AND_ASSIGN(LogoutButtonTray); | 60 DISALLOW_COPY_AND_ASSIGN(LogoutButtonTray); |
80 }; | 61 }; |
81 | 62 |
82 } // namespace internal | 63 } // namespace internal |
83 } // namespace ash | 64 } // namespace ash |
84 | 65 |
85 #endif // ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_ | 66 #endif // ASH_SYSTEM_SESSION_LOGOUT_BUTTON_TRAY_H_ |
OLD | NEW |