Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: components/mus/ws/connection_manager.cc

Issue 1764483003: Changes ownership of ClientConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/mus/ws/connection_manager.h ('k') | components/mus/ws/connection_manager_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/mus/ws/connection_manager.h" 5 #include "components/mus/ws/connection_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "components/mus/ws/client_connection.h" 9 #include "components/mus/ws/client_connection.h"
10 #include "components/mus/ws/connection_manager_delegate.h" 10 #include "components/mus/ws/connection_manager_delegate.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 while (!pending_hosts_.empty()) 43 while (!pending_hosts_.empty())
44 DestroyHost(*pending_hosts_.begin()); 44 DestroyHost(*pending_hosts_.begin());
45 DCHECK(pending_hosts_.empty()); 45 DCHECK(pending_hosts_.empty());
46 46
47 // DestroyHost() removes from |hosts_| and deletes the WindowTreeHostImpl. 47 // DestroyHost() removes from |hosts_| and deletes the WindowTreeHostImpl.
48 while (!hosts_.empty()) 48 while (!hosts_.empty())
49 DestroyHost(*hosts_.begin()); 49 DestroyHost(*hosts_.begin());
50 DCHECK(hosts_.empty()); 50 DCHECK(hosts_.empty());
51 51
52 STLDeleteValues(&connection_map_); 52 tree_map_.clear();
53 // All the connections should have been destroyed.
54 DCHECK(connection_map_.empty());
55 } 53 }
56 54
57 void ConnectionManager::AddHost(WindowTreeHostImpl* host) { 55 void ConnectionManager::AddHost(WindowTreeHostImpl* host) {
58 DCHECK_EQ(0u, pending_hosts_.count(host)); 56 DCHECK_EQ(0u, pending_hosts_.count(host));
59 pending_hosts_.insert(host); 57 pending_hosts_.insert(host);
60 } 58 }
61 59
62 void ConnectionManager::DestroyHost(WindowTreeHostImpl* host) { 60 void ConnectionManager::DestroyHost(WindowTreeHostImpl* host) {
63 for (auto& pair : connection_map_) 61 for (auto& pair : tree_map_)
64 pair.second->service()->OnWillDestroyWindowTreeHost(host); 62 pair.second->OnWillDestroyWindowTreeHost(host);
65 63
66 if (pending_hosts_.count(host)) { 64 if (pending_hosts_.count(host)) {
67 pending_hosts_.erase(host); 65 pending_hosts_.erase(host);
68 } else { 66 } else {
69 DCHECK(hosts_.count(host)); 67 DCHECK(hosts_.count(host));
70 hosts_.erase(host); 68 hosts_.erase(host);
71 } 69 }
72 delete host; 70 delete host;
73 71
74 // If we have no more roots left, let the app know so it can terminate. 72 // If we have no more roots left, let the app know so it can terminate.
(...skipping 14 matching lines...) Expand all
89 DCHECK_LT(id, next_connection_id_); 87 DCHECK_LT(id, next_connection_id_);
90 return id; 88 return id;
91 } 89 }
92 90
93 uint16_t ConnectionManager::GetAndAdvanceNextHostId() { 91 uint16_t ConnectionManager::GetAndAdvanceNextHostId() {
94 const uint16_t id = next_host_id_++; 92 const uint16_t id = next_host_id_++;
95 DCHECK_LT(id, next_host_id_); 93 DCHECK_LT(id, next_host_id_);
96 return id; 94 return id;
97 } 95 }
98 96
99 void ConnectionManager::OnConnectionError(ClientConnection* connection) { 97 WindowTreeImpl* ConnectionManager::EmbedAtWindow(
100 for (auto* root : connection->service()->roots()) { 98 ServerWindow* root,
101 // If the WindowTree root is a viewport root, then we'll wait until 99 uint32_t policy_bitmask,
102 // the root connection goes away to cleanup. 100 mojom::WindowTreeClientPtr client) {
103 if (GetRootWindow(root) == root) 101 scoped_ptr<WindowTreeImpl> tree_ptr(
104 return; 102 new ws::WindowTreeImpl(this, root, policy_bitmask));
103 WindowTreeImpl* tree = tree_ptr.get();
104
105 mojom::WindowTreePtr window_tree_ptr;
106 scoped_ptr<ClientConnection> client_connection =
107 delegate_->CreateClientConnectionForEmbedAtWindow(
108 this, tree, GetProxy(&window_tree_ptr), std::move(client));
109
110 AddTree(std::move(tree_ptr), std::move(client_connection),
111 std::move(window_tree_ptr));
112 OnConnectionMessagedClient(tree->id());
113 return tree;
114 }
115
116 WindowTreeImpl* ConnectionManager::AddTree(
117 scoped_ptr<WindowTreeImpl> tree_impl_ptr,
118 scoped_ptr<ClientConnection> connection,
119 mojom::WindowTreePtr tree_ptr) {
120 CHECK_EQ(0u, tree_map_.count(tree_impl_ptr->id()));
121 WindowTreeImpl* tree = tree_impl_ptr.get();
122 tree_map_[tree->id()] = std::move(tree_impl_ptr);
123 tree->Init(std::move(connection), std::move(tree_ptr));
124 return tree;
125 }
126
127 WindowTreeImpl* ConnectionManager::CreateTreeForWindowManager(
128 WindowTreeHostImpl* host,
129 mojom::WindowManagerFactory* factory,
130 ServerWindow* root) {
131 mojom::DisplayPtr display = DisplayForHost(host);
132 mojom::WindowTreeClientPtr tree_client;
133 factory->CreateWindowManager(std::move(display), GetProxy(&tree_client));
134 scoped_ptr<ws::WindowTreeImpl> tree_ptr(new ws::WindowTreeImpl(
135 this, root, mojom::WindowTree::kAccessPolicyEmbedRoot));
136 ws::WindowTreeImpl* tree = tree_ptr.get();
137 scoped_ptr<ws::DefaultClientConnection> connection(
138 new ws::DefaultClientConnection(tree_ptr.get(), this,
139 std::move(tree_client)));
140 mojom::WindowTreePtr window_tree_ptr =
141 connection->CreateInterfacePtrAndBind();
142 AddTree(std::move(tree_ptr), std::move(connection),
143 std::move(window_tree_ptr));
144 tree->ConfigureWindowManager();
145 return tree;
146 }
147
148 void ConnectionManager::DestroyTree(WindowTreeImpl* tree) {
149 scoped_ptr<WindowTreeImpl> tree_ptr;
150 {
151 auto iter = tree_map_.find(tree->id());
152 DCHECK(iter != tree_map_.end());
153 tree_ptr = std::move(iter->second);
154 tree_map_.erase(iter);
105 } 155 }
106 156
107 scoped_ptr<ClientConnection> connection_owner(connection);
108
109 connection_map_.erase(connection->service()->id());
110
111 // Notify remaining connections so that they can cleanup. 157 // Notify remaining connections so that they can cleanup.
112 for (auto& pair : connection_map_) 158 for (auto& pair : tree_map_)
113 pair.second->service()->OnWindowDestroyingTreeImpl(connection->service()); 159 pair.second->OnWindowDestroyingTreeImpl(tree);
114 160
115 // Notify the hosts, taking care to only notify each host once. 161 // Notify the hosts, taking care to only notify each host once.
116 std::set<WindowTreeHostImpl*> hosts_notified; 162 std::set<WindowTreeHostImpl*> hosts_notified;
117 for (auto* root : connection->service()->roots()) { 163 for (auto* root : tree->roots()) {
118 WindowTreeHostImpl* host = GetWindowTreeHostByWindow(root); 164 WindowTreeHostImpl* host = GetWindowTreeHostByWindow(root);
119 if (host && hosts_notified.count(host) == 0) { 165 if (host && hosts_notified.count(host) == 0) {
120 host->OnWindowTreeConnectionError(connection->service()); 166 host->OnWindowTreeConnectionError(tree);
121 hosts_notified.insert(host); 167 hosts_notified.insert(host);
122 } 168 }
123 } 169 }
124 170
125 // Remove any requests from the client that resulted in a call to the window 171 // Remove any requests from the client that resulted in a call to the window
126 // manager and we haven't gotten a response back yet. 172 // manager and we haven't gotten a response back yet.
127 std::set<uint32_t> to_remove; 173 std::set<uint32_t> to_remove;
128 for (auto& pair : in_flight_wm_change_map_) { 174 for (auto& pair : in_flight_wm_change_map_) {
129 if (pair.second.connection_id == connection->service()->id()) 175 if (pair.second.connection_id == tree->id())
130 to_remove.insert(pair.first); 176 to_remove.insert(pair.first);
131 } 177 }
132 for (uint32_t id : to_remove) 178 for (uint32_t id : to_remove)
133 in_flight_wm_change_map_.erase(id); 179 in_flight_wm_change_map_.erase(id);
134 } 180 }
135 181
136 ClientConnection* ConnectionManager::GetClientConnection(
137 WindowTreeImpl* window_tree) {
138 return connection_map_[window_tree->id()];
139 }
140
141 WindowTreeImpl* ConnectionManager::EmbedAtWindow(
142 ServerWindow* root,
143 uint32_t policy_bitmask,
144 mojom::WindowTreeClientPtr client) {
145 mojom::WindowTreePtr tree_ptr;
146 ClientConnection* client_connection =
147 delegate_->CreateClientConnectionForEmbedAtWindow(
148 this, GetProxy(&tree_ptr), root, policy_bitmask, std::move(client));
149 AddConnection(make_scoped_ptr(client_connection), std::move(tree_ptr));
150 OnConnectionMessagedClient(client_connection->service()->id());
151 return client_connection->service();
152 }
153
154 void ConnectionManager::AddConnection(
155 scoped_ptr<ClientConnection> owned_connection,
156 mojom::WindowTreePtr tree_ptr) {
157 ClientConnection* connection = owned_connection.release();
158 CHECK_EQ(0u, connection_map_.count(connection->service()->id()));
159 connection_map_[connection->service()->id()] = connection;
160 connection->service()->Init(connection->client(), std::move(tree_ptr));
161 }
162
163 WindowTreeImpl* ConnectionManager::GetConnection( 182 WindowTreeImpl* ConnectionManager::GetConnection(
164 ConnectionSpecificId connection_id) { 183 ConnectionSpecificId connection_id) {
165 ConnectionMap::iterator i = connection_map_.find(connection_id); 184 auto iter = tree_map_.find(connection_id);
166 return i == connection_map_.end() ? nullptr : i->second->service(); 185 return iter == tree_map_.end() ? nullptr : iter->second.get();
167 } 186 }
168 187
169 ServerWindow* ConnectionManager::GetWindow(const WindowId& id) { 188 ServerWindow* ConnectionManager::GetWindow(const WindowId& id) {
170 // kInvalidConnectionId is used for WindowTreeHost and WindowManager root 189 // kInvalidConnectionId is used for WindowTreeHost and WindowManager root
171 // nodes. 190 // nodes.
172 if (id.connection_id == kInvalidConnectionId) { 191 if (id.connection_id == kInvalidConnectionId) {
173 for (WindowTreeHostImpl* host : hosts_) { 192 for (WindowTreeHostImpl* host : hosts_) {
174 ServerWindow* window = host->GetRootWithId(id); 193 ServerWindow* window = host->GetRootWithId(id);
175 if (window) 194 if (window)
176 return window; 195 return window;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 239
221 mojom::ViewportMetricsPtr metrics = mojom::ViewportMetrics::New(); 240 mojom::ViewportMetricsPtr metrics = mojom::ViewportMetrics::New();
222 metrics->size_in_pixels = mojo::Size::New(); 241 metrics->size_in_pixels = mojo::Size::New();
223 return metrics; 242 return metrics;
224 } 243 }
225 244
226 const WindowTreeImpl* ConnectionManager::GetConnectionWithRoot( 245 const WindowTreeImpl* ConnectionManager::GetConnectionWithRoot(
227 const ServerWindow* window) const { 246 const ServerWindow* window) const {
228 if (!window) 247 if (!window)
229 return nullptr; 248 return nullptr;
230 for (auto& pair : connection_map_) { 249 for (auto& pair : tree_map_) {
231 if (pair.second->service()->HasRoot(window)) 250 if (pair.second->HasRoot(window))
232 return pair.second->service(); 251 return pair.second.get();
233 } 252 }
234 return nullptr; 253 return nullptr;
235 } 254 }
236 255
237 WindowManagerAndHostConst ConnectionManager::GetWindowManagerAndHost( 256 WindowManagerAndHostConst ConnectionManager::GetWindowManagerAndHost(
238 const ServerWindow* window) const { 257 const ServerWindow* window) const {
239 const ServerWindow* last = window; 258 const ServerWindow* last = window;
240 while (window && window->parent()) { 259 while (window && window->parent()) {
241 last = window; 260 last = window;
242 window = window->parent(); 261 window = window->parent();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 ++i; 408 ++i;
390 } 409 }
391 NOTREACHED(); 410 NOTREACHED();
392 return mojom::Display::New(); 411 return mojom::Display::New();
393 } 412 }
394 413
395 void ConnectionManager::ProcessWindowBoundsChanged( 414 void ConnectionManager::ProcessWindowBoundsChanged(
396 const ServerWindow* window, 415 const ServerWindow* window,
397 const gfx::Rect& old_bounds, 416 const gfx::Rect& old_bounds,
398 const gfx::Rect& new_bounds) { 417 const gfx::Rect& new_bounds) {
399 for (auto& pair : connection_map_) { 418 for (auto& pair : tree_map_) {
400 pair.second->service()->ProcessWindowBoundsChanged( 419 pair.second->ProcessWindowBoundsChanged(window, old_bounds, new_bounds,
401 window, old_bounds, new_bounds, IsOperationSource(pair.first)); 420 IsOperationSource(pair.first));
402 } 421 }
403 } 422 }
404 423
405 void ConnectionManager::ProcessClientAreaChanged( 424 void ConnectionManager::ProcessClientAreaChanged(
406 const ServerWindow* window, 425 const ServerWindow* window,
407 const gfx::Insets& new_client_area, 426 const gfx::Insets& new_client_area,
408 const std::vector<gfx::Rect>& new_additional_client_areas) { 427 const std::vector<gfx::Rect>& new_additional_client_areas) {
409 for (auto& pair : connection_map_) { 428 for (auto& pair : tree_map_) {
410 pair.second->service()->ProcessClientAreaChanged( 429 pair.second->ProcessClientAreaChanged(window, new_client_area,
411 window, new_client_area, new_additional_client_areas, 430 new_additional_client_areas,
412 IsOperationSource(pair.first)); 431 IsOperationSource(pair.first));
413 } 432 }
414 } 433 }
415 434
416 void ConnectionManager::ProcessLostCapture(const ServerWindow* window) { 435 void ConnectionManager::ProcessLostCapture(const ServerWindow* window) {
417 for (auto& pair : connection_map_) { 436 for (auto& pair : tree_map_) {
418 pair.second->service()->ProcessLostCapture(window, 437 pair.second->ProcessLostCapture(window, IsOperationSource(pair.first));
419 IsOperationSource(pair.first));
420 } 438 }
421 } 439 }
422 440
423 void ConnectionManager::ProcessWillChangeWindowHierarchy( 441 void ConnectionManager::ProcessWillChangeWindowHierarchy(
424 const ServerWindow* window, 442 const ServerWindow* window,
425 const ServerWindow* new_parent, 443 const ServerWindow* new_parent,
426 const ServerWindow* old_parent) { 444 const ServerWindow* old_parent) {
427 for (auto& pair : connection_map_) { 445 for (auto& pair : tree_map_) {
428 pair.second->service()->ProcessWillChangeWindowHierarchy( 446 pair.second->ProcessWillChangeWindowHierarchy(
429 window, new_parent, old_parent, IsOperationSource(pair.first)); 447 window, new_parent, old_parent, IsOperationSource(pair.first));
430 } 448 }
431 } 449 }
432 450
433 void ConnectionManager::ProcessWindowHierarchyChanged( 451 void ConnectionManager::ProcessWindowHierarchyChanged(
434 const ServerWindow* window, 452 const ServerWindow* window,
435 const ServerWindow* new_parent, 453 const ServerWindow* new_parent,
436 const ServerWindow* old_parent) { 454 const ServerWindow* old_parent) {
437 for (auto& pair : connection_map_) { 455 for (auto& pair : tree_map_) {
438 pair.second->service()->ProcessWindowHierarchyChanged( 456 pair.second->ProcessWindowHierarchyChanged(window, new_parent, old_parent,
439 window, new_parent, old_parent, IsOperationSource(pair.first)); 457 IsOperationSource(pair.first));
440 } 458 }
441 } 459 }
442 460
443 void ConnectionManager::ProcessWindowReorder( 461 void ConnectionManager::ProcessWindowReorder(
444 const ServerWindow* window, 462 const ServerWindow* window,
445 const ServerWindow* relative_window, 463 const ServerWindow* relative_window,
446 const mojom::OrderDirection direction) { 464 const mojom::OrderDirection direction) {
447 // We'll probably do a bit of reshuffling when we add a transient window. 465 // We'll probably do a bit of reshuffling when we add a transient window.
448 if ((current_operation_type() == OperationType::ADD_TRANSIENT_WINDOW) || 466 if ((current_operation_type() == OperationType::ADD_TRANSIENT_WINDOW) ||
449 (current_operation_type() == 467 (current_operation_type() ==
450 OperationType::REMOVE_TRANSIENT_WINDOW_FROM_PARENT)) { 468 OperationType::REMOVE_TRANSIENT_WINDOW_FROM_PARENT)) {
451 return; 469 return;
452 } 470 }
453 for (auto& pair : connection_map_) { 471 for (auto& pair : tree_map_) {
454 pair.second->service()->ProcessWindowReorder( 472 pair.second->ProcessWindowReorder(window, relative_window, direction,
455 window, relative_window, direction, IsOperationSource(pair.first)); 473 IsOperationSource(pair.first));
456 } 474 }
457 } 475 }
458 476
459 void ConnectionManager::ProcessWindowDeleted(const ServerWindow* window) { 477 void ConnectionManager::ProcessWindowDeleted(const ServerWindow* window) {
460 for (auto& pair : connection_map_) { 478 for (auto& pair : tree_map_) {
461 pair.second->service()->ProcessWindowDeleted(window, 479 pair.second->ProcessWindowDeleted(window, IsOperationSource(pair.first));
462 IsOperationSource(pair.first));
463 } 480 }
464 } 481 }
465 482
466 void ConnectionManager::ProcessWillChangeWindowPredefinedCursor( 483 void ConnectionManager::ProcessWillChangeWindowPredefinedCursor(
467 ServerWindow* window, 484 ServerWindow* window,
468 int32_t cursor_id) { 485 int32_t cursor_id) {
469 for (auto& pair : connection_map_) { 486 for (auto& pair : tree_map_) {
470 pair.second->service()->ProcessCursorChanged(window, cursor_id, 487 pair.second->ProcessCursorChanged(window, cursor_id,
471 IsOperationSource(pair.first)); 488 IsOperationSource(pair.first));
472 } 489 }
473 490
474 // Pass the cursor change to the native window. 491 // Pass the cursor change to the native window.
475 WindowTreeHostImpl* host = GetWindowTreeHostByWindow(window); 492 WindowTreeHostImpl* host = GetWindowTreeHostByWindow(window);
476 if (host) 493 if (host)
477 host->OnCursorUpdated(window); 494 host->OnCursorUpdated(window);
478 } 495 }
479 496
480 void ConnectionManager::ProcessViewportMetricsChanged( 497 void ConnectionManager::ProcessViewportMetricsChanged(
481 WindowTreeHostImpl* host, 498 WindowTreeHostImpl* host,
482 const mojom::ViewportMetrics& old_metrics, 499 const mojom::ViewportMetrics& old_metrics,
483 const mojom::ViewportMetrics& new_metrics) { 500 const mojom::ViewportMetrics& new_metrics) {
484 for (auto& pair : connection_map_) { 501 for (auto& pair : tree_map_) {
485 pair.second->service()->ProcessViewportMetricsChanged( 502 pair.second->ProcessViewportMetricsChanged(host, old_metrics, new_metrics,
486 host, old_metrics, new_metrics, IsOperationSource(pair.first)); 503 IsOperationSource(pair.first));
487 } 504 }
488 505
489 if (!got_valid_frame_decorations_) 506 if (!got_valid_frame_decorations_)
490 return; 507 return;
491 } 508 }
492 509
493 void ConnectionManager::ProcessFrameDecorationValuesChanged( 510 void ConnectionManager::ProcessFrameDecorationValuesChanged(
494 WindowTreeHostImpl* host) { 511 WindowTreeHostImpl* host) {
495 if (!got_valid_frame_decorations_) { 512 if (!got_valid_frame_decorations_) {
496 got_valid_frame_decorations_ = true; 513 got_valid_frame_decorations_ = true;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 return; 702 return;
686 703
687 // Need to repaint if the window was drawn (which means it's in the process of 704 // Need to repaint if the window was drawn (which means it's in the process of
688 // hiding) or the window is transitioning to drawn. 705 // hiding) or the window is transitioning to drawn.
689 if (window->parent() && 706 if (window->parent() &&
690 (window->IsDrawn() || 707 (window->IsDrawn() ||
691 (!window->visible() && window->parent()->IsDrawn()))) { 708 (!window->visible() && window->parent()->IsDrawn()))) {
692 SchedulePaint(window->parent(), window->bounds()); 709 SchedulePaint(window->parent(), window->bounds());
693 } 710 }
694 711
695 for (auto& pair : connection_map_) { 712 for (auto& pair : tree_map_) {
696 pair.second->service()->ProcessWillChangeWindowVisibility( 713 pair.second->ProcessWillChangeWindowVisibility(
697 window, IsOperationSource(pair.first)); 714 window, IsOperationSource(pair.first));
698 } 715 }
699 } 716 }
700 717
701 void ConnectionManager::OnWindowPredefinedCursorChanged(ServerWindow* window, 718 void ConnectionManager::OnWindowPredefinedCursorChanged(ServerWindow* window,
702 int32_t cursor_id) { 719 int32_t cursor_id) {
703 if (in_destructor_) 720 if (in_destructor_)
704 return; 721 return;
705 722
706 ProcessWillChangeWindowPredefinedCursor(window, cursor_id); 723 ProcessWillChangeWindowPredefinedCursor(window, cursor_id);
707 } 724 }
708 725
709 void ConnectionManager::OnWindowSharedPropertyChanged( 726 void ConnectionManager::OnWindowSharedPropertyChanged(
710 ServerWindow* window, 727 ServerWindow* window,
711 const std::string& name, 728 const std::string& name,
712 const std::vector<uint8_t>* new_data) { 729 const std::vector<uint8_t>* new_data) {
713 for (auto& pair : connection_map_) { 730 for (auto& pair : tree_map_) {
714 pair.second->service()->ProcessWindowPropertyChanged( 731 pair.second->ProcessWindowPropertyChanged(window, name, new_data,
715 window, name, new_data, IsOperationSource(pair.first)); 732 IsOperationSource(pair.first));
716 } 733 }
717 } 734 }
718 735
719 void ConnectionManager::OnWindowTextInputStateChanged( 736 void ConnectionManager::OnWindowTextInputStateChanged(
720 ServerWindow* window, 737 ServerWindow* window,
721 const ui::TextInputState& state) { 738 const ui::TextInputState& state) {
722 WindowTreeHostImpl* host = GetWindowTreeHostByWindow(window); 739 WindowTreeHostImpl* host = GetWindowTreeHostByWindow(window);
723 host->UpdateTextInputState(window, state); 740 host->UpdateTextInputState(window, state);
724 } 741 }
725 742
726 void ConnectionManager::OnTransientWindowAdded(ServerWindow* window, 743 void ConnectionManager::OnTransientWindowAdded(ServerWindow* window,
727 ServerWindow* transient_child) { 744 ServerWindow* transient_child) {
728 for (auto& pair : connection_map_) { 745 for (auto& pair : tree_map_) {
729 pair.second->service()->ProcessTransientWindowAdded( 746 pair.second->ProcessTransientWindowAdded(window, transient_child,
730 window, transient_child, IsOperationSource(pair.first)); 747 IsOperationSource(pair.first));
731 } 748 }
732 } 749 }
733 750
734 void ConnectionManager::OnTransientWindowRemoved( 751 void ConnectionManager::OnTransientWindowRemoved(
735 ServerWindow* window, 752 ServerWindow* window,
736 ServerWindow* transient_child) { 753 ServerWindow* transient_child) {
737 // If we're deleting a window, then this is a superfluous message. 754 // If we're deleting a window, then this is a superfluous message.
738 if (current_operation_type() == OperationType::DELETE_WINDOW) 755 if (current_operation_type() == OperationType::DELETE_WINDOW)
739 return; 756 return;
740 for (auto& pair : connection_map_) { 757 for (auto& pair : tree_map_) {
741 pair.second->service()->ProcessTransientWindowRemoved( 758 pair.second->ProcessTransientWindowRemoved(window, transient_child,
742 window, transient_child, IsOperationSource(pair.first)); 759 IsOperationSource(pair.first));
743 } 760 }
744 } 761 }
745 762
746 void ConnectionManager::AddObserver(mojom::DisplayManagerObserverPtr observer) { 763 void ConnectionManager::AddObserver(mojom::DisplayManagerObserverPtr observer) {
747 // TODO(sky): this needs to be per user. 764 // TODO(sky): this needs to be per user.
748 765
749 // Many clients key off the frame decorations to size widgets. Wait for frame 766 // Many clients key off the frame decorations to size widgets. Wait for frame
750 // decorations before notifying so that we don't have to worry about clients 767 // decorations before notifying so that we don't have to worry about clients
751 // resizing appropriately. 768 // resizing appropriately.
752 if (!got_valid_frame_decorations_) { 769 if (!got_valid_frame_decorations_) {
753 display_manager_observers_.AddInterfacePtr(std::move(observer)); 770 display_manager_observers_.AddInterfacePtr(std::move(observer));
754 return; 771 return;
755 } 772 }
756 CallOnDisplays(observer.get()); 773 CallOnDisplays(observer.get());
757 display_manager_observers_.AddInterfacePtr(std::move(observer)); 774 display_manager_observers_.AddInterfacePtr(std::move(observer));
758 } 775 }
759 776
760 } // namespace ws 777 } // namespace ws
761 } // namespace mus 778 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/connection_manager.h ('k') | components/mus/ws/connection_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698