blob: 83d4a8d70135a1bc30c8c8ecd7f2eb9d09ed5f8c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_SHELF_SHELF_WIDGET_H_
#define ASH_SHELF_SHELF_WIDGET_H_
#include "ash/ash_export.h"
#include "ash/shelf/background_animator.h"
#include "ash/shelf/shelf_types.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_observer.h"
namespace aura {
class Window;
}
namespace ash {
class Launcher;
namespace internal {
class FocusCycler;
class StatusAreaWidget;
class ShelfLayoutManager;
class WorkspaceController;
}
class ASH_EXPORT ShelfWidget : public views::Widget,
public views::WidgetObserver {
public:
ShelfWidget(
aura::Window* shelf_container,
aura::Window* status_container,
internal::WorkspaceController* workspace_controller);
virtual ~ShelfWidget();
// Returns if shelf alignment option is enabled, and the user is able
// to adjust the alignment (guest and supervised mode users cannot for
// example).
static bool ShelfAlignmentAllowed();
void SetAlignment(ShelfAlignment alignmnet);
ShelfAlignment GetAlignment() const;
// Sets the shelf's background type.
void SetPaintsBackground(ShelfBackgroundType background_type,
BackgroundAnimatorChangeType change_type);
ShelfBackgroundType GetBackgroundType() const;
// Causes shelf items to be slightly dimmed (e.g. when a window is maximized).
void SetDimsShelf(bool dimming);
bool GetDimsShelf() const;
internal::ShelfLayoutManager* shelf_layout_manager() {
return shelf_layout_manager_;
}
Launcher* launcher() const { return launcher_.get(); }
internal::StatusAreaWidget* status_area_widget() const {
return status_area_widget_;
}
void CreateLauncher();
// Set visibility of the launcher component of the shelf.
void SetLauncherVisibility(bool visible);
bool IsLauncherVisible() const;
// Sets the focus cycler. Also adds the launcher to the cycle.
void SetFocusCycler(internal::FocusCycler* focus_cycler);
internal::FocusCycler* GetFocusCycler();
// Called by the activation delegate, before the launcher is activated
// when no other windows are visible.
void WillActivateAsFallback() { activating_as_fallback_ = true; }
aura::Window* window_container() { return window_container_; }
// TODO(harrym): Remove when Status Area Widget is a child view.
void ShutdownStatusAreaWidget();
// Force the shelf to be presented in an undimmed state.
void ForceUndimming(bool force);
// Overridden from views::WidgetObserver:
virtual void OnWidgetActivationChanged(
views::Widget* widget, bool active) OVERRIDE;
// A function to test the current alpha used by the dimming bar. If there is
// no dimmer active, the function will return -1.
int GetDimmingAlphaForTest();
// A function to test the bounds of the dimming bar. Returns gfx::Rect() if
// the dimmer is inactive.
gfx::Rect GetDimmerBoundsForTest();
// Disable dimming animations for running tests.
void DisableDimmingAnimationsForTest();
private:
class DelegateView;
internal::ShelfLayoutManager* shelf_layout_manager_;
scoped_ptr<Launcher> launcher_;
internal::StatusAreaWidget* status_area_widget_;
// delegate_view_ is attached to window_container_ and is cleaned up
// during CloseChildWindows of the associated RootWindowController.
DelegateView* delegate_view_;
internal::BackgroundAnimator background_animator_;
bool activating_as_fallback_;
aura::Window* window_container_;
};
} // namespace ash
#endif // ASH_SHELF_SHELF_WIDGET_H_
|