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 "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 return gfx::Size( | |
| 480 max_client_size.width() == 0 | |
| 481 ? 0 | |
| 482 : std::max(header_view_->GetMinimumWidth(), max_client_size.width()), | |
| 483 max_client_size.height() == 0 | |
| 484 ? 0 | |
| 485 : NonClientTopBorderHeight() + max_client_size.height()); | |
|
pkotwicz
2014/03/07 01:45:14
Optional Nit: This might be easier to read
int wi
tmdiep
2014/03/07 02:08:35
Done.
| |
| 479 } | 486 } |
| 480 | 487 |
| 481 void CustomFrameViewAsh::SchedulePaintInRect(const gfx::Rect& r) { | 488 void CustomFrameViewAsh::SchedulePaintInRect(const gfx::Rect& r) { |
| 482 // We may end up here before |header_view_| has been added to the Widget. | 489 // We may end up here before |header_view_| has been added to the Widget. |
| 483 if (header_view_->GetWidget()) { | 490 if (header_view_->GetWidget()) { |
| 484 // The HeaderView is not a child of CustomFrameViewAsh. Redirect the paint | 491 // The HeaderView is not a child of CustomFrameViewAsh. Redirect the paint |
| 485 // to HeaderView instead. | 492 // to HeaderView instead. |
| 486 gfx::RectF to_paint(r); | 493 gfx::RectF to_paint(r); |
| 487 views::View::ConvertRectToTarget(this, header_view_, &to_paint); | 494 views::View::ConvertRectToTarget(this, header_view_, &to_paint); |
| 488 header_view_->SchedulePaintInRect(gfx::ToEnclosingRect(to_paint)); | 495 header_view_->SchedulePaintInRect(gfx::ToEnclosingRect(to_paint)); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 502 } | 509 } |
| 503 | 510 |
| 504 //////////////////////////////////////////////////////////////////////////////// | 511 //////////////////////////////////////////////////////////////////////////////// |
| 505 // CustomFrameViewAsh, private: | 512 // CustomFrameViewAsh, private: |
| 506 | 513 |
| 507 int CustomFrameViewAsh::NonClientTopBorderHeight() const { | 514 int CustomFrameViewAsh::NonClientTopBorderHeight() const { |
| 508 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); | 515 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); |
| 509 } | 516 } |
| 510 | 517 |
| 511 } // namespace ash | 518 } // namespace ash |
| OLD | NEW |