OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 #import "ios/chrome/browser/ui/bookmarks/bookmark_elevated_toolbar.h" | 5 #import "ios/chrome/browser/ui/bookmarks/bookmark_elevated_toolbar.h" |
6 | 6 |
| 7 #include "base/mac/objc_property_releaser.h" |
7 #import "ios/third_party/material_components_ios/src/components/ShadowElevations
/src/MaterialShadowElevations.h" | 8 #import "ios/third_party/material_components_ios/src/components/ShadowElevations
/src/MaterialShadowElevations.h" |
8 #import "ios/third_party/material_components_ios/src/components/ShadowLayer/src/
MaterialShadowLayer.h" | 9 #import "ios/third_party/material_components_ios/src/components/ShadowLayer/src/
MaterialShadowLayer.h" |
9 | 10 |
10 #if !defined(__has_feature) || !__has_feature(objc_arc) | 11 @implementation BookmarksElevatedToolbar { |
11 #error "This file requires ARC support." | 12 base::mac::ObjCPropertyReleaser _propertyReleaser_BookmarksElevatedToolbar; |
12 #endif | 13 } |
13 | 14 |
14 @implementation BookmarksElevatedToolbar | |
15 @synthesize shadowLayer = _shadowLayer; | 15 @synthesize shadowLayer = _shadowLayer; |
16 | 16 |
| 17 #pragma mark - Lifecycle |
| 18 |
| 19 - (instancetype)init { |
| 20 self = [super init]; |
| 21 if (self) { |
| 22 _propertyReleaser_BookmarksElevatedToolbar.Init( |
| 23 self, [BookmarksElevatedToolbar class]); |
| 24 } |
| 25 return self; |
| 26 } |
| 27 |
17 #pragma mark - Properties | 28 #pragma mark - Properties |
18 | 29 |
19 - (MDCShadowLayer*)shadowLayer { | 30 - (MDCShadowLayer*)shadowLayer { |
20 if (!_shadowLayer) { | 31 if (!_shadowLayer) { |
21 _shadowLayer = [[MDCShadowLayer alloc] init]; | 32 _shadowLayer = [[MDCShadowLayer alloc] init]; |
22 _shadowLayer.elevation = MDCShadowElevationNone; | 33 _shadowLayer.elevation = MDCShadowElevationNone; |
23 [self.layer addSublayer:self.shadowLayer]; | 34 [self.layer addSublayer:self.shadowLayer]; |
24 } | 35 } |
25 return _shadowLayer; | 36 return _shadowLayer; |
26 } | 37 } |
27 | 38 |
28 - (void)setShadowElevation:(CGFloat)shadowElevation { | 39 - (void)setShadowElevation:(CGFloat)shadowElevation { |
29 self.shadowLayer.elevation = shadowElevation; | 40 self.shadowLayer.elevation = shadowElevation; |
30 } | 41 } |
31 | 42 |
32 - (CGFloat)shadowElevation { | 43 - (CGFloat)shadowElevation { |
33 return self.shadowLayer.elevation; | 44 return self.shadowLayer.elevation; |
34 } | 45 } |
35 | 46 |
36 #pragma mark - UIView | 47 #pragma mark - UIView |
37 | 48 |
38 - (void)layoutSubviews { | 49 - (void)layoutSubviews { |
39 [super layoutSubviews]; | 50 [super layoutSubviews]; |
40 self.shadowLayer.frame = self.layer.bounds; | 51 self.shadowLayer.frame = self.layer.bounds; |
41 } | 52 } |
42 | 53 |
43 @end | 54 @end |
OLD | NEW |