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/input/public/accelerator_manager.h" | |
7 #include "athena/screen/background_controller.h" | 8 #include "athena/screen/background_controller.h" |
9 #include "athena/screen/screen_accelerator_handler.h" | |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
10 #include "ui/aura/client/window_tree_client.h" | 12 #include "ui/aura/client/window_tree_client.h" |
11 #include "ui/aura/layout_manager.h" | 13 #include "ui/aura/layout_manager.h" |
12 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
15 #include "ui/wm/core/capture_controller.h" | |
13 | 16 |
14 namespace athena { | 17 namespace athena { |
15 namespace { | 18 namespace { |
16 | 19 |
17 ScreenManager* instance = NULL; | 20 ScreenManager* instance = NULL; |
18 | 21 |
19 // TODO(oshima): There seems to be a couple of private implementation which does | 22 // TODO(oshima): There seems to be a couple of private implementation which does |
20 // the same. | 23 // the same. |
21 // Consider consolidating and reuse it. | 24 // Consider consolidating and reuse it. |
22 class FillLayoutManager : public aura::LayoutManager { | 25 class FillLayoutManager : public aura::LayoutManager { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 const std::string& name) OVERRIDE; | 99 const std::string& name) OVERRIDE; |
97 virtual aura::Window* CreateContainer(const std::string& name) OVERRIDE; | 100 virtual aura::Window* CreateContainer(const std::string& name) OVERRIDE; |
98 virtual aura::Window* GetContext() OVERRIDE { return root_window_; } | 101 virtual aura::Window* GetContext() OVERRIDE { return root_window_; } |
99 virtual void SetBackgroundImage(const gfx::ImageSkia& image) OVERRIDE; | 102 virtual void SetBackgroundImage(const gfx::ImageSkia& image) OVERRIDE; |
100 | 103 |
101 aura::Window* root_window_; | 104 aura::Window* root_window_; |
102 aura::Window* background_window_; | 105 aura::Window* background_window_; |
103 | 106 |
104 scoped_ptr<BackgroundController> background_controller_; | 107 scoped_ptr<BackgroundController> background_controller_; |
105 scoped_ptr<aura::client::WindowTreeClient> window_tree_client_; | 108 scoped_ptr<aura::client::WindowTreeClient> window_tree_client_; |
109 scoped_ptr<AcceleratorHandler> accelerator_handler_; | |
110 scoped_ptr< ::wm::ScopedCaptureClient> capture_client_; | |
Jun Mukai
2014/06/10 01:43:05
nit: Is there a rule to put space between < and :?
oshima
2014/06/10 05:18:11
Believe or not, <: is reserved (replacement for "[
Jun Mukai
2014/06/10 19:32:50
Whoa, you're right! I've forgotten I hate that th
| |
106 | 111 |
107 DISALLOW_COPY_AND_ASSIGN(ScreenManagerImpl); | 112 DISALLOW_COPY_AND_ASSIGN(ScreenManagerImpl); |
108 }; | 113 }; |
109 | 114 |
110 void ScreenManagerImpl::Init() { | 115 void ScreenManagerImpl::Init() { |
111 root_window_->SetLayoutManager(new FillLayoutManager(root_window_)); | 116 root_window_->SetLayoutManager(new FillLayoutManager(root_window_)); |
112 background_window_ = | 117 background_window_ = |
113 CreateContainerInternal(root_window_, "AthenaBackground"); | 118 CreateContainerInternal(root_window_, "AthenaBackground"); |
114 background_window_->SetLayoutManager( | 119 background_window_->SetLayoutManager( |
115 new FillLayoutManager(background_window_)); | 120 new FillLayoutManager(background_window_)); |
116 background_controller_.reset(new BackgroundController(background_window_)); | 121 background_controller_.reset(new BackgroundController(background_window_)); |
122 | |
123 capture_client_.reset(new ::wm::ScopedCaptureClient(root_window_)); | |
124 accelerator_handler_.reset(new ScreenAcceleratorHandler(root_window_)); | |
117 } | 125 } |
118 | 126 |
119 aura::Window* ScreenManagerImpl::CreateDefaultContainer( | 127 aura::Window* ScreenManagerImpl::CreateDefaultContainer( |
120 const std::string& name) { | 128 const std::string& name) { |
121 aura::Window* container = CreateContainerInternal(root_window_, name); | 129 aura::Window* container = CreateContainerInternal(root_window_, name); |
122 window_tree_client_.reset(new AthenaWindowTreeClient(container)); | 130 window_tree_client_.reset(new AthenaWindowTreeClient(container)); |
123 aura::client::SetWindowTreeClient(root_window_, window_tree_client_.get()); | 131 aura::client::SetWindowTreeClient(root_window_, window_tree_client_.get()); |
124 return container; | 132 return container; |
125 } | 133 } |
126 | 134 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 } | 168 } |
161 | 169 |
162 // static | 170 // static |
163 void ScreenManager::Shutdown() { | 171 void ScreenManager::Shutdown() { |
164 DCHECK(instance); | 172 DCHECK(instance); |
165 delete instance; | 173 delete instance; |
166 DCHECK(!instance); | 174 DCHECK(!instance); |
167 } | 175 } |
168 | 176 |
169 } // namespace athena | 177 } // namespace athena |
OLD | NEW |