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