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_]; |
712 native_widget_mac_->OnWindowWillClose(); | 711 native_widget_mac_->OnWindowWillClose(); |
tapted
2016/10/06 08:36:05
Since it's convention to clear the delegate in -wi
yamaxim
2016/10/06 09:33:09
done
| |
713 } | 712 } |
714 | 713 |
715 void BridgedNativeWidget::OnFullscreenTransitionStart( | 714 void BridgedNativeWidget::OnFullscreenTransitionStart( |
716 bool target_fullscreen_state) { | 715 bool target_fullscreen_state) { |
717 // Note: This can fail for fullscreen changes started externally, but a user | 716 // 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. | 717 // shouldn't be able to do that if the window is invisible to begin with. |
719 DCHECK(window_visible_); | 718 DCHECK(window_visible_); |
720 | 719 |
721 DCHECK_NE(target_fullscreen_state, target_fullscreen_state_); | 720 DCHECK_NE(target_fullscreen_state, target_fullscreen_state_); |
722 target_fullscreen_state_ = target_fullscreen_state; | 721 target_fullscreen_state_ = target_fullscreen_state; |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1390 [bridged_view_ setMouseDownCanMoveWindow:draggable]; | 1389 [bridged_view_ setMouseDownCanMoveWindow:draggable]; |
1391 // AppKit will not update its cache of mouseDownCanMoveWindow unless something | 1390 // AppKit will not update its cache of mouseDownCanMoveWindow unless something |
1392 // changes. Previously we tried adding an NSView and removing it, but for some | 1391 // 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. | 1392 // reason it required reposting the mouse-down event, and didn't always work. |
1394 // Calling the below seems to be an effective solution. | 1393 // Calling the below seems to be an effective solution. |
1395 [window_ setMovableByWindowBackground:NO]; | 1394 [window_ setMovableByWindowBackground:NO]; |
1396 [window_ setMovableByWindowBackground:YES]; | 1395 [window_ setMovableByWindowBackground:YES]; |
1397 } | 1396 } |
1398 | 1397 |
1399 } // namespace views | 1398 } // namespace views |
OLD | NEW |