blob: 1bd6ae8ca0610c05cc1da4f7c449faef7ac90fd0 (
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
// 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_ROOT_WINDOW_CONTROLLER_H_
#define ASH_ROOT_WINDOW_CONTROLLER_H_
#include "ash/ash_export.h"
#include "ash/shelf/shelf_types.h"
#include "ash/system/user/login_status.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
class SkBitmap;
namespace aura {
class EventFilter;
class RootWindow;
class Window;
}
namespace gfx {
class Point;
}
namespace views {
namespace corewm {
class InputMethodEventFilter;
class RootWindowEventFilter;
}
}
namespace keyboard {
class KeyboardController;
}
namespace ash {
class StackingController;
class ShelfWidget;
class SystemTray;
class ToplevelWindowEventHandler;
namespace internal {
class BootSplashScreen;
class PanelLayoutManager;
class RootWindowLayoutManager;
class ScreenDimmer;
class ShelfLayoutManager;
class StatusAreaWidget;
class SystemBackgroundController;
class SystemModalContainerLayoutManager;
class TouchObserverHUD;
class WorkspaceController;
// This class maintains the per root window state for ash. This class
// owns the root window and other dependent objects that should be
// deleted upon the deletion of the root window. The RootWindowController
// for particular root window is stored as a property and can be obtained
// using |GetRootWindowController(aura::RootWindow*)| function.
class ASH_EXPORT RootWindowController {
public:
explicit RootWindowController(aura::RootWindow* root_window);
~RootWindowController();
// Returns a RootWindowController that has a launcher for given
// |window|. This returns the RootWindowController for the |window|'s
// root window when multiple launcher mode is enabled, or the primary
// RootWindowController otherwise.
static RootWindowController* ForLauncher(aura::Window* window);
// Returns a RootWindowController of the window's root window.
static RootWindowController* ForWindow(const aura::Window* window);
// Returns the RootWindowController of the active root window.
static internal::RootWindowController* ForActiveRootWindow();
aura::RootWindow* root_window() { return root_window_.get(); }
RootWindowLayoutManager* root_window_layout() { return root_window_layout_; }
WorkspaceController* workspace_controller() {
return workspace_controller_.get();
}
ScreenDimmer* screen_dimmer() { return screen_dimmer_.get(); }
// Access the shelf associated with this root window controller,
// NULL if no such shelf exists.
ShelfWidget* shelf() { return shelf_.get(); }
TouchObserverHUD* touch_observer_hud() { return touch_observer_hud_.get(); }
// Sets the touch HUD for this root window controller and adds it as a
// pre-target handler to the root window. Also, removes the previous touch
// HUD, if any, from pre-target handlers.
void SetTouchObserverHUD(TouchObserverHUD* hud);
// Access the shelf layout manager associated with this root
// window controller, NULL if no such shelf exists.
ShelfLayoutManager* GetShelfLayoutManager();
// Returns the system tray on this root window. Note that
// calling this on the root window that doesn't have a launcher will
// lead to a crash.
SystemTray* GetSystemTray();
// Shows context menu at the |location_in_screen|. This uses
// |ShellDelegate::CreateContextMenu| to define the content of the menu.
void ShowContextMenu(const gfx::Point& location_in_screen);
// Returns the layout-manager for the appropriate modal-container. If the
// window is inside the lockscreen modal container, then the layout manager
// for that is returned. Otherwise the layout manager for the default modal
// container is returned.
// If no window is specified (i.e. |window| is NULL), then the lockscreen
// modal container is used if the screen is currently locked. Otherwise, the
// default modal container is used.
SystemModalContainerLayoutManager* GetSystemModalLayoutManager(
aura::Window* window);
aura::Window* GetContainer(int container_id);
void InitLayoutManagers();
void CreateContainers();
// Initializs the RootWindowController for primary display. This
// creates
void InitForPrimaryDisplay();
// Initializes |system_background_| and possibly also |boot_splash_screen_|.
// |is_first_run_after_boot| determines the background's initial color.
void CreateSystemBackground(bool is_first_run_after_boot);
// Show launcher view if it was created hidden (before session has started).
void ShowLauncher();
// Called when the launcher associated with this root window is created.
void OnLauncherCreated();
// Called when the user logs in.
void OnLoginStateChanged(user::LoginStatus status);
// Called when the login status changes after login (such as lock/unlock).
// TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|.
void UpdateAfterLoginStatusChange(user::LoginStatus status);
// Called when the brightness/grayscale animation from white to the login
// desktop background image has started. Starts |boot_splash_screen_|'s
// hiding animation (if the screen is non-NULL).
void HandleInitialDesktopBackgroundAnimationStarted();
// Called when the login background is fully visible. Updates |background_|
// to be black and drops |boot_splash_screen_|.
void HandleDesktopBackgroundVisible();
// Deletes associated objects and clears the state, but doesn't delete
// the root window yet. This is used to delete a secondary displays'
// root window safely when the display disconnect signal is received,
// which may come while we're in the nested message loop.
void Shutdown();
// Deletes all child windows and performs necessary cleanup.
void CloseChildWindows();
// Moves child windows to |dest|.
void MoveWindowsTo(aura::RootWindow* dest);
// Force the shelf to query for it's current visibility state.
void UpdateShelfVisibility();
// Returns true if the active workspace is in immersive mode. Exposed here
// so clients of Ash don't need to know the details of workspace management.
bool IsImmersiveMode() const;
private:
// Creates each of the special window containers that holds windows of various
// types in the shell UI.
void CreateContainersInRootWindow(aura::RootWindow* root_window);
// Initializes the virtual keyboard.
void InitKeyboard();
scoped_ptr<aura::RootWindow> root_window_;
RootWindowLayoutManager* root_window_layout_;
scoped_ptr<StackingController> stacking_controller_;
scoped_ptr<keyboard::KeyboardController> keyboard_controller_;
// The shelf for managing the launcher and the status widget.
scoped_ptr<ShelfWidget> shelf_;
// Manages layout of panels. Owned by PanelContainer.
PanelLayoutManager* panel_layout_manager_;
scoped_ptr<SystemBackgroundController> system_background_;
scoped_ptr<BootSplashScreen> boot_splash_screen_;
scoped_ptr<ScreenDimmer> screen_dimmer_;
scoped_ptr<WorkspaceController> workspace_controller_;
// Heads-up display for touch events.
scoped_ptr<TouchObserverHUD> touch_observer_hud_;
// We need to own event handlers for various containers.
scoped_ptr<ToplevelWindowEventHandler> default_container_handler_;
scoped_ptr<ToplevelWindowEventHandler> always_on_top_container_handler_;
scoped_ptr<ToplevelWindowEventHandler> modal_container_handler_;
scoped_ptr<ToplevelWindowEventHandler> lock_modal_container_handler_;
scoped_ptr<ToplevelWindowEventHandler> panel_container_handler_;
DISALLOW_COPY_AND_ASSIGN(RootWindowController);
};
} // namespace internal
} // ash
#endif // ASH_ROOT_WINDOW_CONTROLLER_H_
|