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

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

Issue 1419793006: Makes windowmanager draw non-client area (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move wm nonclientframeview to wm Created 5 years, 1 month 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "components/mus/public/cpp/lib/window_private.h" 8 #include "components/mus/public/cpp/lib/window_private.h"
9 #include "components/mus/public/cpp/util.h" 9 #include "components/mus/public/cpp/util.h"
10 #include "components/mus/public/cpp/window_observer.h" 10 #include "components/mus/public/cpp/window_observer.h"
11 #include "components/mus/public/cpp/window_tree_connection.h" 11 #include "components/mus/public/cpp/window_tree_connection.h"
12 #include "components/mus/public/cpp/window_tree_delegate.h" 12 #include "components/mus/public/cpp/window_tree_delegate.h"
13 #include "mojo/application/public/cpp/application_impl.h" 13 #include "mojo/application/public/cpp/application_impl.h"
14 #include "mojo/application/public/cpp/connect.h" 14 #include "mojo/application/public/cpp/connect.h"
15 #include "mojo/application/public/cpp/service_provider_impl.h" 15 #include "mojo/application/public/cpp/service_provider_impl.h"
16 #include "mojo/application/public/interfaces/service_provider.mojom.h" 16 #include "mojo/application/public/interfaces/service_provider.mojom.h"
17 #include "mojo/converters/geometry/geometry_type_converters.h" 17 #include "mojo/converters/geometry/geometry_type_converters.h"
18 #include "ui/gfx/geometry/insets.h"
18 #include "ui/gfx/geometry/size.h" 19 #include "ui/gfx/geometry/size.h"
19 20
20 namespace mus { 21 namespace mus {
21 namespace { 22 namespace {
22 23
23 void WindowManagerCallback(mus::mojom::WindowManagerErrorCode error_code) {} 24 void WindowManagerCallback(mus::mojom::WindowManagerErrorCode error_code) {}
24 25
25 } // namespace 26 } // namespace
26 27
27 Id MakeTransportId(ConnectionSpecificId connection_id, 28 Id MakeTransportId(ConnectionSpecificId connection_id,
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 return HiWord(id) == connection_id_; 162 return HiWord(id) == connection_id_;
162 } 163 }
163 164
164 void WindowTreeClientImpl::SetBounds(Id window_id, const gfx::Rect& bounds) { 165 void WindowTreeClientImpl::SetBounds(Id window_id, const gfx::Rect& bounds) {
165 DCHECK(tree_); 166 DCHECK(tree_);
166 tree_->SetWindowBounds(window_id, mojo::Rect::From(bounds), 167 tree_->SetWindowBounds(window_id, mojo::Rect::From(bounds),
167 ActionCompletedCallback()); 168 ActionCompletedCallback());
168 } 169 }
169 170
170 void WindowTreeClientImpl::SetClientArea(Id window_id, 171 void WindowTreeClientImpl::SetClientArea(Id window_id,
171 const gfx::Rect& client_area) { 172 const gfx::Insets& client_area) {
172 DCHECK(tree_); 173 DCHECK(tree_);
173 tree_->SetClientArea(window_id, mojo::Rect::From(client_area)); 174 tree_->SetClientArea(window_id, mojo::Insets::From(client_area));
174 } 175 }
175 176
176 void WindowTreeClientImpl::SetFocus(Id window_id) { 177 void WindowTreeClientImpl::SetFocus(Id window_id) {
177 // In order for us to get here we had to have exposed a window, which implies 178 // In order for us to get here we had to have exposed a window, which implies
178 // we got a connection. 179 // we got a connection.
179 DCHECK(tree_); 180 DCHECK(tree_);
180 tree_->SetFocus(window_id); 181 tree_->SetFocus(window_id);
181 } 182 }
182 183
183 void WindowTreeClientImpl::SetVisible(Id window_id, bool visible) { 184 void WindowTreeClientImpl::SetVisible(Id window_id, bool visible) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 } 347 }
347 348
348 void WindowTreeClientImpl::OnWindowBoundsChanged(Id window_id, 349 void WindowTreeClientImpl::OnWindowBoundsChanged(Id window_id,
349 mojo::RectPtr old_bounds, 350 mojo::RectPtr old_bounds,
350 mojo::RectPtr new_bounds) { 351 mojo::RectPtr new_bounds) {
351 Window* window = GetWindowById(window_id); 352 Window* window = GetWindowById(window_id);
352 WindowPrivate(window) 353 WindowPrivate(window)
353 .LocalSetBounds(old_bounds.To<gfx::Rect>(), new_bounds.To<gfx::Rect>()); 354 .LocalSetBounds(old_bounds.To<gfx::Rect>(), new_bounds.To<gfx::Rect>());
354 } 355 }
355 356
356 void WindowTreeClientImpl::OnClientAreaChanged(uint32_t window_id, 357 void WindowTreeClientImpl::OnClientAreaChanged(
357 mojo::RectPtr old_client_area, 358 uint32_t window_id,
358 mojo::RectPtr new_client_area) { 359 mojo::InsetsPtr old_client_area,
360 mojo::InsetsPtr new_client_area) {
359 Window* window = GetWindowById(window_id); 361 Window* window = GetWindowById(window_id);
360 if (window) 362 if (window)
361 WindowPrivate(window).LocalSetClientArea(new_client_area.To<gfx::Rect>()); 363 WindowPrivate(window).LocalSetClientArea(new_client_area.To<gfx::Insets>());
362 } 364 }
363 365
364 namespace { 366 namespace {
365 367
366 void SetViewportMetricsOnDecendants(Window* root, 368 void SetViewportMetricsOnDecendants(Window* root,
367 const mojom::ViewportMetrics& old_metrics, 369 const mojom::ViewportMetrics& old_metrics,
368 const mojom::ViewportMetrics& new_metrics) { 370 const mojom::ViewportMetrics& new_metrics) {
369 WindowPrivate(root).LocalSetViewportMetrics(old_metrics, new_metrics); 371 WindowPrivate(root).LocalSetViewportMetrics(old_metrics, new_metrics);
370 const Window::Children& children = root->children(); 372 const Window::Children& children = root->children();
371 for (size_t i = 0; i < children.size(); ++i) 373 for (size_t i = 0; i < children.size(); ++i)
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 void WindowTreeClientImpl::OnActionCompleted(bool success) { 491 void WindowTreeClientImpl::OnActionCompleted(bool success) {
490 if (!change_acked_callback_.is_null()) 492 if (!change_acked_callback_.is_null())
491 change_acked_callback_.Run(); 493 change_acked_callback_.Run();
492 } 494 }
493 495
494 mojo::Callback<void(bool)> WindowTreeClientImpl::ActionCompletedCallback() { 496 mojo::Callback<void(bool)> WindowTreeClientImpl::ActionCompletedCallback() {
495 return [this](bool success) { OnActionCompleted(success); }; 497 return [this](bool success) { OnActionCompleted(success); };
496 } 498 }
497 499
498 } // namespace mus 500 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698