| OLD | NEW |
| (Empty) |
| 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 | |
| 5 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_SESSION_LOGOUT_BUTTON_TRAY_H_ | |
| 6 #define ASH_COMMON_SYSTEM_CHROMEOS_SESSION_LOGOUT_BUTTON_TRAY_H_ | |
| 7 | |
| 8 #include "ash/ash_export.h" | |
| 9 #include "ash/common/login_status.h" | |
| 10 #include "ash/common/system/chromeos/session/logout_button_observer.h" | |
| 11 #include "ash/common/system/tray/tray_background_view.h" | |
| 12 #include "base/macros.h" | |
| 13 #include "base/time/time.h" | |
| 14 #include "ui/views/controls/button/button.h" | |
| 15 | |
| 16 namespace views { | |
| 17 class LabelButton; | |
| 18 } | |
| 19 | |
| 20 namespace ash { | |
| 21 | |
| 22 // Adds a logout button to the launcher's status area if enabled by the | |
| 23 // kShowLogoutButtonInTray pref. | |
| 24 class ASH_EXPORT LogoutButtonTray : public TrayBackgroundView, | |
| 25 public LogoutButtonObserver { | |
| 26 public: | |
| 27 explicit LogoutButtonTray(WmShelf* wm_shelf); | |
| 28 ~LogoutButtonTray() override; | |
| 29 | |
| 30 // TrayBackgroundView: | |
| 31 void SetShelfAlignment(ShelfAlignment alignment) override; | |
| 32 base::string16 GetAccessibleNameForTray() override; | |
| 33 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override; | |
| 34 void ClickedOutsideBubble() override; | |
| 35 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | |
| 36 | |
| 37 // LogoutButtonObserver: | |
| 38 void OnShowLogoutButtonInTrayChanged(bool show) override; | |
| 39 void OnLogoutDialogDurationChanged(base::TimeDelta duration) override; | |
| 40 | |
| 41 void UpdateAfterLoginStatusChange(LoginStatus login_status); | |
| 42 | |
| 43 private: | |
| 44 void UpdateVisibility(); | |
| 45 void UpdateButtonTextAndImage(LoginStatus login_status, | |
| 46 ShelfAlignment alignment); | |
| 47 | |
| 48 views::LabelButton* button_; | |
| 49 LoginStatus login_status_; | |
| 50 bool show_logout_button_in_tray_; | |
| 51 base::TimeDelta dialog_duration_; | |
| 52 | |
| 53 DISALLOW_COPY_AND_ASSIGN(LogoutButtonTray); | |
| 54 }; | |
| 55 | |
| 56 } // namespace ash | |
| 57 | |
| 58 #endif // ASH_COMMON_SYSTEM_CHROMEOS_SESSION_LOGOUT_BUTTON_TRAY_H_ | |
| OLD | NEW |