blob: e8f623d0d7e4d1bfa53200eeb735e8664776ce07 [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
[email protected]c0ce80e2012-10-05 23:28:278#include "ash/ash_export.h"
[email protected]d90b8392012-06-13 09:34:569#include "base/basictypes.h"
10#include "base/memory/scoped_ptr.h"
11
12class SkBitmap;
13
14namespace aura {
15class EventFilter;
16class RootWindow;
17class Window;
18namespace shared {
19class InputMethodEventFilter;
20class RootWindowEventFilter;
21} // namespace shared
22} // namespace aura
23
24namespace ash {
[email protected]a4cd6d32012-09-12 03:42:1325class ToplevelWindowEventHandler;
[email protected]d90b8392012-06-13 09:34:5626namespace internal {
27
28class EventClientImpl;
29class RootWindowLayoutManager;
30class ScreenDimmer;
[email protected]697f04c2012-10-03 01:15:1031class SystemBackgroundController;
[email protected]c0ce80e2012-10-05 23:28:2732class SystemModalContainerLayoutManager;
[email protected]d90b8392012-06-13 09:34:5633class 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]c0ce80e2012-10-05 23:28:2740class ASH_EXPORT RootWindowController {
[email protected]d90b8392012-06-13 09:34:5641 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]c0ce80e2012-10-05 23:28:2749 RootWindowLayoutManager* root_window_layout() {
[email protected]d90b8392012-06-13 09:34:5650 return root_window_layout_;
51 }
52
[email protected]c0ce80e2012-10-05 23:28:2753 WorkspaceController* workspace_controller() {
[email protected]d90b8392012-06-13 09:34:5654 return workspace_controller_.get();
55 }
56
[email protected]c0ce80e2012-10-05 23:28:2757 ScreenDimmer* screen_dimmer() {
[email protected]d90b8392012-06-13 09:34:5658 return screen_dimmer_.get();
59 }
60
[email protected]c0ce80e2012-10-05 23:28:2761 SystemModalContainerLayoutManager* GetSystemModalLayoutManager();
62
[email protected]d90b8392012-06-13 09:34:5663 aura::Window* GetContainer(int container_id);
64
[email protected]d90b8392012-06-13 09:34:5665 void InitLayoutManagers();
[email protected]697f04c2012-10-03 01:15:1066 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]d90b8392012-06-13 09:34:5674
[email protected]6675e1c2012-09-11 09:15:4575 // 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]d90b8392012-06-13 09:34:5681 // 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]f1853122012-06-27 16:21:2687 // Moves child windows to |dest|.
88 void MoveWindowsTo(aura::RootWindow* dest);
89
[email protected]d90b8392012-06-13 09:34:5690 private:
[email protected]a4cd6d32012-09-12 03:42:1391 // 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]d90b8392012-06-13 09:34:5695 scoped_ptr<aura::RootWindow> root_window_;
[email protected]c0ce80e2012-10-05 23:28:2796 RootWindowLayoutManager* root_window_layout_;
[email protected]d90b8392012-06-13 09:34:5697
[email protected]697f04c2012-10-03 01:15:1098 // 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]d90b8392012-06-13 09:34:56104 // An event filter that pre-handles all key events to send them to an IME.
[email protected]c0ce80e2012-10-05 23:28:27105 scoped_ptr<EventClientImpl> event_client_;
106 scoped_ptr<ScreenDimmer> screen_dimmer_;
107 scoped_ptr<WorkspaceController> workspace_controller_;
[email protected]d90b8392012-06-13 09:34:56108
[email protected]a4cd6d32012-09-12 03:42:13109 // 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]d90b8392012-06-13 09:34:56115 DISALLOW_COPY_AND_ASSIGN(RootWindowController);
116};
117
118} // namespace internal
119} // ash
120
121#endif // ASH_ROOT_WINDOW_CONTROLLER_H_