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