| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "mash/wm/frame/non_client_frame_view_mash.h" | 5 #include "mash/wm/frame/non_client_frame_view_mash.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 return frame_->non_client_view() | 253 return frame_->non_client_view() |
| 254 ->GetWindowBoundsForClientBounds(gfx::Rect(pref)) | 254 ->GetWindowBoundsForClientBounds(gfx::Rect(pref)) |
| 255 .size(); | 255 .size(); |
| 256 } | 256 } |
| 257 | 257 |
| 258 const char* NonClientFrameViewMash::GetClassName() const { | 258 const char* NonClientFrameViewMash::GetClassName() const { |
| 259 return kViewClassName; | 259 return kViewClassName; |
| 260 } | 260 } |
| 261 | 261 |
| 262 gfx::Size NonClientFrameViewMash::GetMinimumSize() const { | 262 gfx::Size NonClientFrameViewMash::GetMinimumSize() const { |
| 263 // If the client area is empty we assume the client is rendering everything |
| 264 // and the window can be resized to anything. |
| 265 // TODO(sky): we need a minimum-size property. |
| 266 if (window_->client_area().IsEmpty()) |
| 267 return gfx::Size(); |
| 268 |
| 263 gfx::Size min_client_view_size(frame_->client_view()->GetMinimumSize()); | 269 gfx::Size min_client_view_size(frame_->client_view()->GetMinimumSize()); |
| 264 return gfx::Size( | 270 return gfx::Size( |
| 265 std::max(header_view_->GetMinimumWidth(), min_client_view_size.width()), | 271 std::max(header_view_->GetMinimumWidth(), min_client_view_size.width()), |
| 266 NonClientTopBorderHeight() + min_client_view_size.height()); | 272 NonClientTopBorderHeight() + min_client_view_size.height()); |
| 267 } | 273 } |
| 268 | 274 |
| 269 gfx::Size NonClientFrameViewMash::GetMaximumSize() const { | 275 gfx::Size NonClientFrameViewMash::GetMaximumSize() const { |
| 270 gfx::Size max_client_size(frame_->client_view()->GetMaximumSize()); | 276 gfx::Size max_client_size(frame_->client_view()->GetMaximumSize()); |
| 271 int width = 0; | 277 int width = 0; |
| 272 int height = 0; | 278 int height = 0; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 void NonClientFrameViewMash::OnWindowTreeFocusChanged(mus::Window* gained_focus, | 360 void NonClientFrameViewMash::OnWindowTreeFocusChanged(mus::Window* gained_focus, |
| 355 mus::Window* lost_focus) { | 361 mus::Window* lost_focus) { |
| 356 const bool had_focus = lost_focus && window_->Contains(lost_focus); | 362 const bool had_focus = lost_focus && window_->Contains(lost_focus); |
| 357 const bool has_focus = gained_focus && window_->Contains(gained_focus); | 363 const bool has_focus = gained_focus && window_->Contains(gained_focus); |
| 358 if (had_focus != has_focus) | 364 if (had_focus != has_focus) |
| 359 SchedulePaint(); | 365 SchedulePaint(); |
| 360 } | 366 } |
| 361 | 367 |
| 362 } // namespace wm | 368 } // namespace wm |
| 363 } // namespace mash | 369 } // namespace mash |
| OLD | NEW |