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