OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/browser/ui/browser_container_view.h" |
| 6 |
| 7 #import "base/ios/weak_nsobject.h" |
| 8 |
| 9 @implementation BrowserContainerView { |
| 10 // Weak reference to content view, so old _contentView can be removed from |
| 11 // superview when new one is added. |
| 12 base::WeakNSObject<UIView> _contentView; |
| 13 } |
| 14 |
| 15 - (void)dealloc { |
| 16 DCHECK(![_contentView superview] || [_contentView superview] == self); |
| 17 |
| 18 [super dealloc]; |
| 19 } |
| 20 |
| 21 - (void)displayContentView:(UIView*)contentView { |
| 22 DCHECK(![_contentView superview] || [_contentView superview] == self); |
| 23 [_contentView removeFromSuperview]; |
| 24 _contentView.reset(contentView); |
| 25 |
| 26 if (contentView) { |
| 27 [self addSubview:contentView]; |
| 28 } |
| 29 } |
| 30 |
| 31 @end |
OLD | NEW |