OLD | NEW |
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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 display ? display->GetFocusedWindow() : nullptr; | 139 display ? display->GetFocusedWindow() : nullptr; |
140 if (focused_window) | 140 if (focused_window) |
141 focused_window = access_policy_->GetWindowForFocusChange(focused_window); | 141 focused_window = access_policy_->GetWindowForFocusChange(focused_window); |
142 ClientWindowId focused_window_id; | 142 ClientWindowId focused_window_id; |
143 if (focused_window) | 143 if (focused_window) |
144 IsWindowKnown(focused_window, &focused_window_id); | 144 IsWindowKnown(focused_window, &focused_window_id); |
145 | 145 |
146 const bool drawn = root->parent() && root->parent()->IsDrawn(); | 146 const bool drawn = root->parent() && root->parent()->IsDrawn(); |
147 client()->OnEmbed(id_, WindowToWindowData(to_send.front()), std::move(tree), | 147 client()->OnEmbed(id_, WindowToWindowData(to_send.front()), std::move(tree), |
148 display_id, focused_window_id.id, drawn, | 148 display_id, focused_window_id.id, drawn, |
149 root->frame_sink_id(), root->current_local_surface_id()); | 149 root->current_local_surface_id()); |
150 } | 150 } |
151 | 151 |
152 void WindowTree::ConfigureWindowManager( | 152 void WindowTree::ConfigureWindowManager( |
153 bool automatically_create_display_roots) { | 153 bool automatically_create_display_roots) { |
154 // ConfigureWindowManager() should be called early on, before anything | 154 // ConfigureWindowManager() should be called early on, before anything |
155 // else. |waiting_for_top_level_window_info_| must be null as if | 155 // else. |waiting_for_top_level_window_info_| must be null as if |
156 // |waiting_for_top_level_window_info_| is non-null it means we're about to | 156 // |waiting_for_top_level_window_info_| is non-null it means we're about to |
157 // create an associated interface, which doesn't work with pause/resume. | 157 // create an associated interface, which doesn't work with pause/resume. |
158 // TODO(sky): DCHECK temporary until 626869 is sorted out. | 158 // TODO(sky): DCHECK temporary until 626869 is sorted out. |
159 DCHECK(!waiting_for_top_level_window_info_); | 159 DCHECK(!waiting_for_top_level_window_info_); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 DCHECK_EQ(0u, client_id_to_window_id_map_.count(client_window_id)); | 230 DCHECK_EQ(0u, client_id_to_window_id_map_.count(client_window_id)); |
231 client_id_to_window_id_map_[client_window_id] = root->id(); | 231 client_id_to_window_id_map_[client_window_id] = root->id(); |
232 window_id_to_client_id_map_[root->id()] = client_window_id; | 232 window_id_to_client_id_map_[root->id()] = client_window_id; |
233 roots_.insert(root); | 233 roots_.insert(root); |
234 | 234 |
235 Display* ws_display = GetDisplay(root); | 235 Display* ws_display = GetDisplay(root); |
236 DCHECK(ws_display); | 236 DCHECK(ws_display); |
237 | 237 |
238 window_manager_internal_->WmNewDisplayAdded( | 238 window_manager_internal_->WmNewDisplayAdded( |
239 ws_display->GetDisplay(), WindowToWindowData(root), | 239 ws_display->GetDisplay(), WindowToWindowData(root), |
240 root->parent()->IsDrawn(), root->frame_sink_id(), | 240 root->parent()->IsDrawn(), root->current_local_surface_id()); |
241 root->current_local_surface_id()); | |
242 } | 241 } |
243 | 242 |
244 void WindowTree::OnWindowDestroyingTreeImpl(WindowTree* tree) { | 243 void WindowTree::OnWindowDestroyingTreeImpl(WindowTree* tree) { |
245 if (event_source_wms_ && event_source_wms_->window_tree() == tree) | 244 if (event_source_wms_ && event_source_wms_->window_tree() == tree) |
246 event_source_wms_ = nullptr; | 245 event_source_wms_ = nullptr; |
247 | 246 |
248 // Notify our client if |tree| was embedded in any of our windows. | 247 // Notify our client if |tree| was embedded in any of our windows. |
249 for (const auto* tree_root : tree->roots_) { | 248 for (const auto* tree_root : tree->roots_) { |
250 const bool owns_tree_root = tree_root->id().client_id == id_; | 249 const bool owns_tree_root = tree_root->id().client_id == id_; |
251 if (owns_tree_root) { | 250 if (owns_tree_root) { |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 } | 654 } |
656 client_id_to_window_id_map_[waiting_for_top_level_window_info | 655 client_id_to_window_id_map_[waiting_for_top_level_window_info |
657 ->client_window_id] = window->id(); | 656 ->client_window_id] = window->id(); |
658 window_id_to_client_id_map_[window->id()] = | 657 window_id_to_client_id_map_[window->id()] = |
659 waiting_for_top_level_window_info->client_window_id; | 658 waiting_for_top_level_window_info->client_window_id; |
660 roots_.insert(window); | 659 roots_.insert(window); |
661 Display* display = GetDisplay(window); | 660 Display* display = GetDisplay(window); |
662 int64_t display_id = display ? display->GetId() : display::kInvalidDisplayId; | 661 int64_t display_id = display ? display->GetId() : display::kInvalidDisplayId; |
663 const bool drawn = window->parent() && window->parent()->IsDrawn(); | 662 const bool drawn = window->parent() && window->parent()->IsDrawn(); |
664 client()->OnTopLevelCreated(client_change_id, WindowToWindowData(window), | 663 client()->OnTopLevelCreated(client_change_id, WindowToWindowData(window), |
665 display_id, drawn, window->frame_sink_id(), | 664 display_id, drawn, |
666 window->current_local_surface_id()); | 665 window->current_local_surface_id()); |
667 } | 666 } |
668 | 667 |
669 void WindowTree::AddActivationParent(const ClientWindowId& window_id) { | 668 void WindowTree::AddActivationParent(const ClientWindowId& window_id) { |
670 ServerWindow* window = GetWindowByClientId(window_id); | 669 ServerWindow* window = GetWindowByClientId(window_id); |
671 if (window) { | 670 if (window) { |
672 Display* display = GetDisplay(window); | 671 Display* display = GetDisplay(window); |
673 if (display) { | 672 if (display) { |
674 display->AddActivationParent(window); | 673 display->AddActivationParent(window); |
675 } else { | 674 } else { |
(...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2227 | 2226 |
2228 void WindowTree::SetDisplayRoot(const display::Display& display, | 2227 void WindowTree::SetDisplayRoot(const display::Display& display, |
2229 mojom::WmViewportMetricsPtr viewport_metrics, | 2228 mojom::WmViewportMetricsPtr viewport_metrics, |
2230 bool is_primary_display, | 2229 bool is_primary_display, |
2231 Id window_id, | 2230 Id window_id, |
2232 const SetDisplayRootCallback& callback) { | 2231 const SetDisplayRootCallback& callback) { |
2233 ServerWindow* display_root = | 2232 ServerWindow* display_root = |
2234 ProcessSetDisplayRoot(display, *viewport_metrics, is_primary_display, | 2233 ProcessSetDisplayRoot(display, *viewport_metrics, is_primary_display, |
2235 ClientWindowId(window_id)); | 2234 ClientWindowId(window_id)); |
2236 if (!display_root) { | 2235 if (!display_root) { |
2237 callback.Run(base::Optional<cc::FrameSinkId>()); | 2236 callback.Run(false); |
2238 return; | 2237 return; |
2239 } | 2238 } |
2240 display_root->parent()->SetVisible(true); | 2239 display_root->parent()->SetVisible(true); |
2241 callback.Run(display_root->frame_sink_id()); | 2240 callback.Run(true); |
2242 } | 2241 } |
2243 | 2242 |
2244 void WindowTree::WmResponse(uint32_t change_id, bool response) { | 2243 void WindowTree::WmResponse(uint32_t change_id, bool response) { |
2245 if (window_server_->in_move_loop() && | 2244 if (window_server_->in_move_loop() && |
2246 window_server_->GetCurrentMoveLoopChangeId() == change_id) { | 2245 window_server_->GetCurrentMoveLoopChangeId() == change_id) { |
2247 ServerWindow* window = window_server_->GetCurrentMoveLoopWindow(); | 2246 ServerWindow* window = window_server_->GetCurrentMoveLoopWindow(); |
2248 | 2247 |
2249 if (window->id().client_id != id_) { | 2248 if (window->id().client_id != id_) { |
2250 window_server_->WindowManagerSentBogusMessage(); | 2249 window_server_->WindowManagerSentBogusMessage(); |
2251 window = nullptr; | 2250 window = nullptr; |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2504 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, | 2503 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, |
2505 effect_bitmask, callback); | 2504 effect_bitmask, callback); |
2506 } | 2505 } |
2507 | 2506 |
2508 void WindowTree::PerformOnDragDropDone() { | 2507 void WindowTree::PerformOnDragDropDone() { |
2509 client()->OnDragDropDone(); | 2508 client()->OnDragDropDone(); |
2510 } | 2509 } |
2511 | 2510 |
2512 } // namespace ws | 2511 } // namespace ws |
2513 } // namespace ui | 2512 } // namespace ui |
OLD | NEW |