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()); |
152 bezel_controller_->set_left_right_delegate(split_view_controller_.get()); | 153 bezel_controller_->set_left_right_delegate(split_view_controller_.get()); |
153 container_->AddPreTargetHandler(bezel_controller_.get()); | 154 container_->AddPreTargetHandler(bezel_controller_.get()); |
154 title_drag_controller_.reset(new TitleDragController(container_.get(), this)); | 155 title_drag_controller_.reset(new TitleDragController(container_.get(), this)); |
155 wm_state_.reset(new wm::WMState()); | 156 wm_state_.reset(new wm::WMState()); |
156 aura::client::ActivationClient* activation_client = | 157 aura::client::ActivationClient* activation_client = |
157 aura::client::GetActivationClient(container_->GetRootWindow()); | 158 aura::client::GetActivationClient(container_->GetRootWindow()); |
158 shadow_controller_.reset(new wm::ShadowController(activation_client)); | 159 shadow_controller_.reset(new wm::ShadowController(activation_client)); |
159 instance = this; | 160 instance = this; |
160 InstallAccelerators(); | 161 InstallAccelerators(); |
161 } | 162 } |
162 | 163 |
163 WindowManagerImpl::~WindowManagerImpl() { | 164 WindowManagerImpl::~WindowManagerImpl() { |
164 overview_.reset(); | 165 overview_.reset(); |
| 166 RemoveObserver(split_view_controller_.get()); |
165 split_view_controller_.reset(); | 167 split_view_controller_.reset(); |
166 window_list_provider_.reset(); | 168 window_list_provider_.reset(); |
167 if (container_) { | 169 if (container_) { |
168 container_->RemoveObserver(this); | 170 container_->RemoveObserver(this); |
169 container_->RemovePreTargetHandler(bezel_controller_.get()); | 171 container_->RemovePreTargetHandler(bezel_controller_.get()); |
170 } | 172 } |
171 // |title_drag_controller_| needs to be reset before |container_|. | 173 // |title_drag_controller_| needs to be reset before |container_|. |
172 title_drag_controller_.reset(); | 174 title_drag_controller_.reset(); |
173 container_.reset(); | 175 container_.reset(); |
174 instance = NULL; | 176 instance = NULL; |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 DCHECK(!instance); | 427 DCHECK(!instance); |
426 } | 428 } |
427 | 429 |
428 // static | 430 // static |
429 WindowManager* WindowManager::GetInstance() { | 431 WindowManager* WindowManager::GetInstance() { |
430 DCHECK(instance); | 432 DCHECK(instance); |
431 return instance; | 433 return instance; |
432 } | 434 } |
433 | 435 |
434 } // namespace athena | 436 } // namespace athena |
OLD | NEW |