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

Side by Side Diff: ui/aura/mus/window_tree_client.cc

Issue 2559703003: Converts WindowTreeClientTest to be in terms of aura (Closed)
Patch Set: tweak Created 4 years 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
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 "ui/aura/mus/window_tree_client.h" 5 #include "ui/aura/mus/window_tree_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 DCHECK(tree_); 257 DCHECK(tree_);
258 tree_->SetImeVisibility(window->server_id(), visible, std::move(state)); 258 tree_->SetImeVisibility(window->server_id(), visible, std::move(state));
259 } 259 }
260 260
261 void WindowTreeClient::Embed( 261 void WindowTreeClient::Embed(
262 Window* window, 262 Window* window,
263 ui::mojom::WindowTreeClientPtr client, 263 ui::mojom::WindowTreeClientPtr client,
264 uint32_t flags, 264 uint32_t flags,
265 const ui::mojom::WindowTree::EmbedCallback& callback) { 265 const ui::mojom::WindowTree::EmbedCallback& callback) {
266 DCHECK(tree_); 266 DCHECK(tree_);
267 if (!window->children().empty()) {
msw 2016/12/08 01:20:12 nit: add a comment, explaining why only one child
sky 2016/12/08 04:59:45 You mean no children I believe. I added a comment.
268 callback.Run(false);
269 return;
270 }
271
267 tree_->Embed(WindowMus::Get(window)->server_id(), std::move(client), flags, 272 tree_->Embed(WindowMus::Get(window)->server_id(), std::move(client), flags,
268 callback); 273 callback);
269 } 274 }
270 275
271 void WindowTreeClient::AttachCompositorFrameSink( 276 void WindowTreeClient::AttachCompositorFrameSink(
272 Id window_id, 277 Id window_id,
273 ui::mojom::CompositorFrameSinkType type, 278 ui::mojom::CompositorFrameSinkType type,
274 cc::mojom::MojoCompositorFrameSinkRequest compositor_frame_sink, 279 cc::mojom::MojoCompositorFrameSinkRequest compositor_frame_sink,
275 cc::mojom::MojoCompositorFrameSinkClientPtr client) { 280 cc::mojom::MojoCompositorFrameSinkClientPtr client) {
276 DCHECK(tree_); 281 DCHECK(tree_);
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 593
589 // Remove any InFlightChanges associated with the window. 594 // Remove any InFlightChanges associated with the window.
590 std::set<uint32_t> in_flight_change_ids_to_remove; 595 std::set<uint32_t> in_flight_change_ids_to_remove;
591 for (const auto& pair : in_flight_map_) { 596 for (const auto& pair : in_flight_map_) {
592 if (pair.second->window() == window) 597 if (pair.second->window() == window)
593 in_flight_change_ids_to_remove.insert(pair.first); 598 in_flight_change_ids_to_remove.insert(pair.first);
594 } 599 }
595 for (auto change_id : in_flight_change_ids_to_remove) 600 for (auto change_id : in_flight_change_ids_to_remove)
596 in_flight_map_.erase(change_id); 601 in_flight_map_.erase(change_id);
597 602
598 const bool was_root = roots_.erase(window) > 0; 603 roots_.erase(window);
599 if (!in_destructor_ && was_root && roots_.empty() && is_from_embed_)
600 delegate_->OnEmbedRootDestroyed(window->GetWindow());
601 } 604 }
602 605
603 void WindowTreeClient::OnWindowMusBoundsChanged(WindowMus* window, 606 void WindowTreeClient::OnWindowMusBoundsChanged(WindowMus* window,
604 const gfx::Rect& old_bounds, 607 const gfx::Rect& old_bounds,
605 const gfx::Rect& new_bounds) { 608 const gfx::Rect& new_bounds) {
606 // Changes to bounds of root windows are routed through 609 // Changes to bounds of root windows are routed through
607 // OnWindowTreeHostBoundsWillChange(). Any bounds that happen here are a side 610 // OnWindowTreeHostBoundsWillChange(). Any bounds that happen here are a side
608 // effect of those and can be ignored. 611 // effect of those and can be ignored.
609 if (IsRoot(window)) 612 if (IsRoot(window))
610 return; 613 return;
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 WindowMus* relative_window = GetWindowByServerId(relative_window_id); 997 WindowMus* relative_window = GetWindowByServerId(relative_window_id);
995 WindowMus* parent = WindowMus::Get(window->GetWindow()->parent()); 998 WindowMus* parent = WindowMus::Get(window->GetWindow()->parent());
996 if (window && relative_window && parent && 999 if (window && relative_window && parent &&
997 parent == WindowMus::Get(relative_window->GetWindow()->parent())) { 1000 parent == WindowMus::Get(relative_window->GetWindow()->parent())) {
998 parent->ReorderFromServer(window, relative_window, direction); 1001 parent->ReorderFromServer(window, relative_window, direction);
999 } 1002 }
1000 } 1003 }
1001 1004
1002 void WindowTreeClient::OnWindowDeleted(Id window_id) { 1005 void WindowTreeClient::OnWindowDeleted(Id window_id) {
1003 WindowMus* window = GetWindowByServerId(window_id); 1006 WindowMus* window = GetWindowByServerId(window_id);
1004 if (window) 1007 if (!window)
1008 return;
1009
1010 if (roots_.count(window)) {
msw 2016/12/08 01:20:12 nit: add a comment explaining the two paths here
sky 2016/12/08 04:59:45 Done.
1011 window->PrepareForDestroy();
1012 delegate_->OnEmbedRootDestroyed(GetWindowTreeHostMus(window));
1013 } else {
1005 window->DestroyFromServer(); 1014 window->DestroyFromServer();
1015 }
1006 } 1016 }
1007 1017
1008 void WindowTreeClient::OnWindowVisibilityChanged(Id window_id, bool visible) { 1018 void WindowTreeClient::OnWindowVisibilityChanged(Id window_id, bool visible) {
1009 WindowMus* window = GetWindowByServerId(window_id); 1019 WindowMus* window = GetWindowByServerId(window_id);
1010 if (!window) 1020 if (!window)
1011 return; 1021 return;
1012 1022
1013 InFlightVisibleChange new_change(this, window, visible); 1023 InFlightVisibleChange new_change(this, window, visible);
1014 if (ApplyServerChangeToExistingInFlightChange(new_change)) 1024 if (ApplyServerChangeToExistingInFlightChange(new_change))
1015 return; 1025 return;
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1621 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( 1631 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>(
1622 this, capture_synchronizer_.get(), window)); 1632 this, capture_synchronizer_.get(), window));
1623 } 1633 }
1624 1634
1625 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { 1635 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) {
1626 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( 1636 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>(
1627 this, focus_synchronizer_.get(), window)); 1637 this, focus_synchronizer_.get(), window));
1628 } 1638 }
1629 1639
1630 } // namespace aura 1640 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698