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/views/window/custom_frame_view.h" | 5 #include "ui/views/window/custom_frame_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 rb.GetImageNamed(pushed_image_id).ToImageSkia()); | 592 rb.GetImageNamed(pushed_image_id).ToImageSkia()); |
593 AddChildView(button); | 593 AddChildView(button); |
594 return button; | 594 return button; |
595 } | 595 } |
596 | 596 |
597 ImageButton* CustomFrameView::GetImageButton(views::FrameButton frame_button) { | 597 ImageButton* CustomFrameView::GetImageButton(views::FrameButton frame_button) { |
598 ImageButton* button = NULL; | 598 ImageButton* button = NULL; |
599 switch (frame_button) { | 599 switch (frame_button) { |
600 case views::FRAME_BUTTON_MINIMIZE: { | 600 case views::FRAME_BUTTON_MINIMIZE: { |
601 button = minimize_button_; | 601 button = minimize_button_; |
| 602 // If we should not show the minimize button, then we return NULL as we |
| 603 // don't want this button to become visible and to be laid out. |
| 604 bool should_show = frame_->widget_delegate()->CanMinimize(); |
| 605 button->SetVisible(should_show); |
| 606 if (!should_show) |
| 607 return NULL; |
| 608 |
602 break; | 609 break; |
603 } | 610 } |
604 case views::FRAME_BUTTON_MAXIMIZE: { | 611 case views::FRAME_BUTTON_MAXIMIZE: { |
605 bool is_restored = !frame_->IsMaximized() && !frame_->IsMinimized(); | 612 bool is_restored = !frame_->IsMaximized() && !frame_->IsMinimized(); |
606 button = is_restored ? maximize_button_ : restore_button_; | 613 button = is_restored ? maximize_button_ : restore_button_; |
607 // If we should not show the maximize/restore button, then we return | 614 // If we should not show the maximize/restore button, then we return |
608 // NULL as we don't want this button to become visible and to be laid | 615 // NULL as we don't want this button to become visible and to be laid |
609 // out. | 616 // out. |
610 bool should_show = frame_->widget_delegate()->CanMaximize(); | 617 bool should_show = frame_->widget_delegate()->CanMaximize(); |
611 button->SetVisible(should_show); | 618 button->SetVisible(should_show); |
612 if (!should_show) | 619 if (!should_show) |
613 return NULL; | 620 return NULL; |
614 | 621 |
615 break; | 622 break; |
616 } | 623 } |
617 case views::FRAME_BUTTON_CLOSE: { | 624 case views::FRAME_BUTTON_CLOSE: { |
618 button = close_button_; | 625 button = close_button_; |
619 break; | 626 break; |
620 } | 627 } |
621 } | 628 } |
622 return button; | 629 return button; |
623 } | 630 } |
624 | 631 |
625 } // namespace views | 632 } // namespace views |
OLD | NEW |