OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/aura/window.h" | 5 #include "ui/aura/window.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 Desktop* Window::GetDesktop() { | 433 Desktop* Window::GetDesktop() { |
434 return parent_ ? parent_->GetDesktop() : NULL; | 434 return parent_ ? parent_->GetDesktop() : NULL; |
435 } | 435 } |
436 | 436 |
437 void Window::WindowDetachedFromDesktop(aura::Window* window) { | 437 void Window::WindowDetachedFromDesktop(aura::Window* window) { |
438 } | 438 } |
439 | 439 |
440 void Window::SetBoundsInternal(const gfx::Rect& new_bounds) { | 440 void Window::SetBoundsInternal(const gfx::Rect& new_bounds) { |
441 gfx::Rect actual_new_bounds(new_bounds); | 441 gfx::Rect actual_new_bounds(new_bounds); |
442 | 442 |
443 // Gives delegate a change to examine and change the new bounds. | 443 // Ensure we don't go smaller than our minimum bounds. |
444 if (delegate_) | 444 if (delegate_) { |
445 delegate_->OnBoundsChanging(&actual_new_bounds); | 445 const gfx::Size& min_size = delegate_->GetMinimumSize(); |
| 446 actual_new_bounds.set_width( |
| 447 std::max(min_size.width(), actual_new_bounds.width())); |
| 448 actual_new_bounds.set_height( |
| 449 std::max(min_size.height(), actual_new_bounds.height())); |
| 450 } |
446 | 451 |
447 const gfx::Rect old_bounds = layer_->GetTargetBounds(); | 452 const gfx::Rect old_bounds = layer_->GetTargetBounds(); |
448 | 453 |
449 // Always need to set the layer's bounds -- even if it is to the same thing. | 454 // Always need to set the layer's bounds -- even if it is to the same thing. |
450 // This may cause important side effects such as stopping animation. | 455 // This may cause important side effects such as stopping animation. |
451 layer_->SetBounds(actual_new_bounds); | 456 layer_->SetBounds(actual_new_bounds); |
452 | 457 |
453 // If we're not changing the effective bounds, then we can bail early and skip | 458 // If we're not changing the effective bounds, then we can bail early and skip |
454 // notifying our listeners. | 459 // notifying our listeners. |
455 if (old_bounds == actual_new_bounds) | 460 if (old_bounds == actual_new_bounds) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 void Window::OnStackingChanged() { | 538 void Window::OnStackingChanged() { |
534 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowStackingChanged(this)); | 539 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowStackingChanged(this)); |
535 } | 540 } |
536 | 541 |
537 void Window::OnPaintLayer(gfx::Canvas* canvas) { | 542 void Window::OnPaintLayer(gfx::Canvas* canvas) { |
538 if (delegate_) | 543 if (delegate_) |
539 delegate_->OnPaint(canvas); | 544 delegate_->OnPaint(canvas); |
540 } | 545 } |
541 | 546 |
542 } // namespace aura | 547 } // namespace aura |
OLD | NEW |