| 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_SHELL_H_ | 5 #ifndef ASH_SHELL_H_ |
| 6 #define ASH_SHELL_H_ | 6 #define ASH_SHELL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "ash/ash_export.h" | 12 #include "ash/ash_export.h" |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 18 #include "ui/gfx/size.h" | 18 #include "ui/gfx/size.h" |
| 19 #include "ui/gfx/insets.h" | 19 #include "ui/gfx/insets.h" |
| 20 | 20 |
| 21 class CommandLine; | 21 class CommandLine; |
| 22 class SkBitmap; |
| 22 | 23 |
| 23 namespace aura { | 24 namespace aura { |
| 24 class EventFilter; | 25 class EventFilter; |
| 25 class RootWindow; | 26 class RootWindow; |
| 26 class Window; | 27 class Window; |
| 27 } | 28 } |
| 28 namespace gfx { | 29 namespace gfx { |
| 29 class Point; | 30 class Point; |
| 30 class Rect; | 31 class Rect; |
| 31 } | 32 } |
| 32 namespace ui { | 33 namespace ui { |
| 33 class Layer; | 34 class Layer; |
| 34 } | 35 } |
| 35 namespace views { | 36 namespace views { |
| 36 class NonClientFrameView; | 37 class NonClientFrameView; |
| 37 class Widget; | 38 class Widget; |
| 38 } | 39 } |
| 39 | 40 |
| 40 namespace ash { | 41 namespace ash { |
| 41 | 42 |
| 42 class AcceleratorController; | 43 class AcceleratorController; |
| 43 class AudioController; | 44 class AudioController; |
| 44 class BrightnessController; | 45 class BrightnessController; |
| 46 class DesktopBackgroundController; |
| 45 class Launcher; | 47 class Launcher; |
| 46 class NestedDispatcherController; | 48 class NestedDispatcherController; |
| 47 class NetworkController; | 49 class NetworkController; |
| 48 class PowerButtonController; | 50 class PowerButtonController; |
| 49 class PowerStatusController; | 51 class PowerStatusController; |
| 50 class ScreenAsh; | 52 class ScreenAsh; |
| 51 class ShellDelegate; | 53 class ShellDelegate; |
| 52 class ShellObserver; | 54 class ShellObserver; |
| 53 class SystemTrayDelegate; | 55 class SystemTrayDelegate; |
| 54 class SystemTray; | 56 class SystemTray; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 74 class WorkspaceController; | 76 class WorkspaceController; |
| 75 } | 77 } |
| 76 | 78 |
| 77 // Shell is a singleton object that presents the Shell API and implements the | 79 // Shell is a singleton object that presents the Shell API and implements the |
| 78 // RootWindow's delegate interface. | 80 // RootWindow's delegate interface. |
| 79 // | 81 // |
| 80 // Upon creation, the Shell sets itself as the RootWindow's delegate, which | 82 // Upon creation, the Shell sets itself as the RootWindow's delegate, which |
| 81 // takes ownership of the Shell. | 83 // takes ownership of the Shell. |
| 82 class ASH_EXPORT Shell { | 84 class ASH_EXPORT Shell { |
| 83 public: | 85 public: |
| 84 enum BackgroundMode { | |
| 85 BACKGROUND_IMAGE, | |
| 86 BACKGROUND_SOLID_COLOR | |
| 87 }; | |
| 88 | |
| 89 enum Direction { | 86 enum Direction { |
| 90 FORWARD, | 87 FORWARD, |
| 91 BACKWARD | 88 BACKWARD |
| 92 }; | 89 }; |
| 93 | 90 |
| 94 // Accesses private data from a Shell for testing. | 91 // Accesses private data from a Shell for testing. |
| 95 class ASH_EXPORT TestApi { | 92 class ASH_EXPORT TestApi { |
| 96 public: | 93 public: |
| 97 explicit TestApi(Shell* shell); | 94 explicit TestApi(Shell* shell); |
| 98 | 95 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 114 static Shell* GetInstance(); | 111 static Shell* GetInstance(); |
| 115 | 112 |
| 116 // Returns true if the ash shell has been instantiated. | 113 // Returns true if the ash shell has been instantiated. |
| 117 static bool HasInstance(); | 114 static bool HasInstance(); |
| 118 | 115 |
| 119 static void DeleteInstance(); | 116 static void DeleteInstance(); |
| 120 | 117 |
| 121 // Get the singleton RootWindow used by the Shell. | 118 // Get the singleton RootWindow used by the Shell. |
| 122 static aura::RootWindow* GetRootWindow(); | 119 static aura::RootWindow* GetRootWindow(); |
| 123 | 120 |
| 124 BackgroundMode desktop_background_mode() const { | 121 internal::RootWindowLayoutManager* root_window_layout() const { |
| 125 return desktop_background_mode_; | 122 return root_window_layout_; |
| 126 } | 123 } |
| 127 | 124 |
| 128 aura::Window* GetContainer(int container_id); | 125 aura::Window* GetContainer(int container_id); |
| 129 const aura::Window* GetContainer(int container_id) const; | 126 const aura::Window* GetContainer(int container_id) const; |
| 130 | 127 |
| 131 // Adds or removes |filter| from the RootWindowEventFilter. | 128 // Adds or removes |filter| from the RootWindowEventFilter. |
| 132 void AddRootWindowEventFilter(aura::EventFilter* filter); | 129 void AddRootWindowEventFilter(aura::EventFilter* filter); |
| 133 void RemoveRootWindowEventFilter(aura::EventFilter* filter); | 130 void RemoveRootWindowEventFilter(aura::EventFilter* filter); |
| 134 size_t GetRootWindowEventFilterCount() const; | 131 size_t GetRootWindowEventFilterCount() const; |
| 135 | 132 |
| 136 // Shows the background menu over |widget|. | 133 // Shows the background menu over |widget|. |
| 137 void ShowBackgroundMenu(views::Widget* widget, const gfx::Point& location); | 134 void ShowBackgroundMenu(views::Widget* widget, const gfx::Point& location); |
| 138 | 135 |
| 139 // Toggles app list. | 136 // Toggles app list. |
| 140 void ToggleAppList(); | 137 void ToggleAppList(); |
| 141 | 138 |
| 142 // Sets the desktop background mode. | |
| 143 void SetDesktopBackgroundMode(BackgroundMode mode); | |
| 144 | |
| 145 // Returns true if the screen is locked. | 139 // Returns true if the screen is locked. |
| 146 bool IsScreenLocked() const; | 140 bool IsScreenLocked() const; |
| 147 | 141 |
| 148 // Returns true if a modal dialog window is currently open. | 142 // Returns true if a modal dialog window is currently open. |
| 149 bool IsModalWindowOpen() const; | 143 bool IsModalWindowOpen() const; |
| 150 | 144 |
| 151 // Creates a default views::NonClientFrameView for use by windows in the | 145 // Creates a default views::NonClientFrameView for use by windows in the |
| 152 // Ash environment. | 146 // Ash environment. |
| 153 views::NonClientFrameView* CreateDefaultNonClientFrameView( | 147 views::NonClientFrameView* CreateDefaultNonClientFrameView( |
| 154 views::Widget* widget); | 148 views::Widget* widget); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 171 | 165 |
| 172 internal::RootWindowEventFilter* root_filter() { | 166 internal::RootWindowEventFilter* root_filter() { |
| 173 return root_filter_; | 167 return root_filter_; |
| 174 } | 168 } |
| 175 internal::TooltipController* tooltip_controller() { | 169 internal::TooltipController* tooltip_controller() { |
| 176 return tooltip_controller_.get(); | 170 return tooltip_controller_.get(); |
| 177 } | 171 } |
| 178 internal::PartialScreenshotEventFilter* partial_screenshot_filter() { | 172 internal::PartialScreenshotEventFilter* partial_screenshot_filter() { |
| 179 return partial_screenshot_filter_.get(); | 173 return partial_screenshot_filter_.get(); |
| 180 } | 174 } |
| 175 DesktopBackgroundController* desktop_background_controller() { |
| 176 return desktop_background_controller_.get(); |
| 177 } |
| 181 PowerButtonController* power_button_controller() { | 178 PowerButtonController* power_button_controller() { |
| 182 return power_button_controller_.get(); | 179 return power_button_controller_.get(); |
| 183 } | 180 } |
| 184 VideoDetector* video_detector() { | 181 VideoDetector* video_detector() { |
| 185 return video_detector_.get(); | 182 return video_detector_.get(); |
| 186 } | 183 } |
| 187 WindowCycleController* window_cycle_controller() { | 184 WindowCycleController* window_cycle_controller() { |
| 188 return window_cycle_controller_.get(); | 185 return window_cycle_controller_.get(); |
| 189 } | 186 } |
| 190 internal::FocusCycler* focus_cycler() { | 187 internal::FocusCycler* focus_cycler() { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 scoped_ptr<internal::AppList> app_list_; | 264 scoped_ptr<internal::AppList> app_list_; |
| 268 | 265 |
| 269 scoped_ptr<internal::StackingController> stacking_controller_; | 266 scoped_ptr<internal::StackingController> stacking_controller_; |
| 270 scoped_ptr<internal::ActivationController> activation_controller_; | 267 scoped_ptr<internal::ActivationController> activation_controller_; |
| 271 scoped_ptr<internal::WindowModalityController> window_modality_controller_; | 268 scoped_ptr<internal::WindowModalityController> window_modality_controller_; |
| 272 scoped_ptr<internal::DragDropController> drag_drop_controller_; | 269 scoped_ptr<internal::DragDropController> drag_drop_controller_; |
| 273 scoped_ptr<internal::WorkspaceController> workspace_controller_; | 270 scoped_ptr<internal::WorkspaceController> workspace_controller_; |
| 274 scoped_ptr<internal::ShadowController> shadow_controller_; | 271 scoped_ptr<internal::ShadowController> shadow_controller_; |
| 275 scoped_ptr<internal::TooltipController> tooltip_controller_; | 272 scoped_ptr<internal::TooltipController> tooltip_controller_; |
| 276 scoped_ptr<internal::VisibilityController> visibility_controller_; | 273 scoped_ptr<internal::VisibilityController> visibility_controller_; |
| 274 scoped_ptr<DesktopBackgroundController> desktop_background_controller_; |
| 277 scoped_ptr<PowerButtonController> power_button_controller_; | 275 scoped_ptr<PowerButtonController> power_button_controller_; |
| 278 scoped_ptr<VideoDetector> video_detector_; | 276 scoped_ptr<VideoDetector> video_detector_; |
| 279 scoped_ptr<WindowCycleController> window_cycle_controller_; | 277 scoped_ptr<WindowCycleController> window_cycle_controller_; |
| 280 scoped_ptr<internal::FocusCycler> focus_cycler_; | 278 scoped_ptr<internal::FocusCycler> focus_cycler_; |
| 281 | 279 |
| 282 // These controllers are not owned by the shell. | 280 // These controllers are not owned by the shell. |
| 283 AudioController* audio_controller_; | 281 AudioController* audio_controller_; |
| 284 BrightnessController* brightness_controller_; | 282 BrightnessController* brightness_controller_; |
| 285 NetworkController* network_controller_; | 283 NetworkController* network_controller_; |
| 286 PowerStatusController* power_status_controller_; | 284 PowerStatusController* power_status_controller_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 297 scoped_ptr<internal::AcceleratorFilter> accelerator_filter_; | 295 scoped_ptr<internal::AcceleratorFilter> accelerator_filter_; |
| 298 #endif | 296 #endif |
| 299 | 297 |
| 300 // The shelf for managing the launcher and the status widget in non-compact | 298 // The shelf for managing the launcher and the status widget in non-compact |
| 301 // mode. Shell does not own the shelf. Instead, it is owned by container of | 299 // mode. Shell does not own the shelf. Instead, it is owned by container of |
| 302 // the status area. | 300 // the status area. |
| 303 internal::ShelfLayoutManager* shelf_; | 301 internal::ShelfLayoutManager* shelf_; |
| 304 | 302 |
| 305 ObserverList<ShellObserver> observers_; | 303 ObserverList<ShellObserver> observers_; |
| 306 | 304 |
| 307 // Can change at runtime. | |
| 308 BackgroundMode desktop_background_mode_; | |
| 309 | |
| 310 // Owned by aura::RootWindow, cached here for type safety. | 305 // Owned by aura::RootWindow, cached here for type safety. |
| 311 internal::RootWindowLayoutManager* root_window_layout_; | 306 internal::RootWindowLayoutManager* root_window_layout_; |
| 312 | 307 |
| 313 // Status area with clock, Wi-Fi signal, etc. | 308 // Status area with clock, Wi-Fi signal, etc. |
| 314 views::Widget* status_widget_; | 309 views::Widget* status_widget_; |
| 315 | 310 |
| 316 // System tray with clock, Wi-Fi signal, etc. (a replacement in progress for | 311 // System tray with clock, Wi-Fi signal, etc. (a replacement in progress for |
| 317 // |status_widget_|). | 312 // |status_widget_|). |
| 318 scoped_ptr<SystemTray> tray_; | 313 scoped_ptr<SystemTray> tray_; |
| 319 | 314 |
| 320 DISALLOW_COPY_AND_ASSIGN(Shell); | 315 DISALLOW_COPY_AND_ASSIGN(Shell); |
| 321 }; | 316 }; |
| 322 | 317 |
| 323 } // namespace ash | 318 } // namespace ash |
| 324 | 319 |
| 325 #endif // ASH_SHELL_H_ | 320 #endif // ASH_SHELL_H_ |
| OLD | NEW |