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

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: Created 4 years, 10 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 void WindowTreeClientImpl::SetBounds(Window* window, 237 void WindowTreeClientImpl::SetBounds(Window* window,
238 const gfx::Rect& old_bounds, 238 const gfx::Rect& old_bounds,
239 const gfx::Rect& bounds) { 239 const gfx::Rect& bounds) {
240 DCHECK(tree_); 240 DCHECK(tree_);
241 const uint32_t change_id = ScheduleInFlightChange( 241 const uint32_t change_id = ScheduleInFlightChange(
242 make_scoped_ptr(new InFlightBoundsChange(window, old_bounds))); 242 make_scoped_ptr(new InFlightBoundsChange(window, old_bounds)));
243 tree_->SetWindowBounds(change_id, window->id(), mojo::Rect::From(bounds)); 243 tree_->SetWindowBounds(change_id, window->id(), mojo::Rect::From(bounds));
244 } 244 }
245 245
246 void WindowTreeClientImpl::SetCapture(Window* window) {
247 // In order for us to get here we had to have exposed a window, which implies
248 // we got a connection.
249 DCHECK(tree_);
250 const uint32_t change_id = ScheduleInFlightChange(make_scoped_ptr(
251 new CrashInFlightChange(window, ChangeType::SET_CAPTURE)));
sky 2016/02/01 20:43:33 We need to handle requests for capture failing and
jonross 2016/02/03 18:52:17 Done.
252 tree_->SetCapture(change_id, window->id());
253 }
254
255 void WindowTreeClientImpl::ReleaseCapture(Window* window) {
256 // In order for us to get here we had to have exposed a window, which implies
257 // we got a connection.
258 DCHECK(tree_);
259 const uint32_t change_id = ScheduleInFlightChange(make_scoped_ptr(
260 new CrashInFlightChange(window, ChangeType::RELEASE_CAPTURE)));
261 tree_->ReleaseCapture(change_id, window->id());
262 }
263
246 void WindowTreeClientImpl::SetClientArea( 264 void WindowTreeClientImpl::SetClientArea(
247 Id window_id, 265 Id window_id,
248 const gfx::Insets& client_area, 266 const gfx::Insets& client_area,
249 const std::vector<gfx::Rect>& additional_client_areas) { 267 const std::vector<gfx::Rect>& additional_client_areas) {
250 DCHECK(tree_); 268 DCHECK(tree_);
251 tree_->SetClientArea( 269 tree_->SetClientArea(
252 window_id, mojo::Insets::From(client_area), 270 window_id, mojo::Insets::From(client_area),
253 mojo::Array<mojo::RectPtr>::From(additional_client_areas)); 271 mojo::Array<mojo::RectPtr>::From(additional_client_areas));
254 } 272 }
255 273
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 565
548 void WindowTreeClientImpl::OnUnembed(Id window_id) { 566 void WindowTreeClientImpl::OnUnembed(Id window_id) {
549 Window* window = GetWindowById(window_id); 567 Window* window = GetWindowById(window_id);
550 if (!window) 568 if (!window)
551 return; 569 return;
552 570
553 delegate_->OnUnembed(window); 571 delegate_->OnUnembed(window);
554 WindowPrivate(window).LocalDestroy(); 572 WindowPrivate(window).LocalDestroy();
555 } 573 }
556 574
575 void WindowTreeClientImpl::OnLostCapture(Id window_id) {
576 Window* window = GetWindowById(window_id);
577 if (window) {
578 FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(window).observers(),
579 OnWindowLostCapture(window));
580 }
581 }
582
557 void WindowTreeClientImpl::OnTopLevelCreated(uint32_t change_id, 583 void WindowTreeClientImpl::OnTopLevelCreated(uint32_t change_id,
558 mojom::WindowDataPtr data) { 584 mojom::WindowDataPtr data) {
559 // The server ack'd the top level window we created and supplied the state 585 // The server ack'd the top level window we created and supplied the state
560 // of the window at the time the server created it. For properties we do not 586 // of the window at the time the server created it. For properties we do not
561 // have changes in flight for we can update them immediately. For properties 587 // have changes in flight for we can update them immediately. For properties
562 // with changes in flight we set the revert value from the server. 588 // with changes in flight we set the revert value from the server.
563 589
564 scoped_ptr<InFlightChange> change(std::move(in_flight_map_[change_id])); 590 scoped_ptr<InFlightChange> change(std::move(in_flight_map_[change_id]));
565 in_flight_map_.erase(change_id); 591 in_flight_map_.erase(change_id);
566 DCHECK(change); 592 DCHECK(change);
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 window->id()); 917 window->id());
892 } 918 }
893 919
894 void WindowTreeClientImpl::SetFrameDecorationValues( 920 void WindowTreeClientImpl::SetFrameDecorationValues(
895 mojom::FrameDecorationValuesPtr values) { 921 mojom::FrameDecorationValuesPtr values) {
896 window_manager_internal_client_->WmSetFrameDecorationValues( 922 window_manager_internal_client_->WmSetFrameDecorationValues(
897 std::move(values)); 923 std::move(values));
898 } 924 }
899 925
900 } // namespace mus 926 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698