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

Unified Diff: ui/views/window/custom_frame_view.cc

Issue 554183002: Update the maximize button when size constraints change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update NativeWidgetMac. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/window/custom_frame_view.h ('k') | ui/views/window/native_frame_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/window/custom_frame_view.cc
diff --git a/ui/views/window/custom_frame_view.cc b/ui/views/window/custom_frame_view.cc
index 9ee05107d2a70a5a1874ecfa8d1baf147b89f083..83188abdc4b58ea4e81b06ad79b3e404c9204587 100644
--- a/ui/views/window/custom_frame_view.cc
+++ b/ui/views/window/custom_frame_view.cc
@@ -89,7 +89,6 @@ CustomFrameView::CustomFrameView()
maximize_button_(NULL),
restore_button_(NULL),
close_button_(NULL),
- should_show_maximize_button_(false),
frame_background_(new FrameBackground()),
minimum_title_bar_x_(0),
maximum_title_bar_x_(-1) {
@@ -110,8 +109,6 @@ void CustomFrameView::Init(Widget* frame) {
restore_button_ = InitWindowCaptionButton(IDS_APP_ACCNAME_RESTORE,
IDR_RESTORE, IDR_RESTORE_H, IDR_RESTORE_P);
- should_show_maximize_button_ = frame_->widget_delegate()->CanMaximize();
-
if (frame_->widget_delegate()->ShouldShowWindowIcon()) {
window_icon_ = new ImageButton(this);
AddChildView(window_icon_);
@@ -201,6 +198,11 @@ void CustomFrameView::UpdateWindowTitle() {
SchedulePaintInRect(title_bounds_);
}
+void CustomFrameView::SizeConstraintsChanged() {
+ ResetWindowControls();
+ LayoutWindowControls();
+}
+
///////////////////////////////////////////////////////////////////////////////
// CustomFrameView, View overrides:
@@ -602,13 +604,14 @@ ImageButton* CustomFrameView::GetImageButton(views::FrameButton frame_button) {
case views::FRAME_BUTTON_MAXIMIZE: {
bool is_restored = !frame_->IsMaximized() && !frame_->IsMinimized();
button = is_restored ? maximize_button_ : restore_button_;
- if (!should_show_maximize_button_) {
- // If we should not show the maximize/restore button, then we return
- // NULL as we don't want this button to become visible and to be laid
- // out.
- button->SetVisible(false);
+ // If we should not show the maximize/restore button, then we return
+ // NULL as we don't want this button to become visible and to be laid
+ // out.
+ bool should_show = frame_->widget_delegate()->CanMaximize();
+ button->SetVisible(should_show);
+ if (!should_show)
return NULL;
- }
+
break;
}
case views::FRAME_BUTTON_CLOSE: {
« no previous file with comments | « ui/views/window/custom_frame_view.h ('k') | ui/views/window/native_frame_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698