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

Side by Side Diff: ios/chrome/browser/ui/tools_menu/tools_menu_view_tools_cell.mm

Issue 2610923005: Replace ObjCPropertyReleaser with ReleaseProperties() project-wide. (Closed)
Patch Set: Rebase Created 3 years, 7 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/tools_menu/tools_menu_view_tools_cell.h" 5 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_tools_cell.h"
6 6
7 #include "base/mac/objc_property_releaser.h" 7 #include "base/mac/objc_release_properties.h"
8 #include "components/strings/grit/components_strings.h" 8 #include "components/strings/grit/components_strings.h"
9 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" 9 #include "ios/chrome/browser/ui/commands/ios_command_ids.h"
10 #include "ios/chrome/browser/ui/rtl_geometry.h" 10 #include "ios/chrome/browser/ui/rtl_geometry.h"
11 #include "ios/chrome/browser/ui/toolbar/toolbar_resource_macros.h" 11 #include "ios/chrome/browser/ui/toolbar/toolbar_resource_macros.h"
12 #import "ios/chrome/browser/ui/uikit_ui_util.h" 12 #import "ios/chrome/browser/ui/uikit_ui_util.h"
13 #include "ios/chrome/grit/ios_strings.h" 13 #include "ios/chrome/grit/ios_strings.h"
14 14
15 // TODO(crbug.com/228521): Remove this once the new command/metric handling is 15 // TODO(crbug.com/228521): Remove this once the new command/metric handling is
16 // implemented. This is a temporary workaround to allow metrics recording to 16 // implemented. This is a temporary workaround to allow metrics recording to
17 // distinguish the action. The value used is in the dynamic range (< 17 // distinguish the action. The value used is in the dynamic range (<
18 // IDC_MinimumLabelValue) to avoid collisions. 18 // IDC_MinimumLabelValue) to avoid collisions.
19 #define IDC_TEMP_EDIT_BOOKMARK 3900 19 #define IDC_TEMP_EDIT_BOOKMARK 3900
20 20
21 @implementation ToolsMenuViewToolsCell { 21 @implementation ToolsMenuViewToolsCell
22 base::mac::ObjCPropertyReleaser _propertyReleaser_ToolsMenuViewToolsCell;
23 }
24 22
25 @synthesize reloadButton = _reloadButton; 23 @synthesize reloadButton = _reloadButton;
26 @synthesize shareButton = _shareButton; 24 @synthesize shareButton = _shareButton;
27 @synthesize starButton = _starButton; 25 @synthesize starButton = _starButton;
28 @synthesize starredButton = _starredButton; 26 @synthesize starredButton = _starredButton;
29 @synthesize stopButton = _stopButton; 27 @synthesize stopButton = _stopButton;
30 @synthesize toolsButton = _toolsButton; 28 @synthesize toolsButton = _toolsButton;
31 29
32 - (instancetype)initWithCoder:(NSCoder*)aDecoder { 30 - (instancetype)initWithCoder:(NSCoder*)aDecoder {
33 self = [super initWithCoder:aDecoder]; 31 self = [super initWithCoder:aDecoder];
34 if (self) 32 if (self)
35 [self commonInitialization]; 33 [self commonInitialization];
36 34
37 return self; 35 return self;
38 } 36 }
39 37
40 - (instancetype)initWithFrame:(CGRect)frame { 38 - (instancetype)initWithFrame:(CGRect)frame {
41 self = [super initWithFrame:frame]; 39 self = [super initWithFrame:frame];
42 if (self) 40 if (self)
43 [self commonInitialization]; 41 [self commonInitialization];
44 42
45 return self; 43 return self;
46 } 44 }
47 45
48 - (void)commonInitialization { 46 - (void)commonInitialization {
49 _propertyReleaser_ToolsMenuViewToolsCell.Init(self,
50 [ToolsMenuViewToolsCell class]);
51
52 [self setBackgroundColor:[UIColor whiteColor]]; 47 [self setBackgroundColor:[UIColor whiteColor]];
53 [self setOpaque:YES]; 48 [self setOpaque:YES];
54 49
55 int star[2][3] = TOOLBAR_IDR_TWO_STATE(STAR); 50 int star[2][3] = TOOLBAR_IDR_TWO_STATE(STAR);
56 _starButton = [self newButtonForImageIds:star 51 _starButton = [self newButtonForImageIds:star
57 commandID:IDC_BOOKMARK_PAGE 52 commandID:IDC_BOOKMARK_PAGE
58 accessibilityLabelID:IDS_BOOKMARK_ADD_EDITOR_TITLE 53 accessibilityLabelID:IDS_BOOKMARK_ADD_EDITOR_TITLE
59 automationName:@"Add Bookmark"]; 54 automationName:@"Add Bookmark"];
60 55
61 int star_pressed[2][3] = TOOLBAR_IDR_ONE_STATE(STAR_PRESSED); 56 int star_pressed[2][3] = TOOLBAR_IDR_ONE_STATE(STAR_PRESSED);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 90
96 [contentView addSubview:_starredButton]; 91 [contentView addSubview:_starredButton];
97 [contentView addSubview:_starButton]; 92 [contentView addSubview:_starButton];
98 [contentView addSubview:_stopButton]; 93 [contentView addSubview:_stopButton];
99 [contentView addSubview:_reloadButton]; 94 [contentView addSubview:_reloadButton];
100 [contentView addSubview:_shareButton]; 95 [contentView addSubview:_shareButton];
101 96
102 [self addConstraints]; 97 [self addConstraints];
103 } 98 }
104 99
100 - (void)dealloc {
101 base::mac::ReleaseProperties(self);
102 [super dealloc];
103 }
104
105 - (UIButton*)newButtonForImageIds:(int[2][3])imageIds 105 - (UIButton*)newButtonForImageIds:(int[2][3])imageIds
106 commandID:(int)commandID 106 commandID:(int)commandID
107 accessibilityLabelID:(int)labelID 107 accessibilityLabelID:(int)labelID
108 automationName:(NSString*)name { 108 automationName:(NSString*)name {
109 return [self newButtonForImageIds:imageIds 109 return [self newButtonForImageIds:imageIds
110 commandID:commandID 110 commandID:commandID
111 accessibilityLabelID:labelID 111 accessibilityLabelID:labelID
112 automationName:name 112 automationName:name
113 reverseForRTL:NO]; 113 reverseForRTL:NO];
114 } 114 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 if (_reloadButton) 196 if (_reloadButton)
197 [allButtons addObject:_reloadButton]; 197 [allButtons addObject:_reloadButton];
198 198
199 if (_stopButton) 199 if (_stopButton)
200 [allButtons addObject:_stopButton]; 200 [allButtons addObject:_stopButton];
201 201
202 return allButtons; 202 return allButtons;
203 } 203 }
204 204
205 @end 205 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/tools_menu/tools_menu_view_item.mm ('k') | ios/web/public/origin_util_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698