OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 #import "ios/chrome/browser/ui/bookmarks/bars/bookmark_top_bar.h" |
| 5 |
| 6 #include "base/mac/objc_property_releaser.h" |
| 7 #include "base/mac/scoped_nsobject.h" |
| 8 |
| 9 @interface BookmarkTopBar () { |
| 10 base::mac::ObjCPropertyReleaser _propertyReleaser_BookmarkBar; |
| 11 } |
| 12 @property(nonatomic, retain) UIView* contentView; |
| 13 @end |
| 14 |
| 15 @implementation BookmarkTopBar |
| 16 |
| 17 @synthesize contentView = _contentView; |
| 18 |
| 19 + (CGFloat)expectedContentViewHeight { |
| 20 return 56.0; |
| 21 } |
| 22 |
| 23 - (instancetype)initWithFrame:(CGRect)frame { |
| 24 self = [super initWithFrame:frame]; |
| 25 if (self) { |
| 26 _propertyReleaser_BookmarkBar.Init(self, [BookmarkTopBar class]); |
| 27 |
| 28 self.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | |
| 29 UIViewAutoresizingFlexibleWidth; |
| 30 |
| 31 base::scoped_nsobject<UIView> contentView([[UIView alloc] init]); |
| 32 self.contentView.backgroundColor = [UIColor clearColor]; |
| 33 [self addSubview:contentView]; |
| 34 self.contentView = contentView; |
| 35 |
| 36 [self statelessLayoutContentView]; |
| 37 } |
| 38 return self; |
| 39 } |
| 40 |
| 41 - (void)layoutSubviews { |
| 42 [super layoutSubviews]; |
| 43 |
| 44 // The content view. |
| 45 [self statelessLayoutContentView]; |
| 46 } |
| 47 |
| 48 - (void)statelessLayoutContentView { |
| 49 self.contentView.frame = CGRectMake( |
| 50 0, |
| 51 CGRectGetHeight(self.bounds) - [[self class] expectedContentViewHeight], |
| 52 CGRectGetWidth(self.bounds), [[self class] expectedContentViewHeight]); |
| 53 } |
| 54 |
| 55 @end |
OLD | NEW |