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_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_ |
6 #define ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_ | 6 #define ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_ |
7 | 7 |
8 #include "ash/system/logout_button/logout_button_observer.h" | 8 #include "ash/system/logout_button/logout_button_observer.h" |
9 #include "ash/system/tray/tray_background_view.h" | 9 #include "ash/system/tray/tray_background_view.h" |
10 #include "ash/system/user/login_status.h" | 10 #include "ash/system/user/login_status.h" |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/weak_ptr.h" | |
14 #include "base/time/time.h" | |
13 #include "ui/views/controls/button/button.h" | 15 #include "ui/views/controls/button/button.h" |
14 | 16 |
15 namespace views { | 17 namespace views { |
16 class LabelButton; | 18 class LabelButton; |
17 } | 19 } |
18 | 20 |
19 namespace ash { | 21 namespace ash { |
20 namespace internal { | 22 namespace internal { |
21 | 23 |
22 class StatusAreaWidget; | 24 class StatusAreaWidget; |
25 class LogoutConfirmationDialogView; | |
23 | 26 |
24 // Adds a logout button to the launcher's status area if enabled by the | 27 // Adds a logout button to the launcher's status area if enabled by the |
25 // kShowLogoutButtonInTray pref. | 28 // kShowLogoutButtonInTray pref. |
26 class LogoutButtonTray : public TrayBackgroundView, | 29 class LogoutButtonTray : public TrayBackgroundView, |
27 public LogoutButtonObserver, | 30 public LogoutButtonObserver, |
28 public views::ButtonListener { | 31 public views::ButtonListener { |
29 public: | 32 public: |
30 explicit LogoutButtonTray(StatusAreaWidget* status_area_widget); | 33 explicit LogoutButtonTray(StatusAreaWidget* status_area_widget); |
31 virtual ~LogoutButtonTray(); | 34 virtual ~LogoutButtonTray(); |
32 | 35 |
36 void EnsureConfirmationDialogShown(); | |
bartfab (slow)
2013/10/28 16:24:07
Nit: I know I suggested the name but I think it ca
binjin
2013/10/29 16:07:05
Done.
| |
37 void EnsureConfirmationDialogClosed(); | |
bartfab (slow)
2013/10/28 16:24:07
Nit: Add "Is" to the name:
EnsureConfirmationDial
binjin
2013/10/29 16:07:05
Done.
| |
38 | |
33 // TrayBackgroundView: | 39 // TrayBackgroundView: |
34 virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE; | 40 virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE; |
35 virtual base::string16 GetAccessibleNameForTray() OVERRIDE; | 41 virtual base::string16 GetAccessibleNameForTray() OVERRIDE; |
36 virtual void HideBubbleWithView( | 42 virtual void HideBubbleWithView( |
37 const views::TrayBubbleView* bubble_view) OVERRIDE; | 43 const views::TrayBubbleView* bubble_view) OVERRIDE; |
38 virtual bool ClickedOutsideBubble() OVERRIDE; | 44 virtual bool ClickedOutsideBubble() OVERRIDE; |
39 | 45 |
40 // LogoutButtonObserver: | 46 // LogoutButtonObserver: |
41 virtual void OnShowLogoutButtonInTrayChanged(bool show) OVERRIDE; | 47 virtual void OnShowLogoutButtonInTrayChanged(bool show) OVERRIDE; |
48 virtual void OnLogoutDialogDurationChanged(int duration) OVERRIDE; | |
42 | 49 |
43 // views::ButtonListener: | 50 // views::ButtonListener: |
44 virtual void ButtonPressed(views::Button* sender, | 51 virtual void ButtonPressed(views::Button* sender, |
45 const ui::Event& event) OVERRIDE; | 52 const ui::Event& event) OVERRIDE; |
46 | 53 |
47 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); | 54 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); |
48 | 55 |
49 private: | 56 private: |
50 void UpdateVisibility(); | 57 void UpdateVisibility(); |
51 | 58 |
52 views::LabelButton* button_; // Not owned. | 59 views::LabelButton* button_; // Not owned. |
53 user::LoginStatus login_status_; | 60 user::LoginStatus login_status_; |
54 bool show_logout_button_in_tray_; | 61 bool show_logout_button_in_tray_; |
62 base::TimeDelta dialog_duration_; | |
63 | |
64 base::WeakPtr<LogoutConfirmationDialogView> confirm_dialog_; | |
bartfab (slow)
2013/10/28 16:24:07
Nit: s/confirm_dialog_/confirmation_dialog_/
binjin
2013/10/29 16:07:05
Done.
| |
55 | 65 |
56 DISALLOW_COPY_AND_ASSIGN(LogoutButtonTray); | 66 DISALLOW_COPY_AND_ASSIGN(LogoutButtonTray); |
57 }; | 67 }; |
58 | 68 |
59 } // namespace internal | 69 } // namespace internal |
60 } // namespace ash | 70 } // namespace ash |
61 | 71 |
62 #endif // ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_ | 72 #endif // ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_ |
OLD | NEW |