| 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 #include "base/mac/objc_release_properties.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/ShadowElevations
/src/MaterialShadowElevations.h" |
| 9 #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" |
| 10 | 10 |
| 11 @implementation BookmarksElevatedToolbar { | 11 @implementation BookmarksElevatedToolbar |
| 12 base::mac::ObjCPropertyReleaser _propertyReleaser_BookmarksElevatedToolbar; | |
| 13 } | |
| 14 | 12 |
| 15 @synthesize shadowLayer = _shadowLayer; | 13 @synthesize shadowLayer = _shadowLayer; |
| 16 | 14 |
| 17 #pragma mark - Lifecycle | 15 #pragma mark - Lifecycle |
| 18 | 16 |
| 19 - (instancetype)init { | 17 - (void)dealloc { |
| 20 self = [super init]; | 18 base::mac::ReleaseProperties(self); |
| 21 if (self) { | 19 [super dealloc]; |
| 22 _propertyReleaser_BookmarksElevatedToolbar.Init( | |
| 23 self, [BookmarksElevatedToolbar class]); | |
| 24 } | |
| 25 return self; | |
| 26 } | 20 } |
| 27 | 21 |
| 28 #pragma mark - Properties | 22 #pragma mark - Properties |
| 29 | 23 |
| 30 - (MDCShadowLayer*)shadowLayer { | 24 - (MDCShadowLayer*)shadowLayer { |
| 31 if (!_shadowLayer) { | 25 if (!_shadowLayer) { |
| 32 _shadowLayer = [[MDCShadowLayer alloc] init]; | 26 _shadowLayer = [[MDCShadowLayer alloc] init]; |
| 33 _shadowLayer.elevation = MDCShadowElevationNone; | 27 _shadowLayer.elevation = MDCShadowElevationNone; |
| 34 [self.layer addSublayer:self.shadowLayer]; | 28 [self.layer addSublayer:self.shadowLayer]; |
| 35 } | 29 } |
| 36 return _shadowLayer; | 30 return _shadowLayer; |
| 37 } | 31 } |
| 38 | 32 |
| 39 - (void)setShadowElevation:(CGFloat)shadowElevation { | 33 - (void)setShadowElevation:(CGFloat)shadowElevation { |
| 40 self.shadowLayer.elevation = shadowElevation; | 34 self.shadowLayer.elevation = shadowElevation; |
| 41 } | 35 } |
| 42 | 36 |
| 43 - (CGFloat)shadowElevation { | 37 - (CGFloat)shadowElevation { |
| 44 return self.shadowLayer.elevation; | 38 return self.shadowLayer.elevation; |
| 45 } | 39 } |
| 46 | 40 |
| 47 #pragma mark - UIView | 41 #pragma mark - UIView |
| 48 | 42 |
| 49 - (void)layoutSubviews { | 43 - (void)layoutSubviews { |
| 50 [super layoutSubviews]; | 44 [super layoutSubviews]; |
| 51 self.shadowLayer.frame = self.layer.bounds; | 45 self.shadowLayer.frame = self.layer.bounds; |
| 52 } | 46 } |
| 53 | 47 |
| 54 @end | 48 @end |
| OLD | NEW |