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_OVERVIEW_OVERVIEW_BUTTON_TRAY_H_
6 #define ASH_SYSTEM_OVERVIEW_OVERVIEW_BUTTON_TRAY_H_
8 #include "ash/ash_export.h"
9 #include "ash/session/session_state_observer.h"
10 #include "ash/shell_observer.h"
11 #include "ash/system/tray/tray_background_view.h"
19 // Status area tray for showing a toggle for Overview Mode. Overview Mode
20 // is equivalent to WindowSelectorController being in selection mode.
21 // This hosts a ShellObserver that listens for the activation of Maximize Mode
22 // This tray will only be visible while in this state. This tray does not
23 // provide any bubble view windows.
24 class ASH_EXPORT OverviewButtonTray
: public TrayBackgroundView
,
25 public SessionStateObserver
,
26 public ShellObserver
{
28 explicit OverviewButtonTray(StatusAreaWidget
* status_area_widget
);
29 ~OverviewButtonTray() override
;
31 // Updates the tray's visibility based on the LoginStatus and the current
32 // state of MaximizeMode
33 virtual void UpdateAfterLoginStatusChange(user::LoginStatus status
);
36 bool PerformAction(const ui::Event
& event
) override
;
38 // SessionStateObserver:
39 void SessionStateChanged(SessionStateDelegate::SessionState state
) override
;
42 void OnMaximizeModeStarted() override
;
43 void OnMaximizeModeEnded() override
;
44 void OnOverviewModeEnded() override
;
46 // TrayBackgroundView:
47 bool ClickedOutsideBubble() override
;
48 base::string16
GetAccessibleNameForTray() override
;
49 void HideBubbleWithView(const views::TrayBubbleView
* bubble_view
) override
;
50 void SetShelfAlignment(ShelfAlignment alignment
) override
;
53 friend class OverviewButtonTrayTest
;
55 // Creates a new border for the icon. The padding is determined based on the
56 // alignment of the shelf.
57 void SetIconBorderForShelfAlignment();
59 // Sets the icon to visible if maximize mode is enabled and
60 // WindowSelectorController::CanSelect.
61 void UpdateIconVisibility();
63 // Weak pointer, will be parented by TrayContainer for its lifetime.
64 views::ImageView
* icon_
;
66 DISALLOW_COPY_AND_ASSIGN(OverviewButtonTray
);
71 #endif // ASH_SYSTEM_OVERVIEW_OVERVIEW_BUTTON_TRAY_H_