• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_
6 #define ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_
7 
8 #include "ash/system/logout_button/logout_button_observer.h"
9 #include "ash/system/tray/tray_background_view.h"
10 #include "ash/system/user/login_status.h"
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "ui/views/controls/button/button.h"
14 
15 namespace views {
16 class LabelButton;
17 }
18 
19 namespace ash {
20 namespace internal {
21 
22 class StatusAreaWidget;
23 
24 // Adds a logout button to the launcher's status area if enabled by the
25 // kShowLogoutButtonInTray pref.
26 class LogoutButtonTray : public TrayBackgroundView,
27                          public LogoutButtonObserver,
28                          public views::ButtonListener {
29  public:
30   explicit LogoutButtonTray(StatusAreaWidget* status_area_widget);
31   virtual ~LogoutButtonTray();
32 
33   // TrayBackgroundView:
34   virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE;
35   virtual base::string16 GetAccessibleNameForTray() OVERRIDE;
36   virtual void HideBubbleWithView(
37       const views::TrayBubbleView* bubble_view) OVERRIDE;
38   virtual bool ClickedOutsideBubble() OVERRIDE;
39 
40   // LogoutButtonObserver:
41   virtual void OnShowLogoutButtonInTrayChanged(bool show) OVERRIDE;
42 
43   // views::ButtonListener:
44   virtual void ButtonPressed(views::Button* sender,
45                              const ui::Event& event) OVERRIDE;
46 
47   void UpdateAfterLoginStatusChange(user::LoginStatus login_status);
48 
49  private:
50   void UpdateVisibility();
51 
52   views::LabelButton* button_;  // Not owned.
53   user::LoginStatus login_status_;
54   bool show_logout_button_in_tray_;
55 
56   DISALLOW_COPY_AND_ASSIGN(LogoutButtonTray);
57 };
58 
59 }  // namespace internal
60 }  // namespace ash
61 
62 #endif  // ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_
63