| 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" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 virtual aura::Window* CreateDefaultContainer( | 201 virtual aura::Window* CreateDefaultContainer( |
| 202 const ContainerParams& params) OVERRIDE; | 202 const ContainerParams& params) OVERRIDE; |
| 203 virtual aura::Window* CreateContainer(const ContainerParams& params) OVERRIDE; | 203 virtual aura::Window* CreateContainer(const ContainerParams& params) OVERRIDE; |
| 204 virtual aura::Window* GetContext() OVERRIDE { return root_window_; } | 204 virtual aura::Window* GetContext() OVERRIDE { return root_window_; } |
| 205 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; | 206 virtual void SetRotation(gfx::Display::Rotation rotation) OVERRIDE; |
| 207 virtual ui::LayerAnimator* GetScreenAnimator() OVERRIDE; | 207 virtual ui::LayerAnimator* GetScreenAnimator() OVERRIDE; |
| 208 | 208 |
| 209 aura::Window* root_window_; | 209 aura::Window* root_window_; |
| 210 aura::Window* background_window_; | 210 aura::Window* background_window_; |
| 211 aura::Window* popup_window_; |
| 211 | 212 |
| 212 scoped_ptr<BackgroundController> background_controller_; | 213 scoped_ptr<BackgroundController> background_controller_; |
| 213 scoped_ptr<aura::client::WindowTreeClient> window_tree_client_; | 214 scoped_ptr<aura::client::WindowTreeClient> window_tree_client_; |
| 214 scoped_ptr<AcceleratorHandler> accelerator_handler_; | 215 scoped_ptr<AcceleratorHandler> accelerator_handler_; |
| 215 scoped_ptr< ::wm::ScopedCaptureClient> capture_client_; | 216 scoped_ptr< ::wm::ScopedCaptureClient> capture_client_; |
| 216 scoped_ptr<aura::client::ScreenPositionClient> screen_position_client_; | 217 scoped_ptr<aura::client::ScreenPositionClient> screen_position_client_; |
| 217 | 218 |
| 218 DISALLOW_COPY_AND_ASSIGN(ScreenManagerImpl); | 219 DISALLOW_COPY_AND_ASSIGN(ScreenManagerImpl); |
| 219 }; | 220 }; |
| 220 | 221 |
| 221 ScreenManagerImpl::ScreenManagerImpl(aura::Window* root_window) | 222 ScreenManagerImpl::ScreenManagerImpl(aura::Window* root_window) |
| 222 : root_window_(root_window) { | 223 : root_window_(root_window) { |
| 223 DCHECK(root_window_); | 224 DCHECK(root_window_); |
| 224 DCHECK(!instance); | 225 DCHECK(!instance); |
| 225 instance = this; | 226 instance = this; |
| 226 } | 227 } |
| 227 | 228 |
| 228 ScreenManagerImpl::~ScreenManagerImpl() { | 229 ScreenManagerImpl::~ScreenManagerImpl() { |
| 229 aura::client::SetScreenPositionClient(root_window_, NULL); | 230 aura::client::SetScreenPositionClient(root_window_, NULL); |
| 230 aura::client::SetWindowTreeClient(root_window_, NULL); | 231 aura::client::SetWindowTreeClient(root_window_, NULL); |
| 231 instance = NULL; | 232 instance = NULL; |
| 232 } | 233 } |
| 233 | 234 |
| 234 void ScreenManagerImpl::Init() { | 235 void ScreenManagerImpl::Init() { |
| 235 // TODO(oshima): Move the background out from ScreenManager. | 236 // TODO(oshima): Move the background out from ScreenManager. |
| 236 root_window_->SetLayoutManager(new FillLayoutManager(root_window_)); | 237 root_window_->SetLayoutManager(new FillLayoutManager(root_window_)); |
| 237 background_window_ = | 238 background_window_ = |
| 238 CreateContainer(ContainerParams("AthenaBackground", CP_BACKGROUND)); | 239 CreateContainer(ContainerParams("AthenaBackground", CP_BACKGROUND)); |
| 239 | |
| 240 background_window_->SetLayoutManager( | 240 background_window_->SetLayoutManager( |
| 241 new FillLayoutManager(background_window_)); | 241 new FillLayoutManager(background_window_)); |
| 242 background_controller_.reset(new BackgroundController(background_window_)); | 242 ContainerParams popup_params("AthenaPopup", CP_POPUP); |
| 243 popup_params.can_activate_children = true; |
| 244 popup_window_ = CreateContainer(popup_params); |
| 245 |
| 246 background_controller_.reset(new BackgroundController(background_window_, |
| 247 popup_window_)); |
| 243 | 248 |
| 244 capture_client_.reset(new ::wm::ScopedCaptureClient(root_window_)); | 249 capture_client_.reset(new ::wm::ScopedCaptureClient(root_window_)); |
| 245 accelerator_handler_.reset(new ScreenAcceleratorHandler(root_window_)); | 250 accelerator_handler_.reset(new ScreenAcceleratorHandler(root_window_)); |
| 246 } | 251 } |
| 247 | 252 |
| 248 aura::Window* ScreenManagerImpl::CreateDefaultContainer( | 253 aura::Window* ScreenManagerImpl::CreateDefaultContainer( |
| 249 const ContainerParams& params) { | 254 const ContainerParams& params) { |
| 250 aura::Window* container = CreateContainer(params); | 255 aura::Window* container = CreateContainer(params); |
| 251 window_tree_client_.reset(new AthenaWindowTreeClient(container)); | 256 window_tree_client_.reset(new AthenaWindowTreeClient(container)); |
| 252 aura::client::SetWindowTreeClient(root_window_, window_tree_client_.get()); | 257 aura::client::SetWindowTreeClient(root_window_, window_tree_client_.get()); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 delete instance; | 378 delete instance; |
| 374 DCHECK(!instance); | 379 DCHECK(!instance); |
| 375 } | 380 } |
| 376 | 381 |
| 377 // static | 382 // static |
| 378 wm::FocusRules* ScreenManager::CreateFocusRules() { | 383 wm::FocusRules* ScreenManager::CreateFocusRules() { |
| 379 return new AthenaFocusRules(); | 384 return new AthenaFocusRules(); |
| 380 } | 385 } |
| 381 | 386 |
| 382 } // namespace athena | 387 } // namespace athena |
| OLD | NEW |