| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_ROOT_WINDOW_CONTROLLER_H_ | 5 #ifndef ASH_ROOT_WINDOW_CONTROLLER_H_ |
| 6 #define ASH_ROOT_WINDOW_CONTROLLER_H_ | 6 #define ASH_ROOT_WINDOW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/wm/shelf_types.h" |
| 9 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 11 | 12 |
| 12 class SkBitmap; | 13 class SkBitmap; |
| 13 | 14 |
| 14 namespace aura { | 15 namespace aura { |
| 15 class EventFilter; | 16 class EventFilter; |
| 16 class RootWindow; | 17 class RootWindow; |
| 17 class Window; | 18 class Window; |
| 18 namespace shared { | 19 namespace shared { |
| 19 class InputMethodEventFilter; | 20 class InputMethodEventFilter; |
| 20 class RootWindowEventFilter; | 21 class RootWindowEventFilter; |
| 21 } // namespace shared | 22 } // namespace shared |
| 22 } // namespace aura | 23 } // namespace aura |
| 23 | 24 |
| 24 namespace ash { | 25 namespace ash { |
| 26 class Launcher; |
| 25 class ToplevelWindowEventHandler; | 27 class ToplevelWindowEventHandler; |
| 28 |
| 26 namespace internal { | 29 namespace internal { |
| 27 | 30 |
| 28 class ColoredWindowController; | 31 class ColoredWindowController; |
| 32 class PanelLayoutManager; |
| 29 class RootWindowLayoutManager; | 33 class RootWindowLayoutManager; |
| 30 class ScreenDimmer; | 34 class ScreenDimmer; |
| 35 class ShelfLayoutManager; |
| 36 class StatusAreaWidget; |
| 37 class SystemBackgroundController; |
| 31 class SystemModalContainerLayoutManager; | 38 class SystemModalContainerLayoutManager; |
| 32 class WorkspaceController; | 39 class WorkspaceController; |
| 33 | 40 |
| 34 // This class maintains the per root window state for ash. This class | 41 // This class maintains the per root window state for ash. This class |
| 35 // owns the root window and other dependent objects that should be | 42 // owns the root window and other dependent objects that should be |
| 36 // deleted upon the deletion of the root window. The RootWindowController | 43 // deleted upon the deletion of the root window. The RootWindowController |
| 37 // for particular root window is stored as a property and can be obtained | 44 // for particular root window is stored as a property and can be obtained |
| 38 // using |GetRootWindowController(aura::RootWindow*)| function. | 45 // using |GetRootWindowController(aura::RootWindow*)| function. |
| 39 class ASH_EXPORT RootWindowController { | 46 class ASH_EXPORT RootWindowController { |
| 40 public: | 47 public: |
| 41 explicit RootWindowController(aura::RootWindow* root_window); | 48 explicit RootWindowController(aura::RootWindow* root_window); |
| 42 ~RootWindowController(); | 49 ~RootWindowController(); |
| 43 | 50 |
| 44 aura::RootWindow* root_window() { | 51 aura::RootWindow* root_window() { return root_window_.get(); } |
| 45 return root_window_.get(); | |
| 46 } | |
| 47 | 52 |
| 48 RootWindowLayoutManager* root_window_layout() { | 53 RootWindowLayoutManager* root_window_layout() { return root_window_layout_; } |
| 49 return root_window_layout_; | |
| 50 } | |
| 51 | 54 |
| 52 WorkspaceController* workspace_controller() { | 55 WorkspaceController* workspace_controller() { |
| 53 return workspace_controller_.get(); | 56 return workspace_controller_.get(); |
| 54 } | 57 } |
| 55 | 58 |
| 56 ScreenDimmer* screen_dimmer() { | 59 ScreenDimmer* screen_dimmer() { return screen_dimmer_.get(); } |
| 57 return screen_dimmer_.get(); | 60 |
| 61 Launcher* launcher() { return launcher_.get(); } |
| 62 |
| 63 // TODO(sky): don't expose this! |
| 64 internal::ShelfLayoutManager* shelf() const { return shelf_; } |
| 65 |
| 66 internal::StatusAreaWidget* status_area_widget() const { |
| 67 return status_area_widget_; |
| 58 } | 68 } |
| 59 | 69 |
| 60 SystemModalContainerLayoutManager* GetSystemModalLayoutManager(); | 70 SystemModalContainerLayoutManager* GetSystemModalLayoutManager(); |
| 61 | 71 |
| 62 aura::Window* GetContainer(int container_id); | 72 aura::Window* GetContainer(int container_id); |
| 63 | 73 |
| 64 void InitLayoutManagers(); | 74 void InitLayoutManagers(); |
| 65 void CreateContainers(); | 75 void CreateContainers(); |
| 66 | 76 |
| 77 // Initializs the RootWindowController for primary display. This |
| 78 // creates |
| 79 void InitForPrimaryDisplay(); |
| 80 |
| 67 // Initializes |background_|. |is_first_run_after_boot| determines the | 81 // Initializes |background_|. |is_first_run_after_boot| determines the |
| 68 // background's initial color. | 82 // background's initial color. |
| 69 void CreateSystemBackground(bool is_first_run_after_boot); | 83 void CreateSystemBackground(bool is_first_run_after_boot); |
| 70 | 84 |
| 85 // Initializes |launcher_|. Does nothing if it's already initialized. |
| 86 void CreateLauncher(); |
| 87 |
| 88 // Show launcher view if it was created hidden (before session has started). |
| 89 void ShowLauncher(); |
| 90 |
| 71 // Updates |background_| to be black after the desktop background is visible. | 91 // Updates |background_| to be black after the desktop background is visible. |
| 72 void HandleDesktopBackgroundVisible(); | 92 void HandleDesktopBackgroundVisible(); |
| 73 | 93 |
| 74 // Deletes associated objects and clears the state, but doesn't delete | 94 // Deletes associated objects and clears the state, but doesn't delete |
| 75 // the root window yet. This is used to delete a secondary displays' | 95 // the root window yet. This is used to delete a secondary displays' |
| 76 // root window safely when the display disconnect signal is received, | 96 // root window safely when the display disconnect signal is received, |
| 77 // which may come while we're in the nested message loop. | 97 // which may come while we're in the nested message loop. |
| 78 void Shutdown(); | 98 void Shutdown(); |
| 79 | 99 |
| 80 // Deletes all child windows and performs necessary cleanup. | 100 // Deletes all child windows and performs necessary cleanup. |
| 81 void CloseChildWindows(); | 101 void CloseChildWindows(); |
| 82 | 102 |
| 83 // Returns true if the workspace has a maximized or fullscreen window. | 103 // Returns true if the workspace has a maximized or fullscreen window. |
| 84 bool IsInMaximizedMode() const; | 104 bool IsInMaximizedMode() const; |
| 85 | 105 |
| 86 // Moves child windows to |dest|. | 106 // Moves child windows to |dest|. |
| 87 void MoveWindowsTo(aura::RootWindow* dest); | 107 void MoveWindowsTo(aura::RootWindow* dest); |
| 88 | 108 |
| 89 private: | 109 // Force the shelf to query for it's current visibility state. |
| 110 void UpdateShelfVisibility(); |
| 111 |
| 112 // Sets/gets the shelf auto-hide behavior. |
| 113 void SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior); |
| 114 ShelfAutoHideBehavior GetShelfAutoHideBehavior() const; |
| 115 |
| 116 // Sets/gets the shelf alignemnt. |
| 117 bool SetShelfAlignment(ShelfAlignment alignment); |
| 118 ShelfAlignment GetShelfAlignment(); |
| 119 |
| 120 private: |
| 90 // Creates each of the special window containers that holds windows of various | 121 // Creates each of the special window containers that holds windows of various |
| 91 // types in the shell UI. | 122 // types in the shell UI. |
| 92 void CreateContainersInRootWindow(aura::RootWindow* root_window); | 123 void CreateContainersInRootWindow(aura::RootWindow* root_window); |
| 93 | 124 |
| 94 scoped_ptr<aura::RootWindow> root_window_; | 125 scoped_ptr<aura::RootWindow> root_window_; |
| 95 RootWindowLayoutManager* root_window_layout_; | 126 RootWindowLayoutManager* root_window_layout_; |
| 96 | 127 |
| 128 // Widget containing system tray. |
| 129 internal::StatusAreaWidget* status_area_widget_; |
| 130 |
| 131 // The shelf for managing the launcher and the status widget. |
| 132 // RootWindowController does not own the shelf. Instead, it is owned |
| 133 // by container of the status area. |
| 134 internal::ShelfLayoutManager* shelf_; |
| 135 |
| 136 // Manages layout of panels. Owned by PanelContainer. |
| 137 internal::PanelLayoutManager* panel_layout_manager_; |
| 138 |
| 139 scoped_ptr<Launcher> launcher_; |
| 140 |
| 97 // A background layer that's displayed beneath all other layers. Without | 141 // A background layer that's displayed beneath all other layers. Without |
| 98 // this, portions of the root window that aren't covered by layers will be | 142 // this, portions of the root window that aren't covered by layers will be |
| 99 // painted white; this can show up if e.g. it takes a long time to decode the | 143 // painted white; this can show up if e.g. it takes a long time to decode the |
| 100 // desktop background image when displaying the login screen. | 144 // desktop background image when displaying the login screen. |
| 101 scoped_ptr<ColoredWindowController> background_; | 145 scoped_ptr<ColoredWindowController> background_; |
| 102 | 146 |
| 103 scoped_ptr<ScreenDimmer> screen_dimmer_; | 147 scoped_ptr<ScreenDimmer> screen_dimmer_; |
| 104 scoped_ptr<WorkspaceController> workspace_controller_; | 148 scoped_ptr<WorkspaceController> workspace_controller_; |
| 105 | 149 |
| 106 // We need to own event handlers for various containers. | 150 // We need to own event handlers for various containers. |
| 107 scoped_ptr<ToplevelWindowEventHandler> default_container_handler_; | 151 scoped_ptr<ToplevelWindowEventHandler> default_container_handler_; |
| 108 scoped_ptr<ToplevelWindowEventHandler> always_on_top_container_handler_; | 152 scoped_ptr<ToplevelWindowEventHandler> always_on_top_container_handler_; |
| 109 scoped_ptr<ToplevelWindowEventHandler> modal_container_handler_; | 153 scoped_ptr<ToplevelWindowEventHandler> modal_container_handler_; |
| 110 scoped_ptr<ToplevelWindowEventHandler> lock_modal_container_handler_; | 154 scoped_ptr<ToplevelWindowEventHandler> lock_modal_container_handler_; |
| 111 | 155 |
| 112 DISALLOW_COPY_AND_ASSIGN(RootWindowController); | 156 DISALLOW_COPY_AND_ASSIGN(RootWindowController); |
| 113 }; | 157 }; |
| 114 | 158 |
| 115 } // namespace internal | 159 } // namespace internal |
| 116 } // ash | 160 } // ash |
| 117 | 161 |
| 118 #endif // ASH_ROOT_WINDOW_CONTROLLER_H_ | 162 #endif // ASH_ROOT_WINDOW_CONTROLLER_H_ |
| OLD | NEW |