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/common/container_priorities.h" | 9 #include "athena/common/container_priorities.h" |
10 #include "athena/screen/public/screen_manager.h" | 10 #include "athena/screen/public/screen_manager.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 WindowManagerImpl::WindowManagerImpl() { | 134 WindowManagerImpl::WindowManagerImpl() { |
135 ScreenManager::ContainerParams params("DefaultContainer", CP_DEFAULT); | 135 ScreenManager::ContainerParams params("DefaultContainer", CP_DEFAULT); |
136 params.can_activate_children = true; | 136 params.can_activate_children = true; |
137 container_.reset(ScreenManager::Get()->CreateDefaultContainer(params)); | 137 container_.reset(ScreenManager::Get()->CreateDefaultContainer(params)); |
138 container_->SetLayoutManager(new AthenaContainerLayoutManager); | 138 container_->SetLayoutManager(new AthenaContainerLayoutManager); |
139 container_->AddObserver(this); | 139 container_->AddObserver(this); |
140 window_list_provider_.reset(new WindowListProviderImpl(container_.get())); | 140 window_list_provider_.reset(new WindowListProviderImpl(container_.get())); |
141 bezel_controller_.reset(new BezelController(container_.get())); | 141 bezel_controller_.reset(new BezelController(container_.get())); |
142 split_view_controller_.reset( | 142 split_view_controller_.reset( |
143 new SplitViewController(container_.get(), window_list_provider_.get())); | 143 new SplitViewController(container_.get(), window_list_provider_.get())); |
144 AddObserver(split_view_controller_.get()); | |
144 bezel_controller_->set_left_right_delegate(split_view_controller_.get()); | 145 bezel_controller_->set_left_right_delegate(split_view_controller_.get()); |
145 container_->AddPreTargetHandler(bezel_controller_.get()); | 146 container_->AddPreTargetHandler(bezel_controller_.get()); |
146 title_drag_controller_.reset(new TitleDragController(container_.get(), this)); | 147 title_drag_controller_.reset(new TitleDragController(container_.get(), this)); |
147 wm_state_.reset(new wm::WMState()); | 148 wm_state_.reset(new wm::WMState()); |
148 aura::client::ActivationClient* activation_client = | 149 aura::client::ActivationClient* activation_client = |
149 aura::client::GetActivationClient(container_->GetRootWindow()); | 150 aura::client::GetActivationClient(container_->GetRootWindow()); |
150 shadow_controller_.reset(new wm::ShadowController(activation_client)); | 151 shadow_controller_.reset(new wm::ShadowController(activation_client)); |
151 instance = this; | 152 instance = this; |
152 InstallAccelerators(); | 153 InstallAccelerators(); |
153 } | 154 } |
154 | 155 |
155 WindowManagerImpl::~WindowManagerImpl() { | 156 WindowManagerImpl::~WindowManagerImpl() { |
156 overview_.reset(); | 157 overview_.reset(); |
157 split_view_controller_.reset(); | 158 split_view_controller_.reset(); |
sadrul
2014/09/15 14:32:29
RemoveObserver() first?
mfomitchev
2014/09/15 16:37:24
Done.
| |
158 window_list_provider_.reset(); | 159 window_list_provider_.reset(); |
159 if (container_) { | 160 if (container_) { |
160 container_->RemoveObserver(this); | 161 container_->RemoveObserver(this); |
161 container_->RemovePreTargetHandler(bezel_controller_.get()); | 162 container_->RemovePreTargetHandler(bezel_controller_.get()); |
162 } | 163 } |
163 // |title_drag_controller_| needs to be reset before |container_|. | 164 // |title_drag_controller_| needs to be reset before |container_|. |
164 title_drag_controller_.reset(); | 165 title_drag_controller_.reset(); |
165 container_.reset(); | 166 container_.reset(); |
166 instance = NULL; | 167 instance = NULL; |
167 } | 168 } |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
401 DCHECK(!instance); | 402 DCHECK(!instance); |
402 } | 403 } |
403 | 404 |
404 // static | 405 // static |
405 WindowManager* WindowManager::GetInstance() { | 406 WindowManager* WindowManager::GetInstance() { |
406 DCHECK(instance); | 407 DCHECK(instance); |
407 return instance; | 408 return instance; |
408 } | 409 } |
409 | 410 |
410 } // namespace athena | 411 } // namespace athena |
OLD | NEW |