OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/web/web_state/ui/crw_web_controller_container_view.h" | 5 #import "ios/web/web_state/ui/crw_web_controller_container_view.h" |
6 | 6 |
7 #include "base/ios/weak_nsobject.h" | 7 #include "base/ios/weak_nsobject.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
10 #import "ios/web/public/web_state/ui/crw_content_view.h" | 10 #import "ios/web/public/web_state/ui/crw_content_view.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 } | 165 } |
166 } | 166 } |
167 | 167 |
168 - (id<CRWNativeContent>)nativeController { | 168 - (id<CRWNativeContent>)nativeController { |
169 return _nativeController.get(); | 169 return _nativeController.get(); |
170 } | 170 } |
171 | 171 |
172 - (void)setNativeController:(id<CRWNativeContent>)nativeController { | 172 - (void)setNativeController:(id<CRWNativeContent>)nativeController { |
173 if (![_nativeController isEqual:nativeController]) { | 173 if (![_nativeController isEqual:nativeController]) { |
174 base::WeakNSProtocol<id> oldController(_nativeController); | 174 base::WeakNSProtocol<id> oldController(_nativeController); |
| 175 if ([oldController respondsToSelector:@selector(willBeDismissed)]) { |
| 176 [oldController willBeDismissed]; |
| 177 } |
175 [[oldController view] removeFromSuperview]; | 178 [[oldController view] removeFromSuperview]; |
176 _nativeController.reset([nativeController retain]); | 179 _nativeController.reset([nativeController retain]); |
177 // TODO(crbug.com/503297): Re-enable this DCHECK once native controller | 180 // TODO(crbug.com/503297): Re-enable this DCHECK once native controller |
178 // leaks are fixed. | 181 // leaks are fixed. |
179 // DCHECK(!oldController); | 182 // DCHECK(!oldController); |
180 } | 183 } |
181 } | 184 } |
182 | 185 |
183 - (CRWContentView*)transientContentView { | 186 - (CRWContentView*)transientContentView { |
184 return _transientContentView.get(); | 187 return _transientContentView.get(); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 else | 338 else |
336 self.toolbarContainerView = nil; | 339 self.toolbarContainerView = nil; |
337 } | 340 } |
338 | 341 |
339 - (void)removeAllToolbars { | 342 - (void)removeAllToolbars { |
340 // Resetting the property will remove the toolbars from the hierarchy. | 343 // Resetting the property will remove the toolbars from the hierarchy. |
341 self.toolbarContainerView = nil; | 344 self.toolbarContainerView = nil; |
342 } | 345 } |
343 | 346 |
344 @end | 347 @end |
OLD | NEW |