Add a struct for spellcheck marker
[chromium-blink-merge.git] / ash / root_window_controller.h
blobf8855a7fdc105332b4c6ac5df6be187fd60f6e13
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_ROOT_WINDOW_CONTROLLER_H_
6 #define ASH_ROOT_WINDOW_CONTROLLER_H_
8 #include "ash/ash_export.h"
9 #include "ash/shelf/shelf_types.h"
10 #include "ash/system/user/login_status.h"
11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h"
14 class SkBitmap;
16 namespace aura {
17 class EventFilter;
18 class RootWindow;
19 class Window;
22 namespace gfx {
23 class Point;
26 namespace views {
27 namespace corewm {
28 class InputMethodEventFilter;
29 class RootWindowEventFilter;
33 namespace keyboard {
34 class KeyboardController;
37 namespace ash {
38 class StackingController;
39 class ShelfWidget;
40 class SystemTray;
41 class ToplevelWindowEventHandler;
43 namespace internal {
45 class BootSplashScreen;
46 class PanelLayoutManager;
47 class RootWindowLayoutManager;
48 class ScreenDimmer;
49 class ShelfLayoutManager;
50 class StatusAreaWidget;
51 class SystemBackgroundController;
52 class SystemModalContainerLayoutManager;
53 class TouchObserverHUD;
54 class WorkspaceController;
56 // This class maintains the per root window state for ash. This class
57 // owns the root window and other dependent objects that should be
58 // deleted upon the deletion of the root window. The RootWindowController
59 // for particular root window is stored as a property and can be obtained
60 // using |GetRootWindowController(aura::RootWindow*)| function.
61 class ASH_EXPORT RootWindowController {
62 public:
63 explicit RootWindowController(aura::RootWindow* root_window);
64 ~RootWindowController();
66 // Returns a RootWindowController that has a launcher for given
67 // |window|. This returns the RootWindowController for the |window|'s
68 // root window when multiple launcher mode is enabled, or the primary
69 // RootWindowController otherwise.
70 static RootWindowController* ForLauncher(aura::Window* window);
72 // Returns a RootWindowController of the window's root window.
73 static RootWindowController* ForWindow(const aura::Window* window);
75 // Returns the RootWindowController of the active root window.
76 static internal::RootWindowController* ForActiveRootWindow();
78 aura::RootWindow* root_window() { return root_window_.get(); }
80 RootWindowLayoutManager* root_window_layout() { return root_window_layout_; }
82 WorkspaceController* workspace_controller() {
83 return workspace_controller_.get();
86 ScreenDimmer* screen_dimmer() { return screen_dimmer_.get(); }
88 // Access the shelf associated with this root window controller,
89 // NULL if no such shelf exists.
90 ShelfWidget* shelf() { return shelf_.get(); }
92 TouchObserverHUD* touch_observer_hud() { return touch_observer_hud_; }
94 // Sets the touch HUD. The RootWindowController will not own this HUD; its
95 // lifetime is managed by itself.
96 void set_touch_observer_hud(TouchObserverHUD* hud) {
97 touch_observer_hud_ = hud;
99 // Access the shelf layout manager associated with this root
100 // window controller, NULL if no such shelf exists.
101 ShelfLayoutManager* GetShelfLayoutManager();
103 // Returns the system tray on this root window. Note that
104 // calling this on the root window that doesn't have a launcher will
105 // lead to a crash.
106 SystemTray* GetSystemTray();
108 // Shows context menu at the |location_in_screen|. This uses
109 // |ShellDelegate::CreateContextMenu| to define the content of the menu.
110 void ShowContextMenu(const gfx::Point& location_in_screen);
112 // Returns the layout-manager for the appropriate modal-container. If the
113 // window is inside the lockscreen modal container, then the layout manager
114 // for that is returned. Otherwise the layout manager for the default modal
115 // container is returned.
116 // If no window is specified (i.e. |window| is NULL), then the lockscreen
117 // modal container is used if the screen is currently locked. Otherwise, the
118 // default modal container is used.
119 SystemModalContainerLayoutManager* GetSystemModalLayoutManager(
120 aura::Window* window);
122 aura::Window* GetContainer(int container_id);
124 void InitLayoutManagers();
125 void CreateContainers();
127 // Initializs the RootWindowController for primary display. This
128 // creates
129 void InitForPrimaryDisplay();
131 // Initializes |system_background_| and possibly also |boot_splash_screen_|.
132 // |is_first_run_after_boot| determines the background's initial color.
133 void CreateSystemBackground(bool is_first_run_after_boot);
135 // Show launcher view if it was created hidden (before session has started).
136 void ShowLauncher();
138 // Called when the launcher associated with this root window is created.
139 void OnLauncherCreated();
141 // Called when the user logs in.
142 void OnLoginStateChanged(user::LoginStatus status);
144 // Called when the login status changes after login (such as lock/unlock).
145 // TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|.
146 void UpdateAfterLoginStatusChange(user::LoginStatus status);
148 // Called when the brightness/grayscale animation from white to the login
149 // desktop background image has started. Starts |boot_splash_screen_|'s
150 // hiding animation (if the screen is non-NULL).
151 void HandleInitialDesktopBackgroundAnimationStarted();
153 // Called when the login background is fully visible. Updates |background_|
154 // to be black and drops |boot_splash_screen_|.
155 void HandleDesktopBackgroundVisible();
157 // Deletes associated objects and clears the state, but doesn't delete
158 // the root window yet. This is used to delete a secondary displays'
159 // root window safely when the display disconnect signal is received,
160 // which may come while we're in the nested message loop.
161 void Shutdown();
163 // Deletes all child windows and performs necessary cleanup.
164 void CloseChildWindows();
166 // Moves child windows to |dest|.
167 void MoveWindowsTo(aura::RootWindow* dest);
169 // Force the shelf to query for it's current visibility state.
170 void UpdateShelfVisibility();
172 // Returns the window, if any, which is in fullscreen mode in the active
173 // workspace. Exposed here so clients of Ash don't need to know the details
174 // of workspace management.
175 aura::Window* GetFullscreenWindow() const;
177 private:
178 // Creates each of the special window containers that holds windows of various
179 // types in the shell UI.
180 void CreateContainersInRootWindow(aura::RootWindow* root_window);
182 // Initializes the virtual keyboard.
183 void InitKeyboard();
185 scoped_ptr<aura::RootWindow> root_window_;
186 RootWindowLayoutManager* root_window_layout_;
188 scoped_ptr<StackingController> stacking_controller_;
190 scoped_ptr<keyboard::KeyboardController> keyboard_controller_;
192 // The shelf for managing the launcher and the status widget.
193 scoped_ptr<ShelfWidget> shelf_;
195 // Manages layout of panels. Owned by PanelContainer.
196 PanelLayoutManager* panel_layout_manager_;
198 scoped_ptr<SystemBackgroundController> system_background_;
199 scoped_ptr<BootSplashScreen> boot_splash_screen_;
201 scoped_ptr<ScreenDimmer> screen_dimmer_;
202 scoped_ptr<WorkspaceController> workspace_controller_;
204 // Heads-up display for touch events. The RootWindowController does not own
205 // this HUD; its lifetime is managed by itself.
206 TouchObserverHUD* touch_observer_hud_;
208 // We need to own event handlers for various containers.
209 scoped_ptr<ToplevelWindowEventHandler> default_container_handler_;
210 scoped_ptr<ToplevelWindowEventHandler> always_on_top_container_handler_;
211 scoped_ptr<ToplevelWindowEventHandler> modal_container_handler_;
212 scoped_ptr<ToplevelWindowEventHandler> lock_modal_container_handler_;
213 scoped_ptr<ToplevelWindowEventHandler> panel_container_handler_;
215 DISALLOW_COPY_AND_ASSIGN(RootWindowController);
218 } // namespace internal
219 } // ash
221 #endif // ASH_ROOT_WINDOW_CONTROLLER_H_