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

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

Issue 2375903002: Emit OnNativeWidgetDestroying() before clearing the NSWindowDelegate. (Closed)
Patch Set: Add comment Created 4 years, 2 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/cocoa/bridged_native_widget.mm ('k') | ui/views/widget/widget_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 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
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
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
OLDNEW
« no previous file with comments | « ui/views/cocoa/bridged_native_widget.mm ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698