123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- // Copyright 2014 The Chromium Authors. All rights reserved.
- // Use of this source code is governed by a BSD-style license that can be
- // found in the LICENSE file.
- #ifndef ASH_SYSTEM_SESSION_LOGOUT_BUTTON_TRAY_H_
- #define ASH_SYSTEM_SESSION_LOGOUT_BUTTON_TRAY_H_
- #include <memory>
- #include "ash/ash_export.h"
- #include "ash/public/cpp/session/session_observer.h"
- #include "ash/system/tray/tray_background_view.h"
- #include "base/time/time.h"
- #include "ui/views/controls/button/button.h"
- #include "ui/views/view.h"
- class PrefChangeRegistrar;
- class PrefRegistrySimple;
- namespace views {
- class MdTextButton;
- }
- namespace ash {
- class Shelf;
- // Adds a logout button to the shelf's status area if enabled by the
- // kShowLogoutButtonInTray pref.
- class ASH_EXPORT LogoutButtonTray : public TrayBackgroundView,
- public SessionObserver {
- public:
- explicit LogoutButtonTray(Shelf* shelf);
- LogoutButtonTray(const LogoutButtonTray&) = delete;
- LogoutButtonTray& operator=(const LogoutButtonTray&) = delete;
- ~LogoutButtonTray() override;
- static void RegisterProfilePrefs(PrefRegistrySimple* registry);
- // TrayBackgroundView:
- void UpdateAfterLoginStatusChange() override;
- void UpdateLayout() override;
- void UpdateBackground() override;
- void ClickedOutsideBubble() override;
- void HideBubbleWithView(const TrayBubbleView* bubble_view) override;
- std::u16string GetAccessibleNameForTray() override;
- void HandleLocaleChange() override;
- const char* GetClassName() const override;
- void OnThemeChanged() override;
- // SessionObserver:
- void OnActiveUserPrefServiceChanged(PrefService* prefs) override;
- views::MdTextButton* button_for_test() const { return button_; }
- private:
- void UpdateShowLogoutButtonInTray();
- void UpdateLogoutDialogDuration();
- void UpdateVisibility();
- void UpdateButtonTextAndImage();
- void ButtonPressed();
- views::MdTextButton* button_;
- bool show_logout_button_in_tray_ = false;
- base::TimeDelta dialog_duration_;
- // Observes user profile prefs.
- std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
- };
- } // namespace ash
- #endif // ASH_SYSTEM_SESSION_LOGOUT_BUTTON_TRAY_H_
|