| 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" |
| 21 #include "ui/compositor/layer.h" | 22 #include "ui/compositor/layer.h" |
| 23 #include "ui/gfx/screen.h" |
| 22 #include "ui/wm/core/base_focus_rules.h" | 24 #include "ui/wm/core/base_focus_rules.h" |
| 23 #include "ui/wm/core/capture_controller.h" | 25 #include "ui/wm/core/capture_controller.h" |
| 24 | 26 |
| 25 namespace athena { | 27 namespace athena { |
| 26 namespace { | 28 namespace { |
| 27 | 29 |
| 28 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ScreenManager::ContainerParams, | 30 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ScreenManager::ContainerParams, |
| 29 kContainerParamsKey, | 31 kContainerParamsKey, |
| 30 NULL); | 32 NULL); |
| 31 | 33 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 195 |
| 194 void Init(); | 196 void Init(); |
| 195 | 197 |
| 196 private: | 198 private: |
| 197 // ScreenManager: | 199 // ScreenManager: |
| 198 virtual aura::Window* CreateDefaultContainer( | 200 virtual aura::Window* CreateDefaultContainer( |
| 199 const ContainerParams& params) OVERRIDE; | 201 const ContainerParams& params) OVERRIDE; |
| 200 virtual aura::Window* CreateContainer(const ContainerParams& params) OVERRIDE; | 202 virtual aura::Window* CreateContainer(const ContainerParams& params) OVERRIDE; |
| 201 virtual aura::Window* GetContext() OVERRIDE { return root_window_; } | 203 virtual aura::Window* GetContext() OVERRIDE { return root_window_; } |
| 202 virtual void SetBackgroundImage(const gfx::ImageSkia& image) OVERRIDE; | 204 virtual void SetBackgroundImage(const gfx::ImageSkia& image) OVERRIDE; |
| 205 virtual gfx::Display::Rotation GetRotation() OVERRIDE; |
| 206 virtual void SetRotation(gfx::Display::Rotation rotation) OVERRIDE; |
| 203 virtual ui::LayerAnimator* GetScreenAnimator() OVERRIDE; | 207 virtual ui::LayerAnimator* GetScreenAnimator() OVERRIDE; |
| 204 | 208 |
| 205 aura::Window* root_window_; | 209 aura::Window* root_window_; |
| 206 aura::Window* background_window_; | 210 aura::Window* background_window_; |
| 211 gfx::Display::Rotation rotation_; |
| 207 | 212 |
| 208 scoped_ptr<BackgroundController> background_controller_; | 213 scoped_ptr<BackgroundController> background_controller_; |
| 209 scoped_ptr<aura::client::WindowTreeClient> window_tree_client_; | 214 scoped_ptr<aura::client::WindowTreeClient> window_tree_client_; |
| 210 scoped_ptr<AcceleratorHandler> accelerator_handler_; | 215 scoped_ptr<AcceleratorHandler> accelerator_handler_; |
| 211 scoped_ptr< ::wm::ScopedCaptureClient> capture_client_; | 216 scoped_ptr< ::wm::ScopedCaptureClient> capture_client_; |
| 212 scoped_ptr<aura::client::ScreenPositionClient> screen_position_client_; | 217 scoped_ptr<aura::client::ScreenPositionClient> screen_position_client_; |
| 213 | 218 |
| 214 DISALLOW_COPY_AND_ASSIGN(ScreenManagerImpl); | 219 DISALLOW_COPY_AND_ASSIGN(ScreenManagerImpl); |
| 215 }; | 220 }; |
| 216 | 221 |
| 217 ScreenManagerImpl::ScreenManagerImpl(aura::Window* root_window) | 222 ScreenManagerImpl::ScreenManagerImpl(aura::Window* root_window) |
| 218 : root_window_(root_window) { | 223 : root_window_(root_window), |
| 224 rotation_(gfx::Display::ROTATE_0) { |
| 219 DCHECK(root_window_); | 225 DCHECK(root_window_); |
| 220 DCHECK(!instance); | 226 DCHECK(!instance); |
| 221 instance = this; | 227 instance = this; |
| 222 } | 228 } |
| 223 | 229 |
| 224 ScreenManagerImpl::~ScreenManagerImpl() { | 230 ScreenManagerImpl::~ScreenManagerImpl() { |
| 225 aura::client::SetScreenPositionClient(root_window_, NULL); | 231 aura::client::SetScreenPositionClient(root_window_, NULL); |
| 226 aura::client::SetWindowTreeClient(root_window_, NULL); | 232 aura::client::SetWindowTreeClient(root_window_, NULL); |
| 227 instance = NULL; | 233 instance = NULL; |
| 228 } | 234 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 root_window_->StackChildBelow(container, *iter); | 323 root_window_->StackChildBelow(container, *iter); |
| 318 | 324 |
| 319 container->Show(); | 325 container->Show(); |
| 320 return container; | 326 return container; |
| 321 } | 327 } |
| 322 | 328 |
| 323 void ScreenManagerImpl::SetBackgroundImage(const gfx::ImageSkia& image) { | 329 void ScreenManagerImpl::SetBackgroundImage(const gfx::ImageSkia& image) { |
| 324 background_controller_->SetImage(image); | 330 background_controller_->SetImage(image); |
| 325 } | 331 } |
| 326 | 332 |
| 333 gfx::Display::Rotation ScreenManagerImpl::GetRotation() { |
| 334 return rotation_; |
| 335 } |
| 336 |
| 337 void ScreenManagerImpl::SetRotation(gfx::Display::Rotation rotation) { |
| 338 if (rotation == rotation_) |
| 339 return; |
| 340 |
| 341 rotation_ = rotation; |
| 342 // TODO(flackr): Use display manager to update display rotation: |
| 343 // http://crbug.com/401044. |
| 344 static_cast<aura::TestScreen*>(gfx::Screen::GetNativeScreen())-> |
| 345 SetDisplayRotation(rotation); |
| 346 } |
| 347 |
| 327 ui::LayerAnimator* ScreenManagerImpl::GetScreenAnimator() { | 348 ui::LayerAnimator* ScreenManagerImpl::GetScreenAnimator() { |
| 328 return root_window_->layer()->GetAnimator(); | 349 return root_window_->layer()->GetAnimator(); |
| 329 } | 350 } |
| 330 | 351 |
| 331 } // namespace | 352 } // namespace |
| 332 | 353 |
| 333 ScreenManager::ContainerParams::ContainerParams(const std::string& n, | 354 ScreenManager::ContainerParams::ContainerParams(const std::string& n, |
| 334 int priority) | 355 int priority) |
| 335 : name(n), | 356 : name(n), |
| 336 can_activate_children(false), | 357 can_activate_children(false), |
| (...skipping 20 matching lines...) Expand all Loading... |
| 357 delete instance; | 378 delete instance; |
| 358 DCHECK(!instance); | 379 DCHECK(!instance); |
| 359 } | 380 } |
| 360 | 381 |
| 361 // static | 382 // static |
| 362 wm::FocusRules* ScreenManager::CreateFocusRules() { | 383 wm::FocusRules* ScreenManager::CreateFocusRules() { |
| 363 return new AthenaFocusRules(); | 384 return new AthenaFocusRules(); |
| 364 } | 385 } |
| 365 | 386 |
| 366 } // namespace athena | 387 } // namespace athena |
| OLD | NEW |