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