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

Side by Side Diff: services/ui/ws/window_tree.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/ws/window_tree.h" 5 #include "services/ui/ws/window_tree.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 578
579 client()->OnWindowSharedPropertyChanged(client_window_id.id, String(name), 579 client()->OnWindowSharedPropertyChanged(client_window_id.id, String(name),
580 std::move(data)); 580 std::move(data));
581 } 581 }
582 582
583 void WindowTree::ProcessWindowHierarchyChanged(const ServerWindow* window, 583 void WindowTree::ProcessWindowHierarchyChanged(const ServerWindow* window,
584 const ServerWindow* new_parent, 584 const ServerWindow* new_parent,
585 const ServerWindow* old_parent, 585 const ServerWindow* old_parent,
586 bool originated_change) { 586 bool originated_change) {
587 const bool knows_new = new_parent && IsWindowKnown(new_parent); 587 const bool knows_new = new_parent && IsWindowKnown(new_parent);
588 if (originated_change && !IsWindowKnown(window) && knows_new) {
589 std::vector<const ServerWindow*> unused;
590 GetUnknownWindowsFrom(window, &unused);
591 }
592 if (originated_change || (window_server_->current_operation_type() == 588 if (originated_change || (window_server_->current_operation_type() ==
593 OperationType::DELETE_WINDOW) || 589 OperationType::DELETE_WINDOW) ||
594 (window_server_->current_operation_type() == OperationType::EMBED) || 590 (window_server_->current_operation_type() == OperationType::EMBED) ||
595 window_server_->DidTreeMessageClient(id_)) { 591 window_server_->DidTreeMessageClient(id_)) {
596 return; 592 return;
597 } 593 }
598 594
599 if (!access_policy_->ShouldNotifyOnHierarchyChange(window, &new_parent, 595 if (!access_policy_->ShouldNotifyOnHierarchyChange(window, &new_parent,
600 &old_parent)) { 596 &old_parent)) {
601 return; 597 return;
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 DCHECK(window); 888 DCHECK(window);
893 DCHECK_EQ(window->id().client_id, id_); 889 DCHECK_EQ(window->id().client_id, id_);
894 Operation op(source, window_server_, OperationType::DELETE_WINDOW); 890 Operation op(source, window_server_, OperationType::DELETE_WINDOW);
895 delete window; 891 delete window;
896 return true; 892 return true;
897 } 893 }
898 894
899 void WindowTree::GetUnknownWindowsFrom( 895 void WindowTree::GetUnknownWindowsFrom(
900 const ServerWindow* window, 896 const ServerWindow* window,
901 std::vector<const ServerWindow*>* windows) { 897 std::vector<const ServerWindow*>* windows) {
902 if (IsWindowKnown(window) || !access_policy_->CanGetWindowTree(window)) 898 if (!access_policy_->CanGetWindowTree(window))
903 return; 899 return;
900
901 // This function is called in the context of a hierarchy change when the
902 // parent wasn't known. We need to tell the client about the window so that
903 // it can set the parent correctly.
904 windows->push_back(window); 904 windows->push_back(window);
905 if (IsWindowKnown(window))
906 return;
907
905 // There are two cases where this gets hit: 908 // There are two cases where this gets hit:
906 // . During init, in which case using the window id as the client id is 909 // . During init, in which case using the window id as the client id is
907 // fine. 910 // fine.
908 // . When a window is moved to a parent of a window we know about. This is 911 // . When a window is moved to a parent of a window we know about. This is
909 // only encountered for the WM or embed roots. We assume such clients want 912 // only encountered for the WM or embed roots. We assume such clients want
910 // to see the real id of the window and are only created ClientWindowIds 913 // to see the real id of the window and are only created ClientWindowIds
911 // with the client_id. 914 // with the client_id.
912 const ClientWindowId client_window_id(WindowIdToTransportId(window->id())); 915 const ClientWindowId client_window_id(WindowIdToTransportId(window->id()));
913 DCHECK_EQ(0u, client_id_to_window_id_map_.count(client_window_id)); 916 DCHECK_EQ(0u, client_id_to_window_id_map_.count(client_window_id));
914 client_id_to_window_id_map_[client_window_id] = window->id(); 917 client_id_to_window_id_map_[client_window_id] = window->id();
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, 1950 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset,
1948 effect_bitmask, callback); 1951 effect_bitmask, callback);
1949 } 1952 }
1950 1953
1951 void WindowTree::PerformOnDragDropDone() { 1954 void WindowTree::PerformOnDragDropDone() {
1952 client()->OnDragDropDone(); 1955 client()->OnDragDropDone();
1953 } 1956 }
1954 1957
1955 } // namespace ws 1958 } // namespace ws
1956 } // namespace ui 1959 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/public/interfaces/window_tree.mojom ('k') | services/ui/ws/window_tree_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698