root_window_controller.h revision 1e9bf3e0803691d0a228da41fc608347b6db4340
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef ASH_ROOT_WINDOW_CONTROLLER_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define ASH_ROOT_WINDOW_CONTROLLER_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
8eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include <map>
9eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ash/ash_export.h"
112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ash/shelf/shelf_types.h"
127dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "ash/shell_observer.h"
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ash/system/user/login_status.h"
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/basictypes.h"
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/scoped_ptr.h"
167d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include "ui/base/ui_base_types.h"
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SkBitmap;
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace aura {
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class EventFilter;
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class RootWindow;
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Window;
242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace gfx {
272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class Point;
282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace views {
31eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdochclass Widget;
32eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace corewm {
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class InputMethodEventFilter;
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class RootWindowEventFilter;
363551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)class ScopedCaptureClient;
372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
40c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)namespace keyboard {
41c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)class KeyboardController;
42c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)}
43c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace ash {
452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class StackingController;
462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class ShelfWidget;
472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class SystemTray;
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ToplevelWindowEventHandler;
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace internal {
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
52eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdochclass AlwaysOnTopController;
53eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdochclass AnimatingDesktopController;
54eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdochclass DesktopBackgroundWidgetController;
557d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)class DockedWindowLayoutManager;
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class PanelLayoutManager;
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class RootWindowLayoutManager;
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ScreenDimmer;
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ShelfLayoutManager;
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class StatusAreaWidget;
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SystemBackgroundController;
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SystemModalContainerLayoutManager;
63eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdochclass TouchHudDebug;
64eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdochclass TouchHudProjection;
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class WorkspaceController;
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
674e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#if defined(OS_CHROMEOS)
683551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)class BootSplashScreen;
693551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#endif
703551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This class maintains the per root window state for ash. This class
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// owns the root window and other dependent objects that should be
738bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// deleted upon the deletion of the root window. This object is
748bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// indirectly owned and deleted by |DisplayController|.
758bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// The RootWindowController for particular root window is stored in
768bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// its property (RootWindowSettings) and can be obtained using
778bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// |GetRootWindowController(aura::RootWindow*)| function.
787dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochclass ASH_EXPORT RootWindowController : public ShellObserver {
795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
808bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
818bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // Creates and Initialize the RootWindowController for primary display.
828bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  static void CreateForPrimaryDisplay(aura::RootWindow* root_window);
838bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
848bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // Creates and Initialize the RootWindowController for secondary displays.
858bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  static void CreateForSecondaryDisplay(aura::RootWindow* root_window);
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
871e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // Creates and Initialize the RootWindowController for virtual
881e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // keyboard displays.
891e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  static void CreateForVirtualKeyboardDisplay(aura::RootWindow* root_window);
901e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns a RootWindowController that has a launcher for given
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |window|. This returns the RootWindowController for the |window|'s
935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // root window when multiple launcher mode is enabled, or the primary
945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // RootWindowController otherwise.
955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static RootWindowController* ForLauncher(aura::Window* window);
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Returns a RootWindowController of the window's root window.
982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  static RootWindowController* ForWindow(const aura::Window* window);
992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
100d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // Returns the RootWindowController of the target root window.
101d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  static internal::RootWindowController* ForTargetRootWindow();
1022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1038bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual ~RootWindowController();
1048bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  aura::RootWindow* root_window() { return root_window_.get(); }
1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  RootWindowLayoutManager* root_window_layout() { return root_window_layout_; }
1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  WorkspaceController* workspace_controller() {
1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return workspace_controller_.get();
1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
113eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  AlwaysOnTopController* always_on_top_controller() {
114eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch    return always_on_top_controller_.get();
115eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  }
116eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ScreenDimmer* screen_dimmer() { return screen_dimmer_.get(); }
1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Access the shelf associated with this root window controller,
1202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // NULL if no such shelf exists.
1212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ShelfWidget* shelf() { return shelf_.get(); }
1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
123eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // Get touch HUDs associated with this root window controller.
124eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  TouchHudDebug* touch_hud_debug() const {
125eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch    return touch_hud_debug_;
126eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  }
127eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  TouchHudProjection* touch_hud_projection() const {
128eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch    return touch_hud_projection_;
129eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  }
130eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
131eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // Set touch HUDs for this root window controller. The root window controller
132eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // will not own the HUDs; their lifetimes are managed by themselves. Whenever
133eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // the widget showing a HUD is being destroyed (e.g. because of detaching a
134eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // display), the HUD deletes itself.
135eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  void set_touch_hud_debug(TouchHudDebug* hud) {
136eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch    touch_hud_debug_ = hud;
137eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  }
138eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  void set_touch_hud_projection(TouchHudProjection* hud) {
139eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch    touch_hud_projection_ = hud;
140eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  }
141eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
142eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  DesktopBackgroundWidgetController* wallpaper_controller() {
143eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch    return wallpaper_controller_.get();
144c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  }
145eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  void SetWallpaperController(DesktopBackgroundWidgetController* controller);
146eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  AnimatingDesktopController* animating_wallpaper_controller() {
147eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch    return animating_wallpaper_controller_.get();
148eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  }
149eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  void SetAnimatingWallpaperController(AnimatingDesktopController* controller);
150eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
1512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Access the shelf layout manager associated with this root
1522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // window controller, NULL if no such shelf exists.
1532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ShelfLayoutManager* GetShelfLayoutManager();
1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Returns the system tray on this root window. Note that
1562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // calling this on the root window that doesn't have a launcher will
1572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // lead to a crash.
1582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  SystemTray* GetSystemTray();
1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Shows context menu at the |location_in_screen|. This uses
1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |ShellDelegate::CreateContextMenu| to define the content of the menu.
1627d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)  void ShowContextMenu(const gfx::Point& location_in_screen,
1637d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)                       ui::MenuSourceType source_type);
1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the layout-manager for the appropriate modal-container. If the
1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // window is inside the lockscreen modal container, then the layout manager
1675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // for that is returned. Otherwise the layout manager for the default modal
1685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // container is returned.
1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // If no window is specified (i.e. |window| is NULL), then the lockscreen
1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // modal container is used if the screen is currently locked. Otherwise, the
1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // default modal container is used.
1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  SystemModalContainerLayoutManager* GetSystemModalLayoutManager(
1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      aura::Window* window);
1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  aura::Window* GetContainer(int container_id);
1762385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch  const aura::Window* GetContainer(int container_id) const;
1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Show launcher view if it was created hidden (before session has started).
1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void ShowLauncher();
1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1812a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Called when the launcher associated with this root window is created.
1822a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void OnLauncherCreated();
1832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called when the login status changes after login (such as lock/unlock).
1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|.
1865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void UpdateAfterLoginStatusChange(user::LoginStatus status);
1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called when the brightness/grayscale animation from white to the login
1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // desktop background image has started.  Starts |boot_splash_screen_|'s
1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // hiding animation (if the screen is non-NULL).
1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void HandleInitialDesktopBackgroundAnimationStarted();
1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
193eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // Called when the wallpaper ainmation is finished. Updates |background_|
194eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // to be black and drops |boot_splash_screen_| and moves the wallpaper
195eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // controller into the root window controller. |widget| holds the wallpaper
196eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // image, or NULL if the background is a solid color.
197eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  void OnWallpaperAnimationFinished(views::Widget* widget);
1985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Deletes associated objects and clears the state, but doesn't delete
2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // the root window yet. This is used to delete a secondary displays'
2015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // root window safely when the display disconnect signal is received,
2025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // which may come while we're in the nested message loop.
2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void Shutdown();
2045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Deletes all child windows and performs necessary cleanup.
2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CloseChildWindows();
2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Moves child windows to |dest|.
2091e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  void MoveWindowsTo(aura::Window* dest);
2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Force the shelf to query for it's current visibility state.
2125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void UpdateShelfVisibility();
2135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
214eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // Initialize touch HUDs if necessary.
215eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  void InitTouchHuds();
216eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
21758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // Returns the window, if any, which is in fullscreen mode. If multiple
21858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // windows are in fullscreen state, the topmost one is preferred.
21958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  const aura::Window* GetTopmostFullscreenWindow() const;
2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2214e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  // Activate virtual keyboard on current root window controller.
2224e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  void ActivateKeyboard(keyboard::KeyboardController* keyboard_controller);
2234e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
2244e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  // Deactivate virtual keyboard on current root window controller.
2254e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  void DeactivateKeyboard(keyboard::KeyboardController* keyboard_controller);
2264e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
2275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
2288bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  explicit RootWindowController(aura::RootWindow* root_window);
2291e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  enum RootWindowType {
2301e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)    PRIMARY,
2311e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)    SECONDARY,
2321e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)    VIRTUAL_KEYBOARD
2331e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  };
2348bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
2358bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // Initializes the RootWindowController.  |is_primary| is true if
2368bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // the controller is for primary display.  |first_run_after_boot| is
2378bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // set to true only for primary root window after boot.
2381e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  void Init(RootWindowType root_window_type, bool first_run_after_boot);
2398bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
240eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  void InitLayoutManagers();
241eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
242eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // Initializes |system_background_| and possibly also |boot_splash_screen_|.
243eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // |is_first_run_after_boot| determines the background's initial color.
244eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  void CreateSystemBackground(bool is_first_run_after_boot);
245eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
2465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Creates each of the special window containers that holds windows of various
2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // types in the shell UI.
2485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CreateContainersInRootWindow(aura::RootWindow* root_window);
2495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2507dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  // Enables projection touch HUD.
2517dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  void EnableTouchHudProjection();
2527dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
2537dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  // Disables projection touch HUD.
2547dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  void DisableTouchHudProjection();
2557dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
2567dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  // Overridden from ShellObserver.
2577dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  virtual void OnLoginStateChanged(user::LoginStatus status) OVERRIDE;
2587dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  virtual void OnTouchHudProjectionToggled(bool enabled) OVERRIDE;
2597dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
2605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<aura::RootWindow> root_window_;
2615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  RootWindowLayoutManager* root_window_layout_;
2625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  scoped_ptr<StackingController> stacking_controller_;
2645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The shelf for managing the launcher and the status widget.
2662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  scoped_ptr<ShelfWidget> shelf_;
2675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
268bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch  // An invisible/empty window used as a event target for
269bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch  // |MouseCursorEventFilter| before a user logs in.
270bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch  // (crbug.com/266987)
271bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch  // Its container is |LockScreenBackgroundContainer| and
272bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch  // this must be deleted before the container is deleted.
273bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch  scoped_ptr<aura::Window> mouse_event_target_;
274bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch
2757d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)  // Manages layout of docked windows. Owned by DockedContainer.
2767d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)  DockedWindowLayoutManager* docked_layout_manager_;
2777d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)
2785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Manages layout of panels. Owned by PanelContainer.
2795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  PanelLayoutManager* panel_layout_manager_;
2805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<SystemBackgroundController> system_background_;
2824e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#if defined(OS_CHROMEOS)
2835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<BootSplashScreen> boot_splash_screen_;
2843551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#endif
2855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<ScreenDimmer> screen_dimmer_;
2875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<WorkspaceController> workspace_controller_;
288eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  scoped_ptr<AlwaysOnTopController> always_on_top_controller_;
2895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
290eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // Heads-up displays for touch events. These HUDs are not owned by the root
291eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // window controller and manage their own lifetimes.
292eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  TouchHudDebug* touch_hud_debug_;
293eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  TouchHudProjection* touch_hud_projection_;
294c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
2955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // We need to own event handlers for various containers.
2965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<ToplevelWindowEventHandler> default_container_handler_;
2975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<ToplevelWindowEventHandler> always_on_top_container_handler_;
2985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<ToplevelWindowEventHandler> modal_container_handler_;
2995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<ToplevelWindowEventHandler> lock_modal_container_handler_;
3002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  scoped_ptr<ToplevelWindowEventHandler> panel_container_handler_;
3017d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)  scoped_ptr<ToplevelWindowEventHandler> docked_container_handler_;
3025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
303eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  scoped_ptr<DesktopBackgroundWidgetController> wallpaper_controller_;
304eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  scoped_ptr<AnimatingDesktopController> animating_wallpaper_controller_;
3053551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  scoped_ptr<views::corewm::ScopedCaptureClient> capture_client_;
306eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
3075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(RootWindowController);
3085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
3095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
31058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)
31158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// Gets the RootWindowController for |root_window|.
31258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)ASH_EXPORT RootWindowController* GetRootWindowController(
3131e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)    const aura::Window* root_window);
31458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)
3155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace internal
3165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // ash
3175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  //  ASH_ROOT_WINDOW_CONTROLLER_H_
319