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 #import "ui/views/cocoa/bridged_native_widget.h" | 5 #import "ui/views/cocoa/bridged_native_widget.h" |
6 | 6 |
7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 // called via ~CocoaMouseCapture() upon the destruction of |mouse_capture_|. | 700 // called via ~CocoaMouseCapture() upon the destruction of |mouse_capture_|. |
701 // See crbug.com/622201. Also we do this before setting the delegate to nil, | 701 // See crbug.com/622201. Also we do this before setting the delegate to nil, |
702 // because this may lead to callbacks to bridge which rely on a valid | 702 // because this may lead to callbacks to bridge which rely on a valid |
703 // delegate. | 703 // delegate. |
704 ReleaseCapture(); | 704 ReleaseCapture(); |
705 | 705 |
706 if (parent_) { | 706 if (parent_) { |
707 parent_->RemoveChildWindow(this); | 707 parent_->RemoveChildWindow(this); |
708 parent_ = nullptr; | 708 parent_ = nullptr; |
709 } | 709 } |
710 [window_ setDelegate:nil]; | |
711 [[NSNotificationCenter defaultCenter] removeObserver:window_delegate_]; | 710 [[NSNotificationCenter defaultCenter] removeObserver:window_delegate_]; |
| 711 // Note this also clears the NSWindow delegate, after informing Widget |
| 712 // delegates about the closure. NativeWidgetMac then deletes |this| before |
| 713 // returning. |
712 native_widget_mac_->OnWindowWillClose(); | 714 native_widget_mac_->OnWindowWillClose(); |
713 } | 715 } |
714 | 716 |
715 void BridgedNativeWidget::OnFullscreenTransitionStart( | 717 void BridgedNativeWidget::OnFullscreenTransitionStart( |
716 bool target_fullscreen_state) { | 718 bool target_fullscreen_state) { |
717 // Note: This can fail for fullscreen changes started externally, but a user | 719 // Note: This can fail for fullscreen changes started externally, but a user |
718 // shouldn't be able to do that if the window is invisible to begin with. | 720 // shouldn't be able to do that if the window is invisible to begin with. |
719 DCHECK(window_visible_); | 721 DCHECK(window_visible_); |
720 | 722 |
721 DCHECK_NE(target_fullscreen_state, target_fullscreen_state_); | 723 DCHECK_NE(target_fullscreen_state, target_fullscreen_state_); |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 [bridged_view_ setMouseDownCanMoveWindow:draggable]; | 1392 [bridged_view_ setMouseDownCanMoveWindow:draggable]; |
1391 // AppKit will not update its cache of mouseDownCanMoveWindow unless something | 1393 // AppKit will not update its cache of mouseDownCanMoveWindow unless something |
1392 // changes. Previously we tried adding an NSView and removing it, but for some | 1394 // changes. Previously we tried adding an NSView and removing it, but for some |
1393 // reason it required reposting the mouse-down event, and didn't always work. | 1395 // reason it required reposting the mouse-down event, and didn't always work. |
1394 // Calling the below seems to be an effective solution. | 1396 // Calling the below seems to be an effective solution. |
1395 [window_ setMovableByWindowBackground:NO]; | 1397 [window_ setMovableByWindowBackground:NO]; |
1396 [window_ setMovableByWindowBackground:YES]; | 1398 [window_ setMovableByWindowBackground:YES]; |
1397 } | 1399 } |
1398 | 1400 |
1399 } // namespace views | 1401 } // namespace views |
OLD | NEW |