Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: ios/chrome/browser/ui/history/clear_browsing_bar.mm

Issue 2610923005: Replace ObjCPropertyReleaser with ReleaseProperties() project-wide. (Closed)
Patch Set: weak -> assign Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/history/clear_browsing_bar.h" 5 #import "ios/chrome/browser/ui/history/clear_browsing_bar.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/objc_property_releaser.h" 8 #include "base/mac/objc_release_properties.h"
9 #include "components/strings/grit/components_strings.h" 9 #include "components/strings/grit/components_strings.h"
10 #include "ios/chrome/browser/ui/rtl_geometry.h" 10 #include "ios/chrome/browser/ui/rtl_geometry.h"
11 #import "ios/chrome/browser/ui/uikit_ui_util.h" 11 #import "ios/chrome/browser/ui/uikit_ui_util.h"
12 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat erialPalettes.h" 12 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat erialPalettes.h"
13 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h" 13 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h"
14 #include "ui/base/l10n/l10n_util_mac.h" 14 #include "ui/base/l10n/l10n_util_mac.h"
15 15
16 namespace { 16 namespace {
17 // Shadow opacity for the clear browsing bar. 17 // Shadow opacity for the clear browsing bar.
18 CGFloat kShadowOpacity = 0.2f; 18 CGFloat kShadowOpacity = 0.2f;
19 // Horizontal margin for the contents of ClearBrowsingBar. 19 // Horizontal margin for the contents of ClearBrowsingBar.
20 CGFloat kHorizontalMargin = 8.0f; 20 CGFloat kHorizontalMargin = 8.0f;
21 // Enum to specify button position in the clear browsing bar. 21 // Enum to specify button position in the clear browsing bar.
22 typedef NS_ENUM(BOOL, ButtonPlacement) { Leading, Trailing }; 22 typedef NS_ENUM(BOOL, ButtonPlacement) { Leading, Trailing };
23 } // namespace 23 } // namespace
24 24
25 @interface ClearBrowsingBar () { 25 @interface ClearBrowsingBar ()
26 base::mac::ObjCPropertyReleaser propertyReleaser_ClearBrowsingBar_;
27 }
28 26
29 // Button that displays "Clear Browsing Data...". 27 // Button that displays "Clear Browsing Data...".
30 @property(nonatomic, strong) UIButton* clearBrowsingDataButton; 28 @property(nonatomic, strong) UIButton* clearBrowsingDataButton;
31 // Button that displays "Edit". 29 // Button that displays "Edit".
32 @property(nonatomic, strong) UIButton* editButton; 30 @property(nonatomic, strong) UIButton* editButton;
33 // Button that displays "Delete". 31 // Button that displays "Delete".
34 @property(nonatomic, strong) UIButton* deleteButton; 32 @property(nonatomic, strong) UIButton* deleteButton;
35 // Button that displays "Cancel". 33 // Button that displays "Cancel".
36 @property(nonatomic, strong) UIButton* cancelButton; 34 @property(nonatomic, strong) UIButton* cancelButton;
37 // Stack view for arranging the buttons. 35 // Stack view for arranging the buttons.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 [_stackView.layoutMarginsGuide.trailingAnchor 97 [_stackView.layoutMarginsGuide.trailingAnchor
100 constraintEqualToAnchor:self.trailingAnchor 98 constraintEqualToAnchor:self.trailingAnchor
101 constant:-kHorizontalMargin], 99 constant:-kHorizontalMargin],
102 [_stackView.topAnchor constraintEqualToAnchor:self.topAnchor], 100 [_stackView.topAnchor constraintEqualToAnchor:self.topAnchor],
103 [_stackView.bottomAnchor constraintEqualToAnchor:self.bottomAnchor], 101 [_stackView.bottomAnchor constraintEqualToAnchor:self.bottomAnchor],
104 ]]; 102 ]];
105 103
106 [self setBackgroundColor:[UIColor whiteColor]]; 104 [self setBackgroundColor:[UIColor whiteColor]];
107 [[self layer] setShadowOpacity:kShadowOpacity]; 105 [[self layer] setShadowOpacity:kShadowOpacity];
108 [self setEditing:NO]; 106 [self setEditing:NO];
109 propertyReleaser_ClearBrowsingBar_.Init(self, [ClearBrowsingBar class]);
110 } 107 }
111 return self; 108 return self;
112 } 109 }
113 110
111 - (void)dealloc {
112 base::mac::ReleaseProperties(self);
113 [super dealloc];
114 }
115
114 #pragma mark Public Methods 116 #pragma mark Public Methods
115 117
116 - (void)setEditing:(BOOL)editing { 118 - (void)setEditing:(BOOL)editing {
117 _editing = editing; 119 _editing = editing;
118 self.clearBrowsingDataButton.hidden = editing; 120 self.clearBrowsingDataButton.hidden = editing;
119 self.editButton.hidden = editing; 121 self.editButton.hidden = editing;
120 self.deleteButton.hidden = !editing; 122 self.deleteButton.hidden = !editing;
121 self.cancelButton.hidden = !editing; 123 self.cancelButton.hidden = !editing;
122 } 124 }
123 125
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 forState:UIControlStateDisabled]; 175 forState:UIControlStateDisabled];
174 [[button titleLabel] 176 [[button titleLabel]
175 setFont:[[MDCTypography fontLoader] regularFontOfSize:14]]; 177 setFont:[[MDCTypography fontLoader] regularFontOfSize:14]];
176 button.contentHorizontalAlignment = 178 button.contentHorizontalAlignment =
177 leading ^ UseRTLLayout() ? UIControlContentHorizontalAlignmentLeft 179 leading ^ UseRTLLayout() ? UIControlContentHorizontalAlignmentLeft
178 : UIControlContentHorizontalAlignmentRight; 180 : UIControlContentHorizontalAlignmentRight;
179 [button setTranslatesAutoresizingMaskIntoConstraints:NO]; 181 [button setTranslatesAutoresizingMaskIntoConstraints:NO];
180 } 182 }
181 183
182 @end 184 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698