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

Unified Diff: ios/chrome/browser/ui/browser_container_view.mm

Issue 2588713002: Upstream Chrome on iOS source code [4/11]. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/browser_container_view.mm
diff --git a/ios/chrome/browser/ui/browser_container_view.mm b/ios/chrome/browser/ui/browser_container_view.mm
new file mode 100644
index 0000000000000000000000000000000000000000..52b58e3cfa111264a05dc605062581a0e4ef5ed4
--- /dev/null
+++ b/ios/chrome/browser/ui/browser_container_view.mm
@@ -0,0 +1,31 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/chrome/browser/ui/browser_container_view.h"
+
+#import "base/ios/weak_nsobject.h"
+
+@implementation BrowserContainerView {
+ // Weak reference to content view, so old _contentView can be removed from
+ // superview when new one is added.
+ base::WeakNSObject<UIView> _contentView;
+}
+
+- (void)dealloc {
+ DCHECK(![_contentView superview] || [_contentView superview] == self);
+
+ [super dealloc];
+}
+
+- (void)displayContentView:(UIView*)contentView {
+ DCHECK(![_contentView superview] || [_contentView superview] == self);
+ [_contentView removeFromSuperview];
+ _contentView.reset(contentView);
+
+ if (contentView) {
+ [self addSubview:contentView];
+ }
+}
+
+@end
« no previous file with comments | « ios/chrome/browser/ui/browser_container_view.h ('k') | ios/chrome/browser/ui/browser_container_view_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698