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 "ash/wm/custom_frame_view_ash.h" | 5 #include "ash/wm/custom_frame_view_ash.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/wm/caption_buttons/frame_caption_button_container_view.h" | 8 #include "ash/wm/caption_buttons/frame_caption_button_container_view.h" |
9 #include "ash/wm/caption_buttons/frame_maximize_button.h" | 9 #include "ash/wm/caption_buttons/frame_maximize_button.h" |
10 #include "ash/wm/caption_buttons/frame_maximize_button_observer.h" | 10 #include "ash/wm/caption_buttons/frame_maximize_button_observer.h" |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 } | 468 } |
469 | 469 |
470 gfx::Size CustomFrameViewAsh::GetMinimumSize() { | 470 gfx::Size CustomFrameViewAsh::GetMinimumSize() { |
471 gfx::Size min_client_view_size(frame_->client_view()->GetMinimumSize()); | 471 gfx::Size min_client_view_size(frame_->client_view()->GetMinimumSize()); |
472 return gfx::Size( | 472 return gfx::Size( |
473 std::max(header_view_->GetMinimumWidth(), min_client_view_size.width()), | 473 std::max(header_view_->GetMinimumWidth(), min_client_view_size.width()), |
474 NonClientTopBorderHeight() + min_client_view_size.height()); | 474 NonClientTopBorderHeight() + min_client_view_size.height()); |
475 } | 475 } |
476 | 476 |
477 gfx::Size CustomFrameViewAsh::GetMaximumSize() { | 477 gfx::Size CustomFrameViewAsh::GetMaximumSize() { |
478 return frame_->client_view()->GetMaximumSize(); | 478 gfx::Size max_client_size(frame_->client_view()->GetMaximumSize()); |
| 479 int width = 0; |
| 480 int height = 0; |
| 481 |
| 482 if (max_client_size.width() > 0) |
| 483 width = std::max(header_view_->GetMinimumWidth(), max_client_size.width()); |
| 484 if (max_client_size.height() > 0) |
| 485 height = NonClientTopBorderHeight() + max_client_size.height(); |
| 486 |
| 487 return gfx::Size(width, height); |
479 } | 488 } |
480 | 489 |
481 void CustomFrameViewAsh::SchedulePaintInRect(const gfx::Rect& r) { | 490 void CustomFrameViewAsh::SchedulePaintInRect(const gfx::Rect& r) { |
482 // We may end up here before |header_view_| has been added to the Widget. | 491 // We may end up here before |header_view_| has been added to the Widget. |
483 if (header_view_->GetWidget()) { | 492 if (header_view_->GetWidget()) { |
484 // The HeaderView is not a child of CustomFrameViewAsh. Redirect the paint | 493 // The HeaderView is not a child of CustomFrameViewAsh. Redirect the paint |
485 // to HeaderView instead. | 494 // to HeaderView instead. |
486 gfx::RectF to_paint(r); | 495 gfx::RectF to_paint(r); |
487 views::View::ConvertRectToTarget(this, header_view_, &to_paint); | 496 views::View::ConvertRectToTarget(this, header_view_, &to_paint); |
488 header_view_->SchedulePaintInRect(gfx::ToEnclosingRect(to_paint)); | 497 header_view_->SchedulePaintInRect(gfx::ToEnclosingRect(to_paint)); |
(...skipping 13 matching lines...) Expand all Loading... |
502 } | 511 } |
503 | 512 |
504 //////////////////////////////////////////////////////////////////////////////// | 513 //////////////////////////////////////////////////////////////////////////////// |
505 // CustomFrameViewAsh, private: | 514 // CustomFrameViewAsh, private: |
506 | 515 |
507 int CustomFrameViewAsh::NonClientTopBorderHeight() const { | 516 int CustomFrameViewAsh::NonClientTopBorderHeight() const { |
508 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); | 517 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); |
509 } | 518 } |
510 | 519 |
511 } // namespace ash | 520 } // namespace ash |
OLD | NEW |