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

Side by Side Diff: ios/chrome/browser/ui/tabs/tab_view.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 1
2 // Copyright 2012 The Chromium Authors. All rights reserved. 2 // Copyright 2012 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 #import "ios/chrome/browser/ui/tabs/tab_view.h" 6 #import "ios/chrome/browser/ui/tabs/tab_view.h"
7 7
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/ios/ios_util.h" 9 #include "base/ios/ios_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/mac/objc_property_releaser.h" 11 #include "base/mac/objc_release_properties.h"
12 #include "base/strings/sys_string_conversions.h" 12 #include "base/strings/sys_string_conversions.h"
13 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" 13 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
14 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" 14 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
15 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" 15 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
16 #import "ios/chrome/browser/ui/image_util.h" 16 #import "ios/chrome/browser/ui/image_util.h"
17 #include "ios/chrome/browser/ui/rtl_geometry.h" 17 #include "ios/chrome/browser/ui/rtl_geometry.h"
18 #include "ios/chrome/browser/ui/ui_util.h" 18 #include "ios/chrome/browser/ui/ui_util.h"
19 #import "ios/chrome/browser/ui/uikit_ui_util.h" 19 #import "ios/chrome/browser/ui/uikit_ui_util.h"
20 #include "ios/chrome/grit/ios_strings.h" 20 #include "ios/chrome/grit/ios_strings.h"
21 #import "ios/third_party/material_components_ios/src/components/ActivityIndicato r/src/MaterialActivityIndicator.h" 21 #import "ios/third_party/material_components_ios/src/components/ActivityIndicato r/src/MaterialActivityIndicator.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // Set to YES when the layout constraints have been initialized. 65 // Set to YES when the layout constraints have been initialized.
66 BOOL _layoutConstraintsInitialized; 66 BOOL _layoutConstraintsInitialized;
67 67
68 // Image view used to draw the favicon and spinner. 68 // Image view used to draw the favicon and spinner.
69 base::scoped_nsobject<UIImageView> _faviconView; 69 base::scoped_nsobject<UIImageView> _faviconView;
70 70
71 // If |YES|, this view will adjust its appearance and draw as a collapsed tab. 71 // If |YES|, this view will adjust its appearance and draw as a collapsed tab.
72 BOOL _collapsed; 72 BOOL _collapsed;
73 73
74 base::scoped_nsobject<MDCActivityIndicator> _activityIndicator; 74 base::scoped_nsobject<MDCActivityIndicator> _activityIndicator;
75
76 base::mac::ObjCPropertyReleaser _propertyReleaser_TabView;
77 } 75 }
78 @end 76 @end
79 77
80 @interface TabView (Private) 78 @interface TabView (Private)
81 79
82 // Creates the close button, favicon button, and title. 80 // Creates the close button, favicon button, and title.
83 - (void)createButtonsAndLabel; 81 - (void)createButtonsAndLabel;
84 82
85 // Updates this tab's line separator color based on the current incognito style. 83 // Updates this tab's line separator color based on the current incognito style.
86 - (void)updateLineSeparator; 84 - (void)updateLineSeparator;
(...skipping 21 matching lines...) Expand all
108 @implementation TabView 106 @implementation TabView
109 107
110 @synthesize closeButton = _closeButton; 108 @synthesize closeButton = _closeButton;
111 @synthesize titleLabel = _titleLabel; 109 @synthesize titleLabel = _titleLabel;
112 @synthesize collapsed = _collapsed; 110 @synthesize collapsed = _collapsed;
113 @synthesize background = background_; 111 @synthesize background = background_;
114 @synthesize incognitoStyle = _incognitoStyle; 112 @synthesize incognitoStyle = _incognitoStyle;
115 113
116 - (id)initWithEmptyView:(BOOL)emptyView selected:(BOOL)selected { 114 - (id)initWithEmptyView:(BOOL)emptyView selected:(BOOL)selected {
117 if ((self = [super initWithFrame:CGRectZero])) { 115 if ((self = [super initWithFrame:CGRectZero])) {
118 _propertyReleaser_TabView.Init(self, [TabView class]);
119 [self setOpaque:NO]; 116 [self setOpaque:NO];
120 [self createCommonViews]; 117 [self createCommonViews];
121 // -setSelected only calls -updateBackgroundImage if the selected state 118 // -setSelected only calls -updateBackgroundImage if the selected state
122 // changes. |isSelected| defaults to NO, so if |selected| is also NO, 119 // changes. |isSelected| defaults to NO, so if |selected| is also NO,
123 // -updateBackgroundImage needs to be called explicitly. 120 // -updateBackgroundImage needs to be called explicitly.
124 [self setSelected:selected]; 121 [self setSelected:selected];
125 [self updateLineSeparator]; 122 [self updateLineSeparator];
126 [self updateBackgroundImage:selected]; 123 [self updateBackgroundImage:selected];
127 if (!emptyView) 124 if (!emptyView)
128 [self createButtonsAndLabel]; 125 [self createButtonsAndLabel];
129 } 126 }
130 return self; 127 return self;
131 } 128 }
132 129
130 - (void)dealloc {
131 base::mac::ReleaseProperties(self);
132 [super dealloc];
133 }
134
133 - (void)setSelected:(BOOL)selected { 135 - (void)setSelected:(BOOL)selected {
134 BOOL wasSelected = [self isSelected]; 136 BOOL wasSelected = [self isSelected];
135 [super setSelected:selected]; 137 [super setSelected:selected];
136 138
137 [_lineSeparator setHidden:selected]; 139 [_lineSeparator setHidden:selected];
138 140
139 if (selected != wasSelected) 141 if (selected != wasSelected)
140 [self updateBackgroundImage:selected]; 142 [self updateBackgroundImage:selected];
141 143
142 // It would make more sense to set active/inactive on tab_view itself, but 144 // It would make more sense to set active/inactive on tab_view itself, but
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 [_closeButton setImage:normalImage forState:UIControlStateNormal]; 372 [_closeButton setImage:normalImage forState:UIControlStateNormal];
371 [_closeButton setImage:pressedImage forState:UIControlStateHighlighted]; 373 [_closeButton setImage:pressedImage forState:UIControlStateHighlighted];
372 } 374 }
373 375
374 - (UIImage*)defaultFaviconImage { 376 - (UIImage*)defaultFaviconImage {
375 return self.incognitoStyle ? [UIImage imageNamed:@"default_favicon_incognito"] 377 return self.incognitoStyle ? [UIImage imageNamed:@"default_favicon_incognito"]
376 : [UIImage imageNamed:@"default_favicon"]; 378 : [UIImage imageNamed:@"default_favicon"];
377 } 379 }
378 380
379 @end 381 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/tabs/tab_strip_controller.mm ('k') | ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698