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.
5 #ifndef ASH_SYSTEM_CHROMEOS_SESSION_LOGOUT_BUTTON_TRAY_H_
6 #define ASH_SYSTEM_CHROMEOS_SESSION_LOGOUT_BUTTON_TRAY_H_
8 #include "ash/ash_export.h"
9 #include "ash/system/chromeos/session/logout_button_observer.h"
10 #include "ash/system/tray/tray_background_view.h"
11 #include "ash/system/user/login_status.h"
12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h"
14 #include "base/time/time.h"
15 #include "ui/views/controls/button/button.h"
22 class StatusAreaWidget
;
24 // Adds a logout button to the launcher's status area if enabled by the
25 // kShowLogoutButtonInTray pref.
26 class ASH_EXPORT LogoutButtonTray
: public TrayBackgroundView
,
27 public LogoutButtonObserver
,
28 public views::ButtonListener
{
30 explicit LogoutButtonTray(StatusAreaWidget
* status_area_widget
);
31 ~LogoutButtonTray() override
;
33 // TrayBackgroundView:
34 void SetShelfAlignment(ShelfAlignment alignment
) override
;
35 base::string16
GetAccessibleNameForTray() override
;
36 void HideBubbleWithView(const views::TrayBubbleView
* bubble_view
) override
;
37 bool ClickedOutsideBubble() override
;
39 // LogoutButtonObserver:
40 void OnShowLogoutButtonInTrayChanged(bool show
) override
;
41 void OnLogoutDialogDurationChanged(base::TimeDelta duration
) override
;
43 // views::ButtonListener:
44 void ButtonPressed(views::Button
* sender
, const ui::Event
& event
) override
;
46 void UpdateAfterLoginStatusChange(user::LoginStatus login_status
);
49 void UpdateVisibility();
51 views::LabelButton
* button_
;
52 user::LoginStatus login_status_
;
53 bool show_logout_button_in_tray_
;
54 base::TimeDelta dialog_duration_
;
56 DISALLOW_COPY_AND_ASSIGN(LogoutButtonTray
);
61 #endif // ASH_SYSTEM_CHROMEOS_SESSION_LOGOUT_BUTTON_TRAY_H_