| 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 <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 return GetWidget()->widget_delegate()->GetModalType() == | 99 return GetWidget()->widget_delegate()->GetModalType() == |
| 100 ui::MODAL_TYPE_WINDOW; | 100 ui::MODAL_TYPE_WINDOW; |
| 101 } | 101 } |
| 102 | 102 |
| 103 void NativeWidgetMac::OnWindowWillClose() { | 103 void NativeWidgetMac::OnWindowWillClose() { |
| 104 // Note: If closed via CloseNow(), |bridge_| will already be reset. If closed | 104 // Note: If closed via CloseNow(), |bridge_| will already be reset. If closed |
| 105 // by the user, or via Close() and a RunLoop, notify observers while |bridge_| | 105 // by the user, or via Close() and a RunLoop, notify observers while |bridge_| |
| 106 // is still a valid pointer, then reset it. | 106 // is still a valid pointer, then reset it. |
| 107 if (bridge_) { | 107 if (bridge_) { |
| 108 delegate_->OnNativeWidgetDestroying(); | 108 delegate_->OnNativeWidgetDestroying(); |
| 109 [GetNativeWindow() setDelegate:nil]; |
| 109 bridge_.reset(); | 110 bridge_.reset(); |
| 110 } | 111 } |
| 111 delegate_->OnNativeWidgetDestroyed(); | 112 delegate_->OnNativeWidgetDestroyed(); |
| 112 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) | 113 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) |
| 113 delete this; | 114 delete this; |
| 114 } | 115 } |
| 115 | 116 |
| 116 int NativeWidgetMac::SheetPositionY() { | 117 int NativeWidgetMac::SheetPositionY() { |
| 117 NSView* view = GetNativeView(); | 118 NSView* view = GetNativeView(); |
| 118 return | 119 return |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window]; | 763 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window]; |
| 763 } | 764 } |
| 764 | 765 |
| 765 - (void)animationDidEnd:(NSAnimation*)animation { | 766 - (void)animationDidEnd:(NSAnimation*)animation { |
| 766 [window_ close]; | 767 [window_ close]; |
| 767 [animation_ setDelegate:nil]; | 768 [animation_ setDelegate:nil]; |
| 768 [self release]; | 769 [self release]; |
| 769 } | 770 } |
| 770 | 771 |
| 771 @end | 772 @end |
| OLD | NEW |