[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 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. |
| 4 | |
| 5 | #ifndef ASH_ROOT_WINDOW_CONTROLLER_H_ |
| 6 | #define ASH_ROOT_WINDOW_CONTROLLER_H_ |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 7 | |
| 8 | #include "base/basictypes.h" |
| 9 | #include "base/memory/scoped_ptr.h" |
| 10 | |
| 11 | class SkBitmap; |
| 12 | |
| 13 | namespace aura { |
| 14 | class EventFilter; |
| 15 | class RootWindow; |
| 16 | class Window; |
| 17 | namespace shared { |
| 18 | class InputMethodEventFilter; |
| 19 | class RootWindowEventFilter; |
| 20 | } // namespace shared |
| 21 | } // namespace aura |
| 22 | |
| 23 | namespace ash { |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 24 | class ToplevelWindowEventHandler; |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 25 | namespace internal { |
| 26 | |
| 27 | class EventClientImpl; |
| 28 | class RootWindowLayoutManager; |
| 29 | class ScreenDimmer; |
[email protected] | 697f04c | 2012-10-03 01:15:10 | [diff] [blame] | 30 | class SystemBackgroundController; |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 31 | class WorkspaceController; |
| 32 | |
| 33 | // This class maintains the per root window state for ash. This class |
| 34 | // owns the root window and other dependent objects that should be |
| 35 | // deleted upon the deletion of the root window. The RootWindowController |
| 36 | // for particular root window is stored as a property and can be obtained |
| 37 | // using |GetRootWindowController(aura::RootWindow*)| function. |
| 38 | class RootWindowController { |
| 39 | public: |
| 40 | explicit RootWindowController(aura::RootWindow* root_window); |
| 41 | ~RootWindowController(); |
| 42 | |
| 43 | aura::RootWindow* root_window() { |
| 44 | return root_window_.get(); |
| 45 | } |
| 46 | |
| 47 | internal::RootWindowLayoutManager* root_window_layout() { |
| 48 | return root_window_layout_; |
| 49 | } |
| 50 | |
| 51 | internal::WorkspaceController* workspace_controller() { |
| 52 | return workspace_controller_.get(); |
| 53 | } |
| 54 | |
| 55 | internal::ScreenDimmer* screen_dimmer() { |
| 56 | return screen_dimmer_.get(); |
| 57 | } |
| 58 | |
| 59 | aura::Window* GetContainer(int container_id); |
| 60 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 61 | void InitLayoutManagers(); |
[email protected] | 697f04c | 2012-10-03 01:15:10 | [diff] [blame] | 62 | void CreateContainers(); |
| 63 | |
| 64 | // Initializes |background_|. |is_first_run_after_boot| determines the |
| 65 | // background's initial color. |
| 66 | void CreateSystemBackground(bool is_first_run_after_boot); |
| 67 | |
| 68 | // Updates |background_| to be black after the desktop background is visible. |
| 69 | void HandleDesktopBackgroundVisible(); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 70 | |
[email protected] | 6675e1c | 2012-09-11 09:15:45 | [diff] [blame] | 71 | // Deletes associated objects and clears the state, but doesn't delete |
| 72 | // the root window yet. This is used to delete a secondary displays' |
| 73 | // root window safely when the display disconnect signal is received, |
| 74 | // which may come while we're in the nested message loop. |
| 75 | void Shutdown(); |
| 76 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 77 | // Deletes all child windows and performs necessary cleanup. |
| 78 | void CloseChildWindows(); |
| 79 | |
| 80 | // Returns true if the workspace has a maximized or fullscreen window. |
| 81 | bool IsInMaximizedMode() const; |
| 82 | |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 83 | // Moves child windows to |dest|. |
| 84 | void MoveWindowsTo(aura::RootWindow* dest); |
| 85 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 86 | private: |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 87 | // Creates each of the special window containers that holds windows of various |
| 88 | // types in the shell UI. |
| 89 | void CreateContainersInRootWindow(aura::RootWindow* root_window); |
| 90 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 91 | scoped_ptr<aura::RootWindow> root_window_; |
| 92 | internal::RootWindowLayoutManager* root_window_layout_; |
| 93 | |
[email protected] | 697f04c | 2012-10-03 01:15:10 | [diff] [blame] | 94 | // A background layer that's displayed beneath all other layers. Without |
| 95 | // this, portions of the root window that aren't covered by layers will be |
| 96 | // painted white; this can show up if e.g. it takes a long time to decode the |
| 97 | // desktop background image when displaying the login screen. |
| 98 | scoped_ptr<SystemBackgroundController> background_; |
| 99 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 100 | // An event filter that pre-handles all key events to send them to an IME. |
| 101 | scoped_ptr<internal::EventClientImpl> event_client_; |
| 102 | scoped_ptr<internal::ScreenDimmer> screen_dimmer_; |
| 103 | scoped_ptr<internal::WorkspaceController> workspace_controller_; |
| 104 | |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 105 | // We need to own event handlers for various containers. |
| 106 | scoped_ptr<ToplevelWindowEventHandler> default_container_handler_; |
| 107 | scoped_ptr<ToplevelWindowEventHandler> always_on_top_container_handler_; |
| 108 | scoped_ptr<ToplevelWindowEventHandler> modal_container_handler_; |
| 109 | scoped_ptr<ToplevelWindowEventHandler> lock_modal_container_handler_; |
| 110 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 111 | DISALLOW_COPY_AND_ASSIGN(RootWindowController); |
| 112 | }; |
| 113 | |
| 114 | } // namespace internal |
| 115 | } // ash |
| 116 | |
| 117 | #endif // ASH_ROOT_WINDOW_CONTROLLER_H_ |