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 "mojo/services/window_manager/window_manager_app.h" | 5 #include "mojo/services/window_manager/window_manager_app.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "mojo/aura/aura_init.h" | 9 #include "mojo/aura/aura_init.h" |
10 #include "mojo/aura/window_tree_host_mojo.h" | 10 #include "mojo/aura/window_tree_host_mojo.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 capture_client_.reset( | 164 capture_client_.reset( |
165 new wm::ScopedCaptureClient(window_tree_host_->window())); | 165 new wm::ScopedCaptureClient(window_tree_host_->window())); |
166 wm::FocusController* focus_controller = | 166 wm::FocusController* focus_controller = |
167 new wm::FocusController(new WMFocusRules); | 167 new wm::FocusController(new WMFocusRules); |
168 activation_client_ = focus_controller; | 168 activation_client_ = focus_controller; |
169 focus_client_.reset(focus_controller); | 169 focus_client_.reset(focus_controller); |
170 | 170 |
171 focus_client_->AddObserver(this); | 171 focus_client_->AddObserver(this); |
172 activation_client_->AddObserver(this); | 172 activation_client_->AddObserver(this); |
173 | 173 |
174 wrapped_delegate_->OnRootAdded(view_manager, root); | 174 if (wrapped_delegate_) |
jamesr
2014/07/25 00:20:29
after https://codereview.chromium.org/400113005, t
| |
175 wrapped_delegate_->OnRootAdded(view_manager, root); | |
175 | 176 |
176 for (Connections::const_iterator it = connections_.begin(); | 177 for (Connections::const_iterator it = connections_.begin(); |
177 it != connections_.end(); ++it) { | 178 it != connections_.end(); ++it) { |
178 (*it)->NotifyReady(); | 179 (*it)->NotifyReady(); |
179 } | 180 } |
180 } | 181 } |
181 | 182 |
182 void WindowManagerApp::OnViewManagerDisconnected( | 183 void WindowManagerApp::OnViewManagerDisconnected( |
183 ViewManager* view_manager) { | 184 ViewManager* view_manager) { |
184 DCHECK_EQ(view_manager_, view_manager); | 185 DCHECK_EQ(view_manager_, view_manager); |
185 wrapped_delegate_->OnViewManagerDisconnected(view_manager); | 186 if (wrapped_delegate_) |
187 wrapped_delegate_->OnViewManagerDisconnected(view_manager); | |
186 root_->RemoveObserver(this); | 188 root_->RemoveObserver(this); |
187 root_ = NULL; | 189 root_ = NULL; |
188 view_manager_ = NULL; | 190 view_manager_ = NULL; |
189 base::MessageLoop::current()->Quit(); | 191 base::MessageLoop::current()->Quit(); |
190 } | 192 } |
191 | 193 |
192 //////////////////////////////////////////////////////////////////////////////// | 194 //////////////////////////////////////////////////////////////////////////////// |
193 // WindowManagerApp, NodeObserver implementation: | 195 // WindowManagerApp, NodeObserver implementation: |
194 | 196 |
195 void WindowManagerApp::OnTreeChanged( | 197 void WindowManagerApp::OnTreeChanged( |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 NodeIdToWindowMap::iterator it = node_id_to_window_map_.find(id); | 273 NodeIdToWindowMap::iterator it = node_id_to_window_map_.find(id); |
272 DCHECK(it != node_id_to_window_map_.end()); | 274 DCHECK(it != node_id_to_window_map_.end()); |
273 scoped_ptr<aura::Window> window(it->second); | 275 scoped_ptr<aura::Window> window(it->second); |
274 node_id_to_window_map_.erase(it); | 276 node_id_to_window_map_.erase(it); |
275 Node::Children::const_iterator child = node->children().begin(); | 277 Node::Children::const_iterator child = node->children().begin(); |
276 for (; child != node->children().end(); ++child) | 278 for (; child != node->children().end(); ++child) |
277 UnregisterSubtree((*child)->id()); | 279 UnregisterSubtree((*child)->id()); |
278 } | 280 } |
279 | 281 |
280 } // namespace mojo | 282 } // namespace mojo |
OLD | NEW |