[UMA, Cleanup] Remove an unneeded timing-related histogram.
[chromium-blink-merge.git] / ash / shelf / shelf_widget.h
blob9872705ef90229d6d9feb0795f9fbfb1a90b769d
1 // Copyright (c) 2012 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_SHELF_SHELF_WIDGET_H_
6 #define ASH_SHELF_SHELF_WIDGET_H_
8 #include "ash/ash_export.h"
9 #include "ash/shelf/background_animator.h"
10 #include "ash/shelf/shelf_layout_manager_observer.h"
11 #include "ash/shelf/shelf_types.h"
12 #include "ui/views/widget/widget.h"
13 #include "ui/views/widget/widget_observer.h"
15 namespace aura {
16 class Window;
19 namespace ash {
20 class FocusCycler;
21 class Shelf;
22 class ShelfLayoutManager;
23 class StatusAreaWidget;
24 class WorkspaceController;
26 class ASH_EXPORT ShelfWidget : public views::Widget,
27 public views::WidgetObserver,
28 public ShelfLayoutManagerObserver {
29 public:
30 ShelfWidget(aura::Window* shelf_container,
31 aura::Window* status_container,
32 WorkspaceController* workspace_controller);
33 ~ShelfWidget() override;
35 // Returns if shelf alignment option is enabled, and the user is able
36 // to adjust the alignment (guest and supervised mode users cannot for
37 // example).
38 static bool ShelfAlignmentAllowed();
40 void SetAlignment(ShelfAlignment alignmnet);
41 ShelfAlignment GetAlignment() const;
43 // Sets the shelf's background type.
44 void SetPaintsBackground(ShelfBackgroundType background_type,
45 BackgroundAnimatorChangeType change_type);
46 ShelfBackgroundType GetBackgroundType() const;
48 // Hide the shelf behind a black bar during e.g. a user transition when |hide|
49 // is true. The |animation_time_ms| will be used as animation duration.
50 void HideShelfBehindBlackBar(bool hide, int animation_time_ms);
51 bool IsShelfHiddenBehindBlackBar() const;
53 // Causes shelf items to be slightly dimmed (e.g. when a window is maximized).
54 void SetDimsShelf(bool dimming);
55 bool GetDimsShelf() const;
57 ShelfLayoutManager* shelf_layout_manager() { return shelf_layout_manager_; }
58 Shelf* shelf() const { return shelf_.get(); }
59 StatusAreaWidget* status_area_widget() const { return status_area_widget_; }
61 void CreateShelf();
63 // Set visibility of the shelf.
64 void SetShelfVisibility(bool visible);
65 bool IsShelfVisible() const;
67 // Sets the focus cycler. Also adds the shelf to the cycle.
68 void SetFocusCycler(FocusCycler* focus_cycler);
69 FocusCycler* GetFocusCycler();
71 // Called by the activation delegate, before the shelf is activated
72 // when no other windows are visible.
73 void WillActivateAsFallback() { activating_as_fallback_ = true; }
75 aura::Window* window_container() { return window_container_; }
77 // TODO(harrym): Remove when Status Area Widget is a child view.
78 void ShutdownStatusAreaWidget();
80 // Force the shelf to be presented in an undimmed state.
81 void ForceUndimming(bool force);
83 // Overridden from views::WidgetObserver:
84 void OnWidgetActivationChanged(views::Widget* widget, bool active) override;
86 // A function to test the current alpha used by the dimming bar. If there is
87 // no dimmer active, the function will return -1.
88 int GetDimmingAlphaForTest();
90 // A function to test the bounds of the dimming bar. Returns gfx::Rect() if
91 // the dimmer is inactive.
92 gfx::Rect GetDimmerBoundsForTest();
94 // Disable dimming animations for running tests.
95 void DisableDimmingAnimationsForTest();
97 // ShelfLayoutManagerObserver overrides:
98 void WillDeleteShelf() override;
100 private:
101 class DelegateView;
103 ShelfLayoutManager* shelf_layout_manager_;
104 scoped_ptr<Shelf> shelf_;
105 StatusAreaWidget* status_area_widget_;
107 // delegate_view_ is attached to window_container_ and is cleaned up
108 // during CloseChildWindows of the associated RootWindowController.
109 DelegateView* delegate_view_;
110 BackgroundAnimator background_animator_;
111 bool activating_as_fallback_;
112 aura::Window* window_container_;
115 } // namespace ash
117 #endif // ASH_SHELF_SHELF_WIDGET_H_