| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "athena/screen/public/screen_manager.h" | 5 #include "athena/screen/public/screen_manager.h" |
| 6 | 6 |
| 7 #include "athena/common/container_priorities.h" | 7 #include "athena/common/container_priorities.h" |
| 8 #include "athena/common/fill_layout_manager.h" | 8 #include "athena/common/fill_layout_manager.h" |
| 9 #include "athena/input/public/accelerator_manager.h" | 9 #include "athena/input/public/accelerator_manager.h" |
| 10 #include "athena/screen/background_controller.h" | 10 #include "athena/screen/background_controller.h" |
| 11 #include "athena/screen/screen_accelerator_handler.h" | 11 #include "athena/screen/screen_accelerator_handler.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "ui/aura/client/screen_position_client.h" | 14 #include "ui/aura/client/screen_position_client.h" |
| 15 #include "ui/aura/client/window_tree_client.h" | 15 #include "ui/aura/client/window_tree_client.h" |
| 16 #include "ui/aura/layout_manager.h" | 16 #include "ui/aura/layout_manager.h" |
| 17 #include "ui/aura/test/test_screen.h" |
| 17 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
| 18 #include "ui/aura/window_property.h" | 19 #include "ui/aura/window_property.h" |
| 19 #include "ui/aura/window_targeter.h" | 20 #include "ui/aura/window_targeter.h" |
| 20 #include "ui/aura/window_tree_host.h" | 21 #include "ui/aura/window_tree_host.h" |
| 22 #include "ui/gfx/screen.h" |
| 21 #include "ui/wm/core/base_focus_rules.h" | 23 #include "ui/wm/core/base_focus_rules.h" |
| 22 #include "ui/wm/core/capture_controller.h" | 24 #include "ui/wm/core/capture_controller.h" |
| 23 | 25 |
| 24 namespace athena { | 26 namespace athena { |
| 25 namespace { | 27 namespace { |
| 26 | 28 |
| 27 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ScreenManager::ContainerParams, | 29 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ScreenManager::ContainerParams, |
| 28 kContainerParamsKey, | 30 kContainerParamsKey, |
| 29 NULL); | 31 NULL); |
| 30 | 32 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 194 |
| 193 void Init(); | 195 void Init(); |
| 194 | 196 |
| 195 private: | 197 private: |
| 196 // ScreenManager: | 198 // ScreenManager: |
| 197 virtual aura::Window* CreateDefaultContainer( | 199 virtual aura::Window* CreateDefaultContainer( |
| 198 const ContainerParams& params) OVERRIDE; | 200 const ContainerParams& params) OVERRIDE; |
| 199 virtual aura::Window* CreateContainer(const ContainerParams& params) OVERRIDE; | 201 virtual aura::Window* CreateContainer(const ContainerParams& params) OVERRIDE; |
| 200 virtual aura::Window* GetContext() OVERRIDE { return root_window_; } | 202 virtual aura::Window* GetContext() OVERRIDE { return root_window_; } |
| 201 virtual void SetBackgroundImage(const gfx::ImageSkia& image) OVERRIDE; | 203 virtual void SetBackgroundImage(const gfx::ImageSkia& image) OVERRIDE; |
| 204 virtual gfx::Display::Rotation GetRotation() OVERRIDE; |
| 205 virtual void SetRotation(gfx::Display::Rotation rotation) OVERRIDE; |
| 202 | 206 |
| 203 aura::Window* root_window_; | 207 aura::Window* root_window_; |
| 204 aura::Window* background_window_; | 208 aura::Window* background_window_; |
| 209 gfx::Display::Rotation rotation_; |
| 205 | 210 |
| 206 scoped_ptr<BackgroundController> background_controller_; | 211 scoped_ptr<BackgroundController> background_controller_; |
| 207 scoped_ptr<aura::client::WindowTreeClient> window_tree_client_; | 212 scoped_ptr<aura::client::WindowTreeClient> window_tree_client_; |
| 208 scoped_ptr<AcceleratorHandler> accelerator_handler_; | 213 scoped_ptr<AcceleratorHandler> accelerator_handler_; |
| 209 scoped_ptr< ::wm::ScopedCaptureClient> capture_client_; | 214 scoped_ptr< ::wm::ScopedCaptureClient> capture_client_; |
| 210 scoped_ptr<aura::client::ScreenPositionClient> screen_position_client_; | 215 scoped_ptr<aura::client::ScreenPositionClient> screen_position_client_; |
| 211 | 216 |
| 212 DISALLOW_COPY_AND_ASSIGN(ScreenManagerImpl); | 217 DISALLOW_COPY_AND_ASSIGN(ScreenManagerImpl); |
| 213 }; | 218 }; |
| 214 | 219 |
| 215 ScreenManagerImpl::ScreenManagerImpl(aura::Window* root_window) | 220 ScreenManagerImpl::ScreenManagerImpl(aura::Window* root_window) |
| 216 : root_window_(root_window) { | 221 : root_window_(root_window), |
| 222 rotation_(gfx::Display::ROTATE_0) { |
| 217 DCHECK(root_window_); | 223 DCHECK(root_window_); |
| 218 DCHECK(!instance); | 224 DCHECK(!instance); |
| 219 instance = this; | 225 instance = this; |
| 220 } | 226 } |
| 221 | 227 |
| 222 ScreenManagerImpl::~ScreenManagerImpl() { | 228 ScreenManagerImpl::~ScreenManagerImpl() { |
| 223 aura::client::SetScreenPositionClient(root_window_, NULL); | 229 aura::client::SetScreenPositionClient(root_window_, NULL); |
| 224 aura::client::SetWindowTreeClient(root_window_, NULL); | 230 aura::client::SetWindowTreeClient(root_window_, NULL); |
| 225 instance = NULL; | 231 instance = NULL; |
| 226 } | 232 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 root_window_->StackChildBelow(container, *iter); | 321 root_window_->StackChildBelow(container, *iter); |
| 316 | 322 |
| 317 container->Show(); | 323 container->Show(); |
| 318 return container; | 324 return container; |
| 319 } | 325 } |
| 320 | 326 |
| 321 void ScreenManagerImpl::SetBackgroundImage(const gfx::ImageSkia& image) { | 327 void ScreenManagerImpl::SetBackgroundImage(const gfx::ImageSkia& image) { |
| 322 background_controller_->SetImage(image); | 328 background_controller_->SetImage(image); |
| 323 } | 329 } |
| 324 | 330 |
| 331 gfx::Display::Rotation ScreenManagerImpl::GetRotation() { |
| 332 return rotation_; |
| 333 } |
| 334 |
| 335 void ScreenManagerImpl::SetRotation(gfx::Display::Rotation rotation) { |
| 336 if (rotation == rotation_) |
| 337 return; |
| 338 |
| 339 rotation_ = rotation; |
| 340 // TODO(flackr): Use display manager to update display rotation: |
| 341 // http://crbug.com/401044. |
| 342 static_cast<aura::TestScreen*>(gfx::Screen::GetNativeScreen())-> |
| 343 SetDisplayRotation(rotation); |
| 344 } |
| 345 |
| 325 } // namespace | 346 } // namespace |
| 326 | 347 |
| 327 ScreenManager::ContainerParams::ContainerParams(const std::string& n, | 348 ScreenManager::ContainerParams::ContainerParams(const std::string& n, |
| 328 int priority) | 349 int priority) |
| 329 : name(n), | 350 : name(n), |
| 330 can_activate_children(false), | 351 can_activate_children(false), |
| 331 grab_inputs(false), | 352 grab_inputs(false), |
| 332 z_order_priority(priority) { | 353 z_order_priority(priority) { |
| 333 } | 354 } |
| 334 | 355 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 351 delete instance; | 372 delete instance; |
| 352 DCHECK(!instance); | 373 DCHECK(!instance); |
| 353 } | 374 } |
| 354 | 375 |
| 355 // static | 376 // static |
| 356 wm::FocusRules* ScreenManager::CreateFocusRules() { | 377 wm::FocusRules* ScreenManager::CreateFocusRules() { |
| 357 return new AthenaFocusRules(); | 378 return new AthenaFocusRules(); |
| 358 } | 379 } |
| 359 | 380 |
| 360 } // namespace athena | 381 } // namespace athena |
| OLD | NEW |