OLD | NEW |
---|---|
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 "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 // is still a valid pointer, then reset it. | 98 // is still a valid pointer, then reset it. |
99 if (bridge_) { | 99 if (bridge_) { |
100 delegate_->OnNativeWidgetDestroying(); | 100 delegate_->OnNativeWidgetDestroying(); |
101 bridge_.reset(); | 101 bridge_.reset(); |
102 } | 102 } |
103 delegate_->OnNativeWidgetDestroyed(); | 103 delegate_->OnNativeWidgetDestroyed(); |
104 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) | 104 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) |
105 delete this; | 105 delete this; |
106 } | 106 } |
107 | 107 |
108 int NativeWidgetMac::SheetPositionY() { | |
109 return 0; | |
tapted
2015/08/26 03:20:41
would window height - content view height be a bet
jackhou1
2015/08/26 07:02:09
Done.
| |
110 } | |
111 | |
108 //////////////////////////////////////////////////////////////////////////////// | 112 //////////////////////////////////////////////////////////////////////////////// |
109 // NativeWidgetMac, internal::NativeWidgetPrivate implementation: | 113 // NativeWidgetMac, internal::NativeWidgetPrivate implementation: |
110 | 114 |
111 void NativeWidgetMac::InitNativeWidget(const Widget::InitParams& params) { | 115 void NativeWidgetMac::InitNativeWidget(const Widget::InitParams& params) { |
112 ownership_ = params.ownership; | 116 ownership_ = params.ownership; |
113 base::scoped_nsobject<NSWindow> window([CreateNSWindow(params) retain]); | 117 base::scoped_nsobject<NSWindow> window([CreateNSWindow(params) retain]); |
114 [window setReleasedWhenClosed:NO]; // Owned by scoped_nsobject. | 118 [window setReleasedWhenClosed:NO]; // Owned by scoped_nsobject. |
115 bridge_->Init(window, params); | 119 bridge_->Init(window, params); |
116 | 120 |
117 // Only set always-on-top here if it is true since setting it may affect how | 121 // Only set always-on-top here if it is true since setting it may affect how |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
706 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window]; | 710 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window]; |
707 } | 711 } |
708 | 712 |
709 - (void)animationDidEnd:(NSAnimation*)animation { | 713 - (void)animationDidEnd:(NSAnimation*)animation { |
710 [window_ close]; | 714 [window_ close]; |
711 [animation_ setDelegate:nil]; | 715 [animation_ setDelegate:nil]; |
712 [self release]; | 716 [self release]; |
713 } | 717 } |
714 | 718 |
715 @end | 719 @end |
OLD | NEW |