Set region for windows that are expanded.
[chromium-blink-merge.git] / ash / shelf / shelf_widget.h
blobc7adb742555845ad3da53dc620b615ac45a6d6d5
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_types.h"
11 #include "ui/views/widget/widget.h"
12 #include "ui/views/widget/widget_observer.h"
14 namespace aura {
15 class Window;
18 namespace ash {
19 class Launcher;
21 namespace internal {
22 class FocusCycler;
23 class StatusAreaWidget;
24 class ShelfLayoutManager;
25 class WorkspaceController;
28 class ASH_EXPORT ShelfWidget : public views::Widget,
29 public views::WidgetObserver {
30 public:
31 ShelfWidget(
32 aura::Window* shelf_container,
33 aura::Window* status_container,
34 internal::WorkspaceController* workspace_controller);
35 virtual ~ShelfWidget();
37 // Returns if shelf alignment option is enabled, and the user is able
38 // to adjust the alignment (guest and supervised mode users cannot for
39 // example).
40 static bool ShelfAlignmentAllowed();
42 void SetAlignment(ShelfAlignment alignmnet);
43 ShelfAlignment GetAlignment() const;
45 // Sets the shelf's background type.
46 void SetPaintsBackground(
47 ShelfBackgroundType background_type,
48 internal::BackgroundAnimator::ChangeType change_type);
49 ShelfBackgroundType GetBackgroundType() const;
51 // Causes shelf items to be slightly dimmed (eg when a window is maximized).
52 void SetDimsShelf(bool dimming);
53 bool GetDimsShelf() const;
55 internal::ShelfLayoutManager* shelf_layout_manager() {
56 return shelf_layout_manager_;
58 Launcher* launcher() const { return launcher_.get(); }
59 internal::StatusAreaWidget* status_area_widget() const {
60 return status_area_widget_;
63 void CreateLauncher();
65 // Set visibility of the launcher component of the shelf.
66 void SetLauncherVisibility(bool visible);
67 bool IsLauncherVisible() const;
69 // Sets the focus cycler. Also adds the launcher to the cycle.
70 void SetFocusCycler(internal::FocusCycler* focus_cycler);
71 internal::FocusCycler* GetFocusCycler();
73 // Called by the activation delegate, before the launcher is activated
74 // when no other windows are visible.
75 void WillActivateAsFallback() { activating_as_fallback_ = true; }
77 aura::Window* window_container() { return window_container_; }
79 // TODO(harrym): Remove when Status Area Widget is a child view.
80 void ShutdownStatusAreaWidget();
82 // Force the shelf to be presented in an undimmed state.
83 void ForceUndimming(bool force);
85 // Overridden from views::WidgetObserver:
86 virtual void OnWidgetActivationChanged(
87 views::Widget* widget, bool active) OVERRIDE;
89 // A function to test the current alpha used by the dimming bar. If there is
90 // no dimmer active, the function will return -1.
91 int GetDimmingAlphaForTest();
93 // A function to test the bounds of the dimming bar. Returns gfx::Rect() if
94 // the dimmer is inactive.
95 gfx::Rect GetDimmerBoundsForTest();
97 // Disable dimming animations for running tests.
98 void DisableDimmingAnimationsForTest();
100 private:
101 class DelegateView;
103 internal::ShelfLayoutManager* shelf_layout_manager_;
104 scoped_ptr<Launcher> launcher_;
105 internal::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 internal::BackgroundAnimator background_animator_;
111 bool activating_as_fallback_;
112 aura::Window* window_container_;
115 } // namespace ash
117 #endif // ASH_SHELF_SHELF_WIDGET_H_