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

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

Issue 1352043005: mus: Implement Window Server Capture Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a test Created 5 years, 3 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/view_tree_client_impl.h" 5 #include "components/mus/public/cpp/lib/view_tree_client_impl.h"
6 6
7 #include "components/mus/public/cpp/lib/view_private.h" 7 #include "components/mus/public/cpp/lib/view_private.h"
8 #include "components/mus/public/cpp/util.h" 8 #include "components/mus/public/cpp/util.h"
9 #include "components/mus/public/cpp/view_observer.h" 9 #include "components/mus/public/cpp/view_observer.h"
10 #include "components/mus/public/cpp/view_tree_connection.h" 10 #include "components/mus/public/cpp/view_tree_connection.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 bool ViewTreeClientImpl::OwnsView(Id id) const { 138 bool ViewTreeClientImpl::OwnsView(Id id) const {
139 return HiWord(id) == connection_id_; 139 return HiWord(id) == connection_id_;
140 } 140 }
141 141
142 void ViewTreeClientImpl::SetBounds(Id view_id, const mojo::Rect& bounds) { 142 void ViewTreeClientImpl::SetBounds(Id view_id, const mojo::Rect& bounds) {
143 DCHECK(tree_); 143 DCHECK(tree_);
144 tree_->SetViewBounds(view_id, bounds.Clone(), ActionCompletedCallback()); 144 tree_->SetViewBounds(view_id, bounds.Clone(), ActionCompletedCallback());
145 } 145 }
146 146
147 void ViewTreeClientImpl::SetCapture(Id view_id) {
148 // In order for us to get here we had to have exposed a view, which implies we
149 // got a connection.
150 DCHECK(tree_);
151 tree_->SetCapture(view_id, ActionCompletedCallback());
152 }
153
147 void ViewTreeClientImpl::SetFocus(Id view_id) { 154 void ViewTreeClientImpl::SetFocus(Id view_id) {
148 // In order for us to get here we had to have exposed a view, which implies we 155 // In order for us to get here we had to have exposed a view, which implies we
149 // got a connection. 156 // got a connection.
150 DCHECK(tree_); 157 DCHECK(tree_);
151 tree_->SetFocus(view_id); 158 tree_->SetFocus(view_id);
152 } 159 }
153 160
154 void ViewTreeClientImpl::SetVisible(Id view_id, bool visible) { 161 void ViewTreeClientImpl::SetVisible(Id view_id, bool visible) {
155 DCHECK(tree_); 162 DCHECK(tree_);
156 tree_->SetViewVisibility(view_id, visible, ActionCompletedCallback()); 163 tree_->SetViewVisibility(view_id, visible, ActionCompletedCallback());
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 OnViewEmbeddedAppDisconnected(view)); 295 OnViewEmbeddedAppDisconnected(view));
289 } 296 }
290 } 297 }
291 298
292 void ViewTreeClientImpl::OnUnembed() { 299 void ViewTreeClientImpl::OnUnembed() {
293 delegate_->OnUnembed(); 300 delegate_->OnUnembed();
294 // This will send out the various notifications. 301 // This will send out the various notifications.
295 delete this; 302 delete this;
296 } 303 }
297 304
305 void ViewTreeClientImpl::OnLostCapture(Id view_id) {
306 View* view = GetViewById(view_id);
307 if (view) {
308 FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(view).observers(),
309 OnViewLostCapture(view));
310 }
311 }
312
298 void ViewTreeClientImpl::OnViewBoundsChanged(Id view_id, 313 void ViewTreeClientImpl::OnViewBoundsChanged(Id view_id,
299 mojo::RectPtr old_bounds, 314 mojo::RectPtr old_bounds,
300 mojo::RectPtr new_bounds) { 315 mojo::RectPtr new_bounds) {
301 View* view = GetViewById(view_id); 316 View* view = GetViewById(view_id);
302 ViewPrivate(view).LocalSetBounds(*old_bounds, *new_bounds); 317 ViewPrivate(view).LocalSetBounds(*old_bounds, *new_bounds);
303 } 318 }
304 319
305 namespace { 320 namespace {
306 321
307 void SetViewportMetricsOnDecendants(View* root, 322 void SetViewportMetricsOnDecendants(View* root,
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 void ViewTreeClientImpl::OnActionCompleted(bool success) { 444 void ViewTreeClientImpl::OnActionCompleted(bool success) {
430 if (!change_acked_callback_.is_null()) 445 if (!change_acked_callback_.is_null())
431 change_acked_callback_.Run(); 446 change_acked_callback_.Run();
432 } 447 }
433 448
434 mojo::Callback<void(bool)> ViewTreeClientImpl::ActionCompletedCallback() { 449 mojo::Callback<void(bool)> ViewTreeClientImpl::ActionCompletedCallback() {
435 return [this](bool success) { OnActionCompleted(success); }; 450 return [this](bool success) { OnActionCompleted(success); };
436 } 451 }
437 452
438 } // namespace mus 453 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698