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