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_SESSION_LOGOUT_BUTTON_TRAY_H_
6 #define ASH_SYSTEM_SESSION_LOGOUT_BUTTON_TRAY_H_
8 #include "ash/ash_export.h"
9 #include "ash/system/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"
24 class StatusAreaWidget
;
26 // Adds a logout button to the launcher's status area if enabled by the
27 // kShowLogoutButtonInTray pref.
28 class ASH_EXPORT LogoutButtonTray
: public TrayBackgroundView
,
29 public LogoutButtonObserver
,
30 public views::ButtonListener
{
32 explicit LogoutButtonTray(StatusAreaWidget
* status_area_widget
);
33 virtual ~LogoutButtonTray();
35 // TrayBackgroundView:
36 virtual void SetShelfAlignment(ShelfAlignment alignment
) OVERRIDE
;
37 virtual base::string16
GetAccessibleNameForTray() OVERRIDE
;
38 virtual void HideBubbleWithView(
39 const views::TrayBubbleView
* bubble_view
) OVERRIDE
;
40 virtual bool ClickedOutsideBubble() OVERRIDE
;
42 // LogoutButtonObserver:
43 virtual void OnShowLogoutButtonInTrayChanged(bool show
) OVERRIDE
;
44 virtual void OnLogoutDialogDurationChanged(base::TimeDelta duration
) OVERRIDE
;
46 // views::ButtonListener:
47 virtual void ButtonPressed(views::Button
* sender
,
48 const ui::Event
& event
) OVERRIDE
;
50 void UpdateAfterLoginStatusChange(user::LoginStatus login_status
);
53 void UpdateVisibility();
55 views::LabelButton
* button_
;
56 user::LoginStatus login_status_
;
57 bool show_logout_button_in_tray_
;
58 base::TimeDelta dialog_duration_
;
60 DISALLOW_COPY_AND_ASSIGN(LogoutButtonTray
);
63 } // namespace internal
66 #endif // ASH_SYSTEM_SESSION_LOGOUT_BUTTON_TRAY_H_