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

Side by Side Diff: services/ui/public/cpp/window_tree_client.cc

Issue 2472983004: Fixs bug in notifying clients about hierarchy changes (Closed)
Patch Set: cleanup Created 4 years, 1 month 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 "services/ui/public/cpp/window_tree_client.h" 5 #include "services/ui/public/cpp/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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 bool WindowTreeClient::ApplyServerChangeToExistingInFlightChange( 466 bool WindowTreeClient::ApplyServerChangeToExistingInFlightChange(
467 const InFlightChange& change) { 467 const InFlightChange& change) {
468 InFlightChange* existing_change = GetOldestInFlightChangeMatching(change); 468 InFlightChange* existing_change = GetOldestInFlightChangeMatching(change);
469 if (!existing_change) 469 if (!existing_change)
470 return false; 470 return false;
471 471
472 existing_change->SetRevertValueFrom(change); 472 existing_change->SetRevertValueFrom(change);
473 return true; 473 return true;
474 } 474 }
475 475
476 Window* WindowTreeClient::BuildWindowTree( 476 void WindowTreeClient::BuildWindowTree(
477 const mojo::Array<mojom::WindowDataPtr>& windows, 477 const mojo::Array<mojom::WindowDataPtr>& windows,
478 Window* initial_parent) { 478 Window* initial_parent) {
479 std::vector<Window*> parents; 479 for (const auto& window_data : windows) {
480 Window* root = nullptr; 480 Window* parent = window_data->parent_id == 0
481 Window* last_window = nullptr; 481 ? nullptr
482 if (initial_parent) 482 : GetWindowByServerId(window_data->parent_id);
483 parents.push_back(initial_parent); 483 Window* existing_window = GetWindowByServerId(window_data->window_id);
484 for (size_t i = 0; i < windows.size(); ++i) { 484 if (!existing_window)
485 if (last_window && windows[i]->parent_id == server_id(last_window)) { 485 AddWindowToClient(this, parent, window_data);
486 parents.push_back(last_window); 486 else if (parent)
487 } else if (!parents.empty()) { 487 WindowPrivate(parent).LocalAddChild(existing_window);
488 while (server_id(parents.back()) != windows[i]->parent_id)
489 parents.pop_back();
490 }
491 Window* window = AddWindowToClient(
492 this, !parents.empty() ? parents.back() : nullptr, windows[i]);
493 if (!last_window)
494 root = window;
495 last_window = window;
496 } 488 }
497 return root;
498 } 489 }
499 490
500 Window* WindowTreeClient::NewWindowImpl( 491 Window* WindowTreeClient::NewWindowImpl(
501 NewWindowType type, 492 NewWindowType type,
502 const Window::SharedProperties* properties) { 493 const Window::SharedProperties* properties) {
503 DCHECK(tree_); 494 DCHECK(tree_);
504 Window* window = 495 Window* window =
505 new Window(this, MakeTransportId(client_id_, next_window_id_++)); 496 new Window(this, MakeTransportId(client_id_, next_window_id_++));
506 if (properties) 497 if (properties)
507 window->properties_ = *properties; 498 window->properties_ = *properties;
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 Window* window, 1429 Window* window,
1439 const gfx::Vector2d& offset, 1430 const gfx::Vector2d& offset,
1440 const gfx::Insets& hit_area) { 1431 const gfx::Insets& hit_area) {
1441 if (window_manager_internal_client_) { 1432 if (window_manager_internal_client_) {
1442 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( 1433 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea(
1443 server_id(window), offset.x(), offset.y(), hit_area); 1434 server_id(window), offset.x(), offset.y(), hit_area);
1444 } 1435 }
1445 } 1436 }
1446 1437
1447 } // namespace ui 1438 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/public/cpp/window_tree_client.h ('k') | services/ui/public/interfaces/window_tree.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698