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 | 4 |
5 #include "ios/chrome/browser/ui/bookmarks/bookmark_collection_view_background.h" | 5 #include "ios/chrome/browser/ui/bookmarks/bookmark_collection_view_background.h" |
6 | 6 |
| 7 #include "base/mac/objc_property_releaser.h" |
7 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 8 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" |
8 | 9 |
9 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
10 #error "This file requires ARC support." | |
11 #endif | |
12 | |
13 namespace { | 10 namespace { |
14 NSString* const kBookmarkGrayStar = @"bookmark_gray_star_large"; | 11 NSString* const kBookmarkGrayStar = @"bookmark_gray_star_large"; |
15 const CGFloat kEmptyBookmarkTextSize = 16.0; | 12 const CGFloat kEmptyBookmarkTextSize = 16.0; |
16 // Offset of the image view on top of the text. | 13 // Offset of the image view on top of the text. |
17 const CGFloat kImageViewOffsetFromText = 5.0; | 14 const CGFloat kImageViewOffsetFromText = 5.0; |
18 } // namespace | 15 } // namespace |
19 | 16 |
20 @interface BookmarkCollectionViewBackground () | 17 @interface BookmarkCollectionViewBackground () { |
| 18 base::mac::ObjCPropertyReleaser |
| 19 _propertyReleaser_BookmarkBookmarkCollectionViewBackground; |
| 20 } |
21 | 21 |
22 // Star image view shown on top of the label. | 22 // Star image view shown on top of the label. |
23 @property(nonatomic, retain) UIImageView* emptyBookmarksImageView; | 23 @property(nonatomic, retain) UIImageView* emptyBookmarksImageView; |
24 // Label centered on the view showing the empty bookmarks text. | 24 // Label centered on the view showing the empty bookmarks text. |
25 @property(nonatomic, retain) UILabel* emptyBookmarksLabel; | 25 @property(nonatomic, retain) UILabel* emptyBookmarksLabel; |
26 | 26 |
27 @end | 27 @end |
28 | 28 |
29 @implementation BookmarkCollectionViewBackground | 29 @implementation BookmarkCollectionViewBackground |
30 | 30 |
31 @synthesize emptyBookmarksImageView = _emptyBookmarksImageView; | 31 @synthesize emptyBookmarksImageView = _emptyBookmarksImageView; |
32 @synthesize emptyBookmarksLabel = _emptyBookmarksLabel; | 32 @synthesize emptyBookmarksLabel = _emptyBookmarksLabel; |
33 | 33 |
34 - (instancetype)initWithFrame:(CGRect)frame { | 34 - (instancetype)initWithFrame:(CGRect)frame { |
35 self = [super initWithFrame:frame]; | 35 self = [super initWithFrame:frame]; |
36 if (self) { | 36 if (self) { |
| 37 _propertyReleaser_BookmarkBookmarkCollectionViewBackground.Init( |
| 38 self, [BookmarkCollectionViewBackground class]); |
37 _emptyBookmarksImageView = [self newBookmarkImageView]; | 39 _emptyBookmarksImageView = [self newBookmarkImageView]; |
38 [self addSubview:_emptyBookmarksImageView]; | 40 [self addSubview:_emptyBookmarksImageView]; |
39 _emptyBookmarksLabel = [self newEmptyBookmarkLabel]; | 41 _emptyBookmarksLabel = [self newEmptyBookmarkLabel]; |
40 [self addSubview:_emptyBookmarksLabel]; | 42 [self addSubview:_emptyBookmarksLabel]; |
41 } | 43 } |
42 return self; | 44 return self; |
43 } | 45 } |
44 | 46 |
45 - (void)layoutSubviews { | 47 - (void)layoutSubviews { |
46 [super layoutSubviews]; | 48 [super layoutSubviews]; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 - (CGRect)bookmarkImageViewFrame { | 91 - (CGRect)bookmarkImageViewFrame { |
90 const CGRect labelRect = [self emptyBookmarkLabelFrame]; | 92 const CGRect labelRect = [self emptyBookmarkLabelFrame]; |
91 const CGSize imageViewSize = self.emptyBookmarksImageView.image.size; | 93 const CGSize imageViewSize = self.emptyBookmarksImageView.image.size; |
92 return CGRectMake((CGRectGetWidth(self.bounds) - imageViewSize.width) / 2.0, | 94 return CGRectMake((CGRectGetWidth(self.bounds) - imageViewSize.width) / 2.0, |
93 CGRectGetMinY(labelRect) - kImageViewOffsetFromText - | 95 CGRectGetMinY(labelRect) - kImageViewOffsetFromText - |
94 imageViewSize.height, | 96 imageViewSize.height, |
95 imageViewSize.width, imageViewSize.height); | 97 imageViewSize.width, imageViewSize.height); |
96 } | 98 } |
97 | 99 |
98 @end | 100 @end |
OLD | NEW |