Chromium Code Reviews| 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 - (instancetype)init { |
|
sdefresne
2017/02/14 16:34:26
This just call super -init, remove.
Sidney San Martín
2017/02/14 21:38:15
Done.
| |
| 20 self = [super init]; | 18 self = [super init]; |
| 21 if (self) { | 19 if (self) { |
| 22 _propertyReleaser_BookmarksElevatedToolbar.Init( | |
| 23 self, [BookmarksElevatedToolbar class]); | |
| 24 } | 20 } |
| 25 return self; | 21 return self; |
| 26 } | 22 } |
| 27 | 23 |
| 24 - (void)dealloc { | |
| 25 base::mac::ReleaseProperties(self); | |
| 26 [super dealloc]; | |
| 27 } | |
| 28 | |
| 28 #pragma mark - Properties | 29 #pragma mark - Properties |
| 29 | 30 |
| 30 - (MDCShadowLayer*)shadowLayer { | 31 - (MDCShadowLayer*)shadowLayer { |
| 31 if (!_shadowLayer) { | 32 if (!_shadowLayer) { |
| 32 _shadowLayer = [[MDCShadowLayer alloc] init]; | 33 _shadowLayer = [[MDCShadowLayer alloc] init]; |
| 33 _shadowLayer.elevation = MDCShadowElevationNone; | 34 _shadowLayer.elevation = MDCShadowElevationNone; |
| 34 [self.layer addSublayer:self.shadowLayer]; | 35 [self.layer addSublayer:self.shadowLayer]; |
| 35 } | 36 } |
| 36 return _shadowLayer; | 37 return _shadowLayer; |
| 37 } | 38 } |
| 38 | 39 |
| 39 - (void)setShadowElevation:(CGFloat)shadowElevation { | 40 - (void)setShadowElevation:(CGFloat)shadowElevation { |
| 40 self.shadowLayer.elevation = shadowElevation; | 41 self.shadowLayer.elevation = shadowElevation; |
| 41 } | 42 } |
| 42 | 43 |
| 43 - (CGFloat)shadowElevation { | 44 - (CGFloat)shadowElevation { |
| 44 return self.shadowLayer.elevation; | 45 return self.shadowLayer.elevation; |
| 45 } | 46 } |
| 46 | 47 |
| 47 #pragma mark - UIView | 48 #pragma mark - UIView |
| 48 | 49 |
| 49 - (void)layoutSubviews { | 50 - (void)layoutSubviews { |
| 50 [super layoutSubviews]; | 51 [super layoutSubviews]; |
| 51 self.shadowLayer.frame = self.layer.bounds; | 52 self.shadowLayer.frame = self.layer.bounds; |
| 52 } | 53 } |
| 53 | 54 |
| 54 @end | 55 @end |
| OLD | NEW |