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