Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 286 } | 286 } |
| 287 | 287 |
| 288 std::unique_ptr<ui::EventTargeter> Window::SetEventTargeter( | 288 std::unique_ptr<ui::EventTargeter> Window::SetEventTargeter( |
| 289 std::unique_ptr<ui::EventTargeter> targeter) { | 289 std::unique_ptr<ui::EventTargeter> targeter) { |
| 290 std::unique_ptr<ui::EventTargeter> old_targeter = std::move(targeter_); | 290 std::unique_ptr<ui::EventTargeter> old_targeter = std::move(targeter_); |
| 291 targeter_ = std::move(targeter); | 291 targeter_ = std::move(targeter); |
| 292 return old_targeter; | 292 return old_targeter; |
| 293 } | 293 } |
| 294 | 294 |
| 295 void Window::SetBounds(const gfx::Rect& new_bounds) { | 295 void Window::SetBounds(const gfx::Rect& new_bounds) { |
| 296 if (parent_ && parent_->layout_manager()) | 296 // Ensure we don't go smaller than our minimum bounds. |
|
mfomitchev
2016/12/08 20:44:23
Please put this back
| |
| 297 parent_->layout_manager()->SetChildBounds(this, new_bounds); | 297 gfx::Rect final_bounds(new_bounds); |
| 298 else { | 298 if (delegate_) { |
| 299 // Ensure we don't go smaller than our minimum bounds. | 299 const gfx::Size& min_size = delegate_->GetMinimumSize(); |
| 300 gfx::Rect final_bounds(new_bounds); | 300 final_bounds.set_width(std::max(min_size.width(), final_bounds.width())); |
| 301 if (delegate_) { | 301 final_bounds.set_height(std::max(min_size.height(), |
| 302 const gfx::Size& min_size = delegate_->GetMinimumSize(); | 302 final_bounds.height())); |
| 303 final_bounds.set_width(std::max(min_size.width(), final_bounds.width())); | |
| 304 final_bounds.set_height(std::max(min_size.height(), | |
| 305 final_bounds.height())); | |
| 306 } | |
| 307 SetBoundsInternal(final_bounds); | |
| 308 } | 303 } |
| 304 SetBoundsInternal(final_bounds); | |
| 309 } | 305 } |
| 310 | 306 |
| 311 void Window::SetBoundsInScreen(const gfx::Rect& new_bounds_in_screen, | 307 void Window::SetBoundsInScreen(const gfx::Rect& new_bounds_in_screen, |
| 312 const display::Display& dst_display) { | 308 const display::Display& dst_display) { |
| 313 Window* root = GetRootWindow(); | 309 Window* root = GetRootWindow(); |
| 314 if (root) { | 310 if (root) { |
| 315 aura::client::ScreenPositionClient* screen_position_client = | 311 aura::client::ScreenPositionClient* screen_position_client = |
| 316 aura::client::GetScreenPositionClient(root); | 312 aura::client::GetScreenPositionClient(root); |
| 317 screen_position_client->SetBounds(this, new_bounds_in_screen, dst_display); | 313 screen_position_client->SetBounds(this, new_bounds_in_screen, dst_display); |
| 318 return; | 314 return; |
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1116 layer_name = "Unnamed Window"; | 1112 layer_name = "Unnamed Window"; |
| 1117 | 1113 |
| 1118 if (id_ != -1) | 1114 if (id_ != -1) |
| 1119 layer_name += " " + base::IntToString(id_); | 1115 layer_name += " " + base::IntToString(id_); |
| 1120 | 1116 |
| 1121 layer()->set_name(layer_name); | 1117 layer()->set_name(layer_name); |
| 1122 #endif | 1118 #endif |
| 1123 } | 1119 } |
| 1124 | 1120 |
| 1125 } // namespace aura | 1121 } // namespace aura |
| OLD | NEW |