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 "components/mus/public/cpp/window.h" | 5 #include "components/mus/public/cpp/window.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 return; | 207 return; |
208 | 208 |
209 if (bounds_ == bounds) | 209 if (bounds_ == bounds) |
210 return; | 210 return; |
211 | 211 |
212 if (connection_) | 212 if (connection_) |
213 static_cast<WindowTreeClientImpl*>(connection_)->SetBounds(id_, bounds); | 213 static_cast<WindowTreeClientImpl*>(connection_)->SetBounds(id_, bounds); |
214 LocalSetBounds(bounds_, bounds); | 214 LocalSetBounds(bounds_, bounds); |
215 } | 215 } |
216 | 216 |
217 void Window::SetClientArea(const gfx::Rect& client_area) { | 217 void Window::SetClientArea(const gfx::Insets& client_area) { |
218 if (!OwnsWindow(connection_, this) && !IsConnectionRoot(this)) | 218 if (!OwnsWindow(connection_, this) && !IsConnectionRoot(this)) |
219 return; | 219 return; |
220 | 220 |
221 if (connection_) { | 221 if (connection_) { |
222 static_cast<WindowTreeClientImpl*>(connection_) | 222 static_cast<WindowTreeClientImpl*>(connection_) |
223 ->SetClientArea(id_, client_area); | 223 ->SetClientArea(id_, client_area); |
224 } | 224 } |
225 LocalSetClientArea(client_area); | 225 LocalSetClientArea(client_area); |
226 } | 226 } |
227 | 227 |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 } | 532 } |
533 | 533 |
534 bool Window::LocalReorder(Window* relative, mojom::OrderDirection direction) { | 534 bool Window::LocalReorder(Window* relative, mojom::OrderDirection direction) { |
535 return ReorderImpl(&parent_->children_, this, relative, direction); | 535 return ReorderImpl(&parent_->children_, this, relative, direction); |
536 } | 536 } |
537 | 537 |
538 void Window::LocalSetBounds(const gfx::Rect& old_bounds, | 538 void Window::LocalSetBounds(const gfx::Rect& old_bounds, |
539 const gfx::Rect& new_bounds) { | 539 const gfx::Rect& new_bounds) { |
540 DCHECK(old_bounds == bounds_); | 540 DCHECK(old_bounds == bounds_); |
541 ScopedSetBoundsNotifier notifier(this, old_bounds, new_bounds); | 541 ScopedSetBoundsNotifier notifier(this, old_bounds, new_bounds); |
542 if (bounds_.size() != new_bounds.size()) | |
543 client_area_ = gfx::Rect(new_bounds.size()); | |
544 bounds_ = new_bounds; | 542 bounds_ = new_bounds; |
545 } | 543 } |
546 | 544 |
547 void Window::LocalSetClientArea(const gfx::Rect& new_client_area) { | 545 void Window::LocalSetClientArea(const gfx::Insets& new_client_area) { |
548 const gfx::Rect old_client_area = client_area_; | 546 const gfx::Insets old_client_area = client_area_; |
549 client_area_ = new_client_area; | 547 client_area_ = new_client_area; |
550 FOR_EACH_OBSERVER(WindowObserver, observers_, | 548 FOR_EACH_OBSERVER(WindowObserver, observers_, |
551 OnWindowClientAreaChanged(this, old_client_area)); | 549 OnWindowClientAreaChanged(this, old_client_area)); |
552 } | 550 } |
553 | 551 |
554 void Window::LocalSetViewportMetrics( | 552 void Window::LocalSetViewportMetrics( |
555 const mojom::ViewportMetrics& old_metrics, | 553 const mojom::ViewportMetrics& old_metrics, |
556 const mojom::ViewportMetrics& new_metrics) { | 554 const mojom::ViewportMetrics& new_metrics) { |
557 // TODO(eseidel): We could check old_metrics against viewport_metrics_. | 555 // TODO(eseidel): We could check old_metrics against viewport_metrics_. |
558 viewport_metrics_ = new_metrics.Clone(); | 556 viewport_metrics_ = new_metrics.Clone(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 !static_cast<WindowTreeClientImpl*>(connection_)->is_embed_root()) { | 666 !static_cast<WindowTreeClientImpl*>(connection_)->is_embed_root()) { |
669 return false; | 667 return false; |
670 } | 668 } |
671 | 669 |
672 while (!children_.empty()) | 670 while (!children_.empty()) |
673 RemoveChild(children_[0]); | 671 RemoveChild(children_[0]); |
674 return true; | 672 return true; |
675 } | 673 } |
676 | 674 |
677 } // namespace mus | 675 } // namespace mus |
OLD | NEW |