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/wm/window_manager_impl.h" | 5 #include "athena/wm/window_manager_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "athena/screen/public/screen_manager.h" | 9 #include "athena/screen/public/screen_manager.h" |
10 #include "athena/util/container_priorities.h" | 10 #include "athena/util/container_priorities.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 WindowManagerImpl::WindowManagerImpl() { | 142 WindowManagerImpl::WindowManagerImpl() { |
143 ScreenManager::ContainerParams params("DefaultContainer", CP_DEFAULT); | 143 ScreenManager::ContainerParams params("DefaultContainer", CP_DEFAULT); |
144 params.can_activate_children = true; | 144 params.can_activate_children = true; |
145 container_.reset(ScreenManager::Get()->CreateDefaultContainer(params)); | 145 container_.reset(ScreenManager::Get()->CreateDefaultContainer(params)); |
146 container_->SetLayoutManager(new AthenaContainerLayoutManager); | 146 container_->SetLayoutManager(new AthenaContainerLayoutManager); |
147 container_->AddObserver(this); | 147 container_->AddObserver(this); |
148 window_list_provider_.reset(new WindowListProviderImpl(container_.get())); | 148 window_list_provider_.reset(new WindowListProviderImpl(container_.get())); |
149 bezel_controller_.reset(new BezelController(container_.get())); | 149 bezel_controller_.reset(new BezelController(container_.get())); |
150 split_view_controller_.reset( | 150 split_view_controller_.reset( |
151 new SplitViewController(container_.get(), window_list_provider_.get())); | 151 new SplitViewController(container_.get(), window_list_provider_.get())); |
152 AddObserver(split_view_controller_.get()); | |
153 bezel_controller_->set_left_right_delegate(split_view_controller_.get()); | 152 bezel_controller_->set_left_right_delegate(split_view_controller_.get()); |
154 container_->AddPreTargetHandler(bezel_controller_.get()); | 153 container_->AddPreTargetHandler(bezel_controller_.get()); |
155 title_drag_controller_.reset(new TitleDragController(container_.get(), this)); | 154 title_drag_controller_.reset(new TitleDragController(container_.get(), this)); |
156 wm_state_.reset(new wm::WMState()); | 155 wm_state_.reset(new wm::WMState()); |
157 aura::client::ActivationClient* activation_client = | 156 aura::client::ActivationClient* activation_client = |
158 aura::client::GetActivationClient(container_->GetRootWindow()); | 157 aura::client::GetActivationClient(container_->GetRootWindow()); |
159 shadow_controller_.reset(new wm::ShadowController(activation_client)); | 158 shadow_controller_.reset(new wm::ShadowController(activation_client)); |
160 instance = this; | 159 instance = this; |
161 InstallAccelerators(); | 160 InstallAccelerators(); |
162 } | 161 } |
163 | 162 |
164 WindowManagerImpl::~WindowManagerImpl() { | 163 WindowManagerImpl::~WindowManagerImpl() { |
165 overview_.reset(); | 164 overview_.reset(); |
166 RemoveObserver(split_view_controller_.get()); | |
167 split_view_controller_.reset(); | 165 split_view_controller_.reset(); |
168 window_list_provider_.reset(); | 166 window_list_provider_.reset(); |
169 if (container_) { | 167 if (container_) { |
170 container_->RemoveObserver(this); | 168 container_->RemoveObserver(this); |
171 container_->RemovePreTargetHandler(bezel_controller_.get()); | 169 container_->RemovePreTargetHandler(bezel_controller_.get()); |
172 } | 170 } |
173 // |title_drag_controller_| needs to be reset before |container_|. | 171 // |title_drag_controller_| needs to be reset before |container_|. |
174 title_drag_controller_.reset(); | 172 title_drag_controller_.reset(); |
175 container_.reset(); | 173 container_.reset(); |
176 instance = NULL; | 174 instance = NULL; |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 DCHECK(!instance); | 425 DCHECK(!instance); |
428 } | 426 } |
429 | 427 |
430 // static | 428 // static |
431 WindowManager* WindowManager::GetInstance() { | 429 WindowManager* WindowManager::GetInstance() { |
432 DCHECK(instance); | 430 DCHECK(instance); |
433 return instance; | 431 return instance; |
434 } | 432 } |
435 | 433 |
436 } // namespace athena | 434 } // namespace athena |
OLD | NEW |