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

Side by Side Diff: components/mus/public/cpp/lib/window_tree_client_impl.cc

Issue 1605773004: mus: Implement Window Server Capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Original Review Comments Created 4 years, 11 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
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/public/cpp/lib/window_tree_client_impl.h" 5 #include "components/mus/public/cpp/lib/window_tree_client_impl.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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 void WindowTreeClientImpl::SetBounds(Window* window, 210 void WindowTreeClientImpl::SetBounds(Window* window,
211 const gfx::Rect& old_bounds, 211 const gfx::Rect& old_bounds,
212 const gfx::Rect& bounds) { 212 const gfx::Rect& bounds) {
213 DCHECK(tree_); 213 DCHECK(tree_);
214 const uint32_t change_id = ScheduleInFlightChange( 214 const uint32_t change_id = ScheduleInFlightChange(
215 make_scoped_ptr(new InFlightBoundsChange(window, old_bounds))); 215 make_scoped_ptr(new InFlightBoundsChange(window, old_bounds)));
216 tree_->SetWindowBounds(change_id, window->id(), mojo::Rect::From(bounds)); 216 tree_->SetWindowBounds(change_id, window->id(), mojo::Rect::From(bounds));
217 } 217 }
218 218
219 void WindowTreeClientImpl::SetCapture(Window* window) {
220 // In order for us to get here we had to have exposed a window, which implies
221 // we got a connection.
222 DCHECK(tree_);
223 const uint32_t change_id = ScheduleInFlightChange(make_scoped_ptr(
224 new CrashInFlightChange(window, ChangeType::SET_CAPTURE)));
225 tree_->SetCapture(change_id, window->id());
226 }
227
228 void WindowTreeClientImpl::ReleaseCapture(Window* window) {
229 // In order for us to get here we had to have exposed a window, which implies
230 // we got a connection.
231 DCHECK(tree_);
232 const uint32_t change_id = ScheduleInFlightChange(make_scoped_ptr(
233 new CrashInFlightChange(window, ChangeType::RELEASE_CAPTURE)));
234 tree_->ReleaseCapture(change_id, window->id());
235 }
236
219 void WindowTreeClientImpl::SetClientArea( 237 void WindowTreeClientImpl::SetClientArea(
220 Id window_id, 238 Id window_id,
221 const gfx::Insets& client_area, 239 const gfx::Insets& client_area,
222 const std::vector<gfx::Rect>& additional_client_areas) { 240 const std::vector<gfx::Rect>& additional_client_areas) {
223 DCHECK(tree_); 241 DCHECK(tree_);
224 tree_->SetClientArea( 242 tree_->SetClientArea(
225 window_id, mojo::Insets::From(client_area), 243 window_id, mojo::Insets::From(client_area),
226 mojo::Array<mojo::RectPtr>::From(additional_client_areas)); 244 mojo::Array<mojo::RectPtr>::From(additional_client_areas));
227 } 245 }
228 246
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 534
517 void WindowTreeClientImpl::OnUnembed(Id window_id) { 535 void WindowTreeClientImpl::OnUnembed(Id window_id) {
518 Window* window = GetWindowById(window_id); 536 Window* window = GetWindowById(window_id);
519 if (!window) 537 if (!window)
520 return; 538 return;
521 539
522 delegate_->OnUnembed(window); 540 delegate_->OnUnembed(window);
523 WindowPrivate(window).LocalDestroy(); 541 WindowPrivate(window).LocalDestroy();
524 } 542 }
525 543
544 void WindowTreeClientImpl::OnLostCapture(Id window_id) {
545 Window* window = GetWindowById(window_id);
546 if (window) {
547 FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(window).observers(),
548 OnWindowLostCapture(window));
549 }
550 }
551
526 void WindowTreeClientImpl::OnTopLevelCreated(uint32_t change_id, 552 void WindowTreeClientImpl::OnTopLevelCreated(uint32_t change_id,
527 mojom::WindowDataPtr data) { 553 mojom::WindowDataPtr data) {
528 // The server ack'd the top level window we created and supplied the state 554 // The server ack'd the top level window we created and supplied the state
529 // of the window at the time the server created it. For properties we do not 555 // of the window at the time the server created it. For properties we do not
530 // have changes in flight for we can update them immediately. For properties 556 // have changes in flight for we can update them immediately. For properties
531 // with changes in flight we set the revert value from the server. 557 // with changes in flight we set the revert value from the server.
532 558
533 scoped_ptr<InFlightChange> change(std::move(in_flight_map_[change_id])); 559 scoped_ptr<InFlightChange> change(std::move(in_flight_map_[change_id]));
534 in_flight_map_.erase(change_id); 560 in_flight_map_.erase(change_id);
535 DCHECK(change); 561 DCHECK(change);
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) { 880 mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) {
855 std::map<std::string, std::vector<uint8_t>> properties = 881 std::map<std::string, std::vector<uint8_t>> properties =
856 transport_properties.To<std::map<std::string, std::vector<uint8_t>>>(); 882 transport_properties.To<std::map<std::string, std::vector<uint8_t>>>();
857 Window* window = 883 Window* window =
858 window_manager_delegate_->OnWmCreateTopLevelWindow(&properties); 884 window_manager_delegate_->OnWmCreateTopLevelWindow(&properties);
859 window_manager_internal_client_->OnWmCreatedTopLevelWindow(change_id, 885 window_manager_internal_client_->OnWmCreatedTopLevelWindow(change_id,
860 window->id()); 886 window->id());
861 } 887 }
862 888
863 } // namespace mus 889 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698