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

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

Issue 1864113002: Fixes problems with drawn state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: parentdrawn and merge Created 4 years, 8 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/test_utils.cc ('k') | components/mus/ws/window_tree_client_unittest.cc » ('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/window_tree.h" 5 #include "components/mus/ws/window_tree.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 void WindowTree::Init(scoped_ptr<WindowTreeBinding> binding, 87 void WindowTree::Init(scoped_ptr<WindowTreeBinding> binding,
88 mojom::WindowTreePtr tree) { 88 mojom::WindowTreePtr tree) {
89 DCHECK(!binding_); 89 DCHECK(!binding_);
90 binding_ = std::move(binding); 90 binding_ = std::move(binding);
91 91
92 if (roots_.empty()) 92 if (roots_.empty())
93 return; 93 return;
94 94
95 std::vector<const ServerWindow*> to_send; 95 std::vector<const ServerWindow*> to_send;
96 CHECK_EQ(1u, roots_.size()); 96 CHECK_EQ(1u, roots_.size());
97 GetUnknownWindowsFrom(*roots_.begin(), &to_send); 97 const ServerWindow* root = *roots_.begin();
98 GetUnknownWindowsFrom(root, &to_send);
98 99
99 Display* display = GetDisplay(*roots_.begin()); 100 Display* display = GetDisplay(root);
100 const ServerWindow* focused_window = 101 const ServerWindow* focused_window =
101 display ? display->GetFocusedWindow() : nullptr; 102 display ? display->GetFocusedWindow() : nullptr;
102 if (focused_window) 103 if (focused_window)
103 focused_window = access_policy_->GetWindowForFocusChange(focused_window); 104 focused_window = access_policy_->GetWindowForFocusChange(focused_window);
104 ClientWindowId focused_window_id; 105 ClientWindowId focused_window_id;
105 if (focused_window) 106 if (focused_window)
106 IsWindowKnown(focused_window, &focused_window_id); 107 IsWindowKnown(focused_window, &focused_window_id);
107 108
109 const bool drawn = root->parent() && root->parent()->IsDrawn();
108 client()->OnEmbed(id_, WindowToWindowData(to_send.front()), std::move(tree), 110 client()->OnEmbed(id_, WindowToWindowData(to_send.front()), std::move(tree),
109 focused_window_id.id); 111 focused_window_id.id, drawn);
110 } 112 }
111 113
112 void WindowTree::ConfigureWindowManager() { 114 void WindowTree::ConfigureWindowManager() {
113 DCHECK(!window_manager_internal_); 115 DCHECK(!window_manager_internal_);
114 window_manager_internal_ = binding_->GetWindowManager(); 116 window_manager_internal_ = binding_->GetWindowManager();
115 } 117 }
116 118
117 const ServerWindow* WindowTree::GetWindow(const WindowId& id) const { 119 const ServerWindow* WindowTree::GetWindow(const WindowId& id) const {
118 if (id_ == id.connection_id) { 120 if (id_ == id.connection_id) {
119 auto iter = created_window_map_.find(id); 121 auto iter = created_window_map_.find(id);
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 std::move(waiting_for_top_level_window_info_)); 335 std::move(waiting_for_top_level_window_info_));
334 binding_->SetIncomingMethodCallProcessingPaused(false); 336 binding_->SetIncomingMethodCallProcessingPaused(false);
335 // We were paused, so the id should still be valid. 337 // We were paused, so the id should still be valid.
336 DCHECK(IsValidIdForNewWindow( 338 DCHECK(IsValidIdForNewWindow(
337 waiting_for_top_level_window_info->client_window_id)); 339 waiting_for_top_level_window_info->client_window_id));
338 client_id_to_window_id_map_[waiting_for_top_level_window_info 340 client_id_to_window_id_map_[waiting_for_top_level_window_info
339 ->client_window_id] = window->id(); 341 ->client_window_id] = window->id();
340 window_id_to_client_id_map_[window->id()] = 342 window_id_to_client_id_map_[window->id()] =
341 waiting_for_top_level_window_info->client_window_id; 343 waiting_for_top_level_window_info->client_window_id;
342 roots_.insert(window); 344 roots_.insert(window);
343 client()->OnTopLevelCreated(client_change_id, WindowToWindowData(window)); 345 const bool drawn = window->parent() && window->parent()->IsDrawn();
346 client()->OnTopLevelCreated(client_change_id, WindowToWindowData(window),
347 drawn);
344 } 348 }
345 349
346 void WindowTree::OnChangeCompleted(uint32_t change_id, bool success) { 350 void WindowTree::OnChangeCompleted(uint32_t change_id, bool success) {
347 client()->OnChangeCompleted(change_id, success); 351 client()->OnChangeCompleted(change_id, success);
348 } 352 }
349 353
350 void WindowTree::OnAccelerator(uint32_t accelerator_id, 354 void WindowTree::OnAccelerator(uint32_t accelerator_id,
351 const ui::Event& event) { 355 const ui::Event& event) {
352 DCHECK(window_manager_internal_); 356 DCHECK(window_manager_internal_);
353 window_manager_internal_->OnAccelerator(accelerator_id, 357 window_manager_internal_->OnAccelerator(accelerator_id,
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 parent = nullptr; 814 parent = nullptr;
811 mojom::WindowDataPtr window_data(mojom::WindowData::New()); 815 mojom::WindowDataPtr window_data(mojom::WindowData::New());
812 window_data->parent_id = 816 window_data->parent_id =
813 parent ? ClientWindowIdForWindow(parent).id : ClientWindowId().id; 817 parent ? ClientWindowIdForWindow(parent).id : ClientWindowId().id;
814 window_data->window_id = 818 window_data->window_id =
815 window ? ClientWindowIdForWindow(window).id : ClientWindowId().id; 819 window ? ClientWindowIdForWindow(window).id : ClientWindowId().id;
816 window_data->bounds = Rect::From(window->bounds()); 820 window_data->bounds = Rect::From(window->bounds());
817 window_data->properties = 821 window_data->properties =
818 mojo::Map<String, Array<uint8_t>>::From(window->properties()); 822 mojo::Map<String, Array<uint8_t>>::From(window->properties());
819 window_data->visible = window->visible(); 823 window_data->visible = window->visible();
820 window_data->drawn = window->IsDrawn();
821 window_data->viewport_metrics = 824 window_data->viewport_metrics =
822 window_server_->GetViewportMetricsForWindow(window); 825 window_server_->GetViewportMetricsForWindow(window);
823 return window_data; 826 return window_data;
824 } 827 }
825 828
826 void WindowTree::GetWindowTreeImpl( 829 void WindowTree::GetWindowTreeImpl(
827 const ServerWindow* window, 830 const ServerWindow* window,
828 std::vector<const ServerWindow*>* windows) const { 831 std::vector<const ServerWindow*>* windows) const {
829 DCHECK(window); 832 DCHECK(window);
830 833
(...skipping 12 matching lines...) Expand all
843 846
844 void WindowTree::NotifyDrawnStateChanged(const ServerWindow* window, 847 void WindowTree::NotifyDrawnStateChanged(const ServerWindow* window,
845 bool new_drawn_value) { 848 bool new_drawn_value) {
846 // Even though we don't know about window, it may be an ancestor of our root, 849 // Even though we don't know about window, it may be an ancestor of our root,
847 // in which case the change may effect our roots drawn state. 850 // in which case the change may effect our roots drawn state.
848 if (roots_.empty()) 851 if (roots_.empty())
849 return; 852 return;
850 853
851 for (auto* root : roots_) { 854 for (auto* root : roots_) {
852 if (window->Contains(root) && (new_drawn_value != root->IsDrawn())) { 855 if (window->Contains(root) && (new_drawn_value != root->IsDrawn())) {
853 client()->OnWindowDrawnStateChanged(ClientWindowIdForWindow(root).id, 856 client()->OnWindowParentDrawnStateChanged(
854 new_drawn_value); 857 ClientWindowIdForWindow(root).id, new_drawn_value);
855 } 858 }
856 } 859 }
857 } 860 }
858 861
859 void WindowTree::DestroyWindows() { 862 void WindowTree::DestroyWindows() {
860 if (created_window_map_.empty()) 863 if (created_window_map_.empty())
861 return; 864 return;
862 865
863 Operation op(this, window_server_, OperationType::DELETE_WINDOW); 866 Operation op(this, window_server_, OperationType::DELETE_WINDOW);
864 // If we get here from the destructor we're not going to get 867 // If we get here from the destructor we're not going to get
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 } 1373 }
1371 1374
1372 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( 1375 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy(
1373 const ServerWindow* window) const { 1376 const ServerWindow* window) const {
1374 WindowTree* tree = window_server_->GetTreeWithRoot(window); 1377 WindowTree* tree = window_server_->GetTreeWithRoot(window);
1375 return tree && tree != this; 1378 return tree && tree != this;
1376 } 1379 }
1377 1380
1378 } // namespace ws 1381 } // namespace ws
1379 } // namespace mus 1382 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/test_utils.cc ('k') | components/mus/ws/window_tree_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698