blob: 29f9c04b97bd8c3b615f812fcdbd3e202a66929d [file] [log] [blame]
[email protected]d90b8392012-06-13 09:34:561// 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]d90b8392012-06-13 09:34:567
8#include "base/basictypes.h"
9#include "base/memory/scoped_ptr.h"
10
11class SkBitmap;
12
13namespace aura {
14class EventFilter;
15class RootWindow;
16class Window;
17namespace shared {
18class InputMethodEventFilter;
19class RootWindowEventFilter;
20} // namespace shared
21} // namespace aura
22
23namespace ash {
[email protected]a4cd6d32012-09-12 03:42:1324class ToplevelWindowEventHandler;
[email protected]d90b8392012-06-13 09:34:5625namespace internal {
26
27class EventClientImpl;
28class RootWindowLayoutManager;
29class ScreenDimmer;
[email protected]697f04c2012-10-03 01:15:1030class SystemBackgroundController;
[email protected]d90b8392012-06-13 09:34:5631class 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.
38class 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]d90b8392012-06-13 09:34:5661 void InitLayoutManagers();
[email protected]697f04c2012-10-03 01:15:1062 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]d90b8392012-06-13 09:34:5670
[email protected]6675e1c2012-09-11 09:15:4571 // 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]d90b8392012-06-13 09:34:5677 // 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]f1853122012-06-27 16:21:2683 // Moves child windows to |dest|.
84 void MoveWindowsTo(aura::RootWindow* dest);
85
[email protected]d90b8392012-06-13 09:34:5686 private:
[email protected]a4cd6d32012-09-12 03:42:1387 // 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]d90b8392012-06-13 09:34:5691 scoped_ptr<aura::RootWindow> root_window_;
92 internal::RootWindowLayoutManager* root_window_layout_;
93
[email protected]697f04c2012-10-03 01:15:1094 // 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]d90b8392012-06-13 09:34:56100 // 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]a4cd6d32012-09-12 03:42:13105 // 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]d90b8392012-06-13 09:34:56111 DISALLOW_COPY_AND_ASSIGN(RootWindowController);
112};
113
114} // namespace internal
115} // ash
116
117#endif // ASH_ROOT_WINDOW_CONTROLLER_H_