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

Side by Side Diff: ui/views/widget/native_widget_mac.mm

Issue 2502813003: MacViews: Set initial window size constraints in OnWidgetInitDone rather than OnRootViewLayout. (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/widget/native_widget_mac.h" 5 #include "ui/views/widget/native_widget_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 DCHECK(GetWidget()->GetRootView()); 137 DCHECK(GetWidget()->GetRootView());
138 bridge_->SetRootView(GetWidget()->GetRootView()); 138 bridge_->SetRootView(GetWidget()->GetRootView());
139 139
140 // "Infer" must be handled by ViewsDelegate::OnBeforeWidgetInit(). 140 // "Infer" must be handled by ViewsDelegate::OnBeforeWidgetInit().
141 DCHECK_NE(Widget::InitParams::INFER_OPACITY, params.opacity); 141 DCHECK_NE(Widget::InitParams::INFER_OPACITY, params.opacity);
142 bool translucent = params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW; 142 bool translucent = params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW;
143 bridge_->CreateLayer(params.layer_type, translucent); 143 bridge_->CreateLayer(params.layer_type, translucent);
144 } 144 }
145 145
146 void NativeWidgetMac::OnWidgetInitDone() {} 146 void NativeWidgetMac::OnWidgetInitDone() {
147 OnSizeConstraintsChanged();
148 }
147 149
148 NonClientFrameView* NativeWidgetMac::CreateNonClientFrameView() { 150 NonClientFrameView* NativeWidgetMac::CreateNonClientFrameView() {
149 return new NativeFrameView(GetWidget()); 151 return new NativeFrameView(GetWidget());
150 } 152 }
151 153
152 bool NativeWidgetMac::ShouldUseNativeFrame() const { 154 bool NativeWidgetMac::ShouldUseNativeFrame() const {
153 return true; 155 return true;
154 } 156 }
155 157
156 bool NativeWidgetMac::ShouldWindowContentsBeTransparent() const { 158 bool NativeWidgetMac::ShouldWindowContentsBeTransparent() const {
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 596
595 void NativeWidgetMac::SetVisibilityAnimationTransition( 597 void NativeWidgetMac::SetVisibilityAnimationTransition(
596 Widget::VisibilityTransition transition) { 598 Widget::VisibilityTransition transition) {
597 NOTIMPLEMENTED(); 599 NOTIMPLEMENTED();
598 } 600 }
599 601
600 ui::NativeTheme* NativeWidgetMac::GetNativeTheme() const { 602 ui::NativeTheme* NativeWidgetMac::GetNativeTheme() const {
601 return ui::NativeThemeMac::instance(); 603 return ui::NativeThemeMac::instance();
602 } 604 }
603 605
604 void NativeWidgetMac::OnRootViewLayout() { 606 void NativeWidgetMac::OnRootViewLayout() {}
605 // Ensure possible changes to the non-client view (e.g. Minimum/Maximum size)
606 // propagate through to the NSWindow properties.
607 OnSizeConstraintsChanged();
608 }
609 607
610 bool NativeWidgetMac::IsTranslucentWindowOpacitySupported() const { 608 bool NativeWidgetMac::IsTranslucentWindowOpacitySupported() const {
611 return false; 609 return false;
612 } 610 }
613 611
614 void NativeWidgetMac::OnSizeConstraintsChanged() { 612 void NativeWidgetMac::OnSizeConstraintsChanged() {
615 bridge_->OnSizeConstraintsChanged(); 613 bridge_->OnSizeConstraintsChanged();
616 } 614 }
617 615
618 void NativeWidgetMac::RepostNativeEvent(gfx::NativeEvent native_event) { 616 void NativeWidgetMac::RepostNativeEvent(gfx::NativeEvent native_event) {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window]; 768 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window];
771 } 769 }
772 770
773 - (void)animationDidEnd:(NSAnimation*)animation { 771 - (void)animationDidEnd:(NSAnimation*)animation {
774 [window_ close]; 772 [window_ close];
775 [animation_ setDelegate:nil]; 773 [animation_ setDelegate:nil];
776 [self release]; 774 [self release];
777 } 775 }
778 776
779 @end 777 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698