| 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 "ui/gfx/size.h" | 17 #include "ui/gfx/size.h" |
| 18 | 18 |
| 19 class CommandLine; | 19 class CommandLine; |
| 20 class SkBitmap; |
| 20 | 21 |
| 21 namespace aura { | 22 namespace aura { |
| 22 class EventFilter; | 23 class EventFilter; |
| 23 class RootWindow; | 24 class RootWindow; |
| 24 class Window; | 25 class Window; |
| 25 } | 26 } |
| 26 namespace gfx { | 27 namespace gfx { |
| 27 class Point; | 28 class Point; |
| 28 class Rect; | 29 class Rect; |
| 29 } | 30 } |
| 30 namespace ui { | 31 namespace ui { |
| 31 class Layer; | 32 class Layer; |
| 32 } | 33 } |
| 33 namespace views { | 34 namespace views { |
| 34 class NonClientFrameView; | 35 class NonClientFrameView; |
| 35 class Widget; | 36 class Widget; |
| 36 } | 37 } |
| 37 | 38 |
| 38 namespace ash { | 39 namespace ash { |
| 39 | 40 |
| 40 class AcceleratorController; | 41 class AcceleratorController; |
| 41 class AudioController; | 42 class AudioController; |
| 42 class BrightnessController; | 43 class BrightnessController; |
| 44 class DesktopBackgroundController; |
| 43 class Launcher; | 45 class Launcher; |
| 44 class NestedDispatcherController; | 46 class NestedDispatcherController; |
| 45 class PowerButtonController; | 47 class PowerButtonController; |
| 46 class PowerStatusController; | 48 class PowerStatusController; |
| 47 class ShellDelegate; | 49 class ShellDelegate; |
| 48 class SystemTrayDelegate; | 50 class SystemTrayDelegate; |
| 49 class SystemTray; | 51 class SystemTray; |
| 50 class VideoDetector; | 52 class VideoDetector; |
| 51 class WindowCycleController; | 53 class WindowCycleController; |
| 52 | 54 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 69 class WorkspaceController; | 71 class WorkspaceController; |
| 70 } | 72 } |
| 71 | 73 |
| 72 // Shell is a singleton object that presents the Shell API and implements the | 74 // Shell is a singleton object that presents the Shell API and implements the |
| 73 // RootWindow's delegate interface. | 75 // RootWindow's delegate interface. |
| 74 // | 76 // |
| 75 // Upon creation, the Shell sets itself as the RootWindow's delegate, which | 77 // Upon creation, the Shell sets itself as the RootWindow's delegate, which |
| 76 // takes ownership of the Shell. | 78 // takes ownership of the Shell. |
| 77 class ASH_EXPORT Shell { | 79 class ASH_EXPORT Shell { |
| 78 public: | 80 public: |
| 79 enum BackgroundMode { | |
| 80 BACKGROUND_IMAGE, | |
| 81 BACKGROUND_SOLID_COLOR | |
| 82 }; | |
| 83 | |
| 84 enum Direction { | 81 enum Direction { |
| 85 FORWARD, | 82 FORWARD, |
| 86 BACKWARD | 83 BACKWARD |
| 87 }; | 84 }; |
| 88 | 85 |
| 89 // Accesses private data from a Shell for testing. | 86 // Accesses private data from a Shell for testing. |
| 90 class ASH_EXPORT TestApi { | 87 class ASH_EXPORT TestApi { |
| 91 public: | 88 public: |
| 92 explicit TestApi(Shell* shell); | 89 explicit TestApi(Shell* shell); |
| 93 | 90 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 109 static Shell* GetInstance(); | 106 static Shell* GetInstance(); |
| 110 | 107 |
| 111 // Returns true if the ash shell has been instantiated. | 108 // Returns true if the ash shell has been instantiated. |
| 112 static bool HasInstance(); | 109 static bool HasInstance(); |
| 113 | 110 |
| 114 static void DeleteInstance(); | 111 static void DeleteInstance(); |
| 115 | 112 |
| 116 // Get the singleton RootWindow used by the Shell. | 113 // Get the singleton RootWindow used by the Shell. |
| 117 static aura::RootWindow* GetRootWindow(); | 114 static aura::RootWindow* GetRootWindow(); |
| 118 | 115 |
| 119 BackgroundMode desktop_background_mode() const { | 116 internal::RootWindowLayoutManager* root_window_layout() const { |
| 120 return desktop_background_mode_; | 117 return root_window_layout_; |
| 121 } | 118 } |
| 122 | 119 |
| 123 aura::Window* GetContainer(int container_id); | 120 aura::Window* GetContainer(int container_id); |
| 124 const aura::Window* GetContainer(int container_id) const; | 121 const aura::Window* GetContainer(int container_id) const; |
| 125 | 122 |
| 126 // Adds or removes |filter| from the RootWindowEventFilter. | 123 // Adds or removes |filter| from the RootWindowEventFilter. |
| 127 void AddRootWindowEventFilter(aura::EventFilter* filter); | 124 void AddRootWindowEventFilter(aura::EventFilter* filter); |
| 128 void RemoveRootWindowEventFilter(aura::EventFilter* filter); | 125 void RemoveRootWindowEventFilter(aura::EventFilter* filter); |
| 129 size_t GetRootWindowEventFilterCount() const; | 126 size_t GetRootWindowEventFilterCount() const; |
| 130 | 127 |
| 131 // Shows the background menu over |widget|. | 128 // Shows the background menu over |widget|. |
| 132 void ShowBackgroundMenu(views::Widget* widget, const gfx::Point& location); | 129 void ShowBackgroundMenu(views::Widget* widget, const gfx::Point& location); |
| 133 | 130 |
| 134 // Toggles app list. | 131 // Toggles app list. |
| 135 void ToggleAppList(); | 132 void ToggleAppList(); |
| 136 | 133 |
| 137 // Sets the desktop background mode. | |
| 138 void SetDesktopBackgroundMode(BackgroundMode mode); | |
| 139 | |
| 140 // Returns true if the screen is locked. | 134 // Returns true if the screen is locked. |
| 141 bool IsScreenLocked() const; | 135 bool IsScreenLocked() const; |
| 142 | 136 |
| 143 // Returns true if a modal dialog window is currently open. | 137 // Returns true if a modal dialog window is currently open. |
| 144 bool IsModalWindowOpen() const; | 138 bool IsModalWindowOpen() const; |
| 145 | 139 |
| 146 // Creates a default views::NonClientFrameView for use by windows in the | 140 // Creates a default views::NonClientFrameView for use by windows in the |
| 147 // Ash environment. | 141 // Ash environment. |
| 148 views::NonClientFrameView* CreateDefaultNonClientFrameView( | 142 views::NonClientFrameView* CreateDefaultNonClientFrameView( |
| 149 views::Widget* widget); | 143 views::Widget* widget); |
| 150 | 144 |
| 151 // Rotate focus through containers that can receive focus. | 145 // Rotate focus through containers that can receive focus. |
| 152 void RotateFocus(Direction direction); | 146 void RotateFocus(Direction direction); |
| 153 | 147 |
| 154 #if !defined(OS_MACOSX) | 148 #if !defined(OS_MACOSX) |
| 155 AcceleratorController* accelerator_controller() { | 149 AcceleratorController* accelerator_controller() { |
| 156 return accelerator_controller_.get(); | 150 return accelerator_controller_.get(); |
| 157 } | 151 } |
| 158 #endif // !defined(OS_MACOSX) | 152 #endif // !defined(OS_MACOSX) |
| 159 | 153 |
| 160 internal::RootWindowEventFilter* root_filter() { | 154 internal::RootWindowEventFilter* root_filter() { |
| 161 return root_filter_; | 155 return root_filter_; |
| 162 } | 156 } |
| 163 internal::TooltipController* tooltip_controller() { | 157 internal::TooltipController* tooltip_controller() { |
| 164 return tooltip_controller_.get(); | 158 return tooltip_controller_.get(); |
| 165 } | 159 } |
| 166 internal::PartialScreenshotEventFilter* partial_screenshot_filter() { | 160 internal::PartialScreenshotEventFilter* partial_screenshot_filter() { |
| 167 return partial_screenshot_filter_.get(); | 161 return partial_screenshot_filter_.get(); |
| 168 } | 162 } |
| 163 DesktopBackgroundController* desktop_background_controller() { |
| 164 return desktop_background_controller_.get(); |
| 165 } |
| 169 PowerButtonController* power_button_controller() { | 166 PowerButtonController* power_button_controller() { |
| 170 return power_button_controller_.get(); | 167 return power_button_controller_.get(); |
| 171 } | 168 } |
| 172 VideoDetector* video_detector() { | 169 VideoDetector* video_detector() { |
| 173 return video_detector_.get(); | 170 return video_detector_.get(); |
| 174 } | 171 } |
| 175 WindowCycleController* window_cycle_controller() { | 172 WindowCycleController* window_cycle_controller() { |
| 176 return window_cycle_controller_.get(); | 173 return window_cycle_controller_.get(); |
| 177 } | 174 } |
| 178 internal::FocusCycler* focus_cycler() { | 175 internal::FocusCycler* focus_cycler() { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 scoped_ptr<internal::AppList> app_list_; | 246 scoped_ptr<internal::AppList> app_list_; |
| 250 | 247 |
| 251 scoped_ptr<internal::StackingController> stacking_controller_; | 248 scoped_ptr<internal::StackingController> stacking_controller_; |
| 252 scoped_ptr<internal::ActivationController> activation_controller_; | 249 scoped_ptr<internal::ActivationController> activation_controller_; |
| 253 scoped_ptr<internal::WindowModalityController> window_modality_controller_; | 250 scoped_ptr<internal::WindowModalityController> window_modality_controller_; |
| 254 scoped_ptr<internal::DragDropController> drag_drop_controller_; | 251 scoped_ptr<internal::DragDropController> drag_drop_controller_; |
| 255 scoped_ptr<internal::WorkspaceController> workspace_controller_; | 252 scoped_ptr<internal::WorkspaceController> workspace_controller_; |
| 256 scoped_ptr<internal::ShadowController> shadow_controller_; | 253 scoped_ptr<internal::ShadowController> shadow_controller_; |
| 257 scoped_ptr<internal::TooltipController> tooltip_controller_; | 254 scoped_ptr<internal::TooltipController> tooltip_controller_; |
| 258 scoped_ptr<internal::VisibilityController> visibility_controller_; | 255 scoped_ptr<internal::VisibilityController> visibility_controller_; |
| 256 scoped_ptr<DesktopBackgroundController> desktop_background_controller_; |
| 259 scoped_ptr<PowerButtonController> power_button_controller_; | 257 scoped_ptr<PowerButtonController> power_button_controller_; |
| 260 scoped_ptr<VideoDetector> video_detector_; | 258 scoped_ptr<VideoDetector> video_detector_; |
| 261 scoped_ptr<WindowCycleController> window_cycle_controller_; | 259 scoped_ptr<WindowCycleController> window_cycle_controller_; |
| 262 scoped_ptr<internal::FocusCycler> focus_cycler_; | 260 scoped_ptr<internal::FocusCycler> focus_cycler_; |
| 263 | 261 |
| 264 // These controllers are not owned by the shell. | 262 // These controllers are not owned by the shell. |
| 265 AudioController* audio_controller_; | 263 AudioController* audio_controller_; |
| 266 BrightnessController* brightness_controller_; | 264 BrightnessController* brightness_controller_; |
| 267 PowerStatusController* power_status_controller_; | 265 PowerStatusController* power_status_controller_; |
| 268 | 266 |
| 269 // An event filter that pre-handles all key events to send them to an IME. | 267 // An event filter that pre-handles all key events to send them to an IME. |
| 270 scoped_ptr<internal::InputMethodEventFilter> input_method_filter_; | 268 scoped_ptr<internal::InputMethodEventFilter> input_method_filter_; |
| 271 | 269 |
| 272 // An event filter that pre-handles key events while the partial | 270 // An event filter that pre-handles key events while the partial |
| 273 // screenshot UI is active. | 271 // screenshot UI is active. |
| 274 scoped_ptr<internal::PartialScreenshotEventFilter> partial_screenshot_filter_; | 272 scoped_ptr<internal::PartialScreenshotEventFilter> partial_screenshot_filter_; |
| 275 | 273 |
| 276 #if !defined(OS_MACOSX) | 274 #if !defined(OS_MACOSX) |
| 277 // An event filter that pre-handles global accelerators. | 275 // An event filter that pre-handles global accelerators. |
| 278 scoped_ptr<internal::AcceleratorFilter> accelerator_filter_; | 276 scoped_ptr<internal::AcceleratorFilter> accelerator_filter_; |
| 279 #endif | 277 #endif |
| 280 | 278 |
| 281 // The shelf for managing the launcher and the status widget in non-compact | 279 // The shelf for managing the launcher and the status widget in non-compact |
| 282 // mode. Shell does not own the shelf. Instead, it is owned by container of | 280 // mode. Shell does not own the shelf. Instead, it is owned by container of |
| 283 // the status area. | 281 // the status area. |
| 284 internal::ShelfLayoutManager* shelf_; | 282 internal::ShelfLayoutManager* shelf_; |
| 285 | 283 |
| 286 // Can change at runtime. | |
| 287 BackgroundMode desktop_background_mode_; | |
| 288 | |
| 289 // Owned by aura::RootWindow, cached here for type safety. | 284 // Owned by aura::RootWindow, cached here for type safety. |
| 290 internal::RootWindowLayoutManager* root_window_layout_; | 285 internal::RootWindowLayoutManager* root_window_layout_; |
| 291 | 286 |
| 292 // Status area with clock, Wi-Fi signal, etc. | 287 // Status area with clock, Wi-Fi signal, etc. |
| 293 views::Widget* status_widget_; | 288 views::Widget* status_widget_; |
| 294 | 289 |
| 295 // System tray with clock, Wi-Fi signal, etc. (a replacement in progress for | 290 // System tray with clock, Wi-Fi signal, etc. (a replacement in progress for |
| 296 // |status_widget_|). | 291 // |status_widget_|). |
| 297 scoped_ptr<SystemTray> tray_; | 292 scoped_ptr<SystemTray> tray_; |
| 298 | 293 |
| 299 DISALLOW_COPY_AND_ASSIGN(Shell); | 294 DISALLOW_COPY_AND_ASSIGN(Shell); |
| 300 }; | 295 }; |
| 301 | 296 |
| 302 } // namespace ash | 297 } // namespace ash |
| 303 | 298 |
| 304 #endif // ASH_SHELL_H_ | 299 #endif // ASH_SHELL_H_ |
| OLD | NEW |