Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: ui/views/window/custom_frame_view.cc

Issue 567463002: Color picker window should not have a minimize button. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased and Added unit test for minimize button visibility. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/widget/widget_delegate.cc ('k') | ui/views/window/custom_frame_view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « ui/views/widget/widget_delegate.cc ('k') | ui/views/window/custom_frame_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698