Chromium Code Reviews| 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/ash_export.h" | |
| 8 #include "ash/system/logout_button/logout_button_observer.h" | 9 #include "ash/system/logout_button/logout_button_observer.h" |
| 9 #include "ash/system/tray/tray_background_view.h" | 10 #include "ash/system/tray/tray_background_view.h" |
| 10 #include "ash/system/user/login_status.h" | 11 #include "ash/system/user/login_status.h" |
| 11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "base/memory/weak_ptr.h" | |
| 16 #include "base/time/time.h" | |
| 13 #include "ui/views/controls/button/button.h" | 17 #include "ui/views/controls/button/button.h" |
| 14 | 18 |
| 15 namespace views { | 19 namespace views { |
| 16 class LabelButton; | 20 class LabelButton; |
| 17 } | 21 } |
| 18 | 22 |
| 19 namespace ash { | 23 namespace ash { |
| 20 namespace internal { | 24 namespace internal { |
| 21 | 25 |
| 26 class LogoutConfirmationDialogView; | |
| 27 class LogoutConfirmationSettingsProvider; | |
| 22 class StatusAreaWidget; | 28 class StatusAreaWidget; |
| 23 | 29 |
| 24 // Adds a logout button to the launcher's status area if enabled by the | 30 // Adds a logout button to the launcher's status area if enabled by the |
| 25 // kShowLogoutButtonInTray pref. | 31 // kShowLogoutButtonInTray pref. |
| 26 class LogoutButtonTray : public TrayBackgroundView, | 32 class ASH_EXPORT LogoutButtonTray : public TrayBackgroundView, |
| 27 public LogoutButtonObserver, | 33 public LogoutButtonObserver, |
| 28 public views::ButtonListener { | 34 public views::ButtonListener { |
| 29 public: | 35 public: |
| 30 explicit LogoutButtonTray(StatusAreaWidget* status_area_widget); | 36 explicit LogoutButtonTray(StatusAreaWidget* status_area_widget); |
| 31 virtual ~LogoutButtonTray(); | 37 virtual ~LogoutButtonTray(); |
| 32 | 38 |
| 39 void EnsureConfirmationDialogIsShowing(); | |
| 40 void EnsureConfirmationDialogIsClosed(); | |
| 41 bool IsConfirmationDialogShowing(); | |
| 42 | |
| 33 // TrayBackgroundView: | 43 // TrayBackgroundView: |
| 34 virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE; | 44 virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE; |
| 35 virtual base::string16 GetAccessibleNameForTray() OVERRIDE; | 45 virtual base::string16 GetAccessibleNameForTray() OVERRIDE; |
| 36 virtual void HideBubbleWithView( | 46 virtual void HideBubbleWithView( |
| 37 const views::TrayBubbleView* bubble_view) OVERRIDE; | 47 const views::TrayBubbleView* bubble_view) OVERRIDE; |
| 38 virtual bool ClickedOutsideBubble() OVERRIDE; | 48 virtual bool ClickedOutsideBubble() OVERRIDE; |
| 39 | 49 |
| 40 // LogoutButtonObserver: | 50 // LogoutButtonObserver: |
| 41 virtual void OnShowLogoutButtonInTrayChanged(bool show) OVERRIDE; | 51 virtual void OnShowLogoutButtonInTrayChanged(bool show) OVERRIDE; |
| 52 virtual void OnLogoutDialogDurationChanged(base::TimeDelta duration) OVERRIDE; | |
| 42 | 53 |
| 43 // views::ButtonListener: | 54 // views::ButtonListener: |
| 44 virtual void ButtonPressed(views::Button* sender, | 55 virtual void ButtonPressed(views::Button* sender, |
| 45 const ui::Event& event) OVERRIDE; | 56 const ui::Event& event) OVERRIDE; |
| 46 | 57 |
| 47 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); | 58 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); |
| 48 | 59 |
| 60 void DeleteConfirmationDialog(); | |
| 61 | |
| 62 void OnUserLogoutEvent(); | |
|
bartfab (slow)
2013/12/03 19:46:04
This method name is rather cryptic. Also, the meth
binjin
2013/12/04 10:47:03
The reason I didn't call ButtonPressed() directly
bartfab (slow)
2013/12/04 12:51:56
You can make the test a friend of LogoutButtonTray
binjin
2013/12/05 10:08:05
Done.
| |
| 63 | |
| 64 LogoutConfirmationDialogView* GetConfirmationDialog(); | |
|
bartfab (slow)
2013/12/03 19:46:04
Nit: This is used in tests only. You could rename
binjin
2013/12/04 10:47:03
Done.
| |
| 65 | |
| 49 private: | 66 private: |
| 50 void UpdateVisibility(); | 67 void UpdateVisibility(); |
| 51 | 68 |
| 52 views::LabelButton* button_; // Not owned. | 69 views::LabelButton* button_; // Not owned. |
| 53 user::LoginStatus login_status_; | 70 user::LoginStatus login_status_; |
| 54 bool show_logout_button_in_tray_; | 71 bool show_logout_button_in_tray_; |
| 72 base::TimeDelta dialog_duration_; | |
| 73 | |
| 74 scoped_ptr<LogoutConfirmationDialogView> confirmation_dialog_; | |
| 75 base::WeakPtrFactory<LogoutButtonTray> weak_factory_; | |
| 55 | 76 |
| 56 DISALLOW_COPY_AND_ASSIGN(LogoutButtonTray); | 77 DISALLOW_COPY_AND_ASSIGN(LogoutButtonTray); |
| 57 }; | 78 }; |
| 58 | 79 |
| 59 } // namespace internal | 80 } // namespace internal |
| 60 } // namespace ash | 81 } // namespace ash |
| 61 | 82 |
| 62 #endif // ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_ | 83 #endif // ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_ |
| OLD | NEW |