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

Side by Side Diff: ios/chrome/browser/ui/tabs/tab_strip_controller.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/tabs/tab_strip_controller.h" 5 #import "ios/chrome/browser/ui/tabs/tab_strip_controller.h"
6 #import "ios/chrome/browser/ui/tabs/tab_strip_controller_private.h" 6 #import "ios/chrome/browser/ui/tabs/tab_strip_controller_private.h"
7 7
8 #include <cmath> 8 #include <cmath>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/i18n/rtl.h" 11 #include "base/i18n/rtl.h"
12 #import "base/ios/weak_nsobject.h" 12 #import "base/ios/weak_nsobject.h"
13 #include "base/mac/bundle_locations.h" 13 #include "base/mac/bundle_locations.h"
14 #include "base/mac/foundation_util.h" 14 #include "base/mac/foundation_util.h"
15 #include "base/mac/objc_property_releaser.h" 15 #include "base/mac/objc_release_properties.h"
16 #include "base/mac/scoped_nsobject.h" 16 #include "base/mac/scoped_nsobject.h"
17 #include "base/metrics/user_metrics.h" 17 #include "base/metrics/user_metrics.h"
18 #include "base/metrics/user_metrics_action.h" 18 #include "base/metrics/user_metrics_action.h"
19 #include "base/strings/sys_string_conversions.h" 19 #include "base/strings/sys_string_conversions.h"
20 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 20 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
21 #include "ios/chrome/browser/experimental_flags.h" 21 #include "ios/chrome/browser/experimental_flags.h"
22 #import "ios/chrome/browser/tabs/tab.h" 22 #import "ios/chrome/browser/tabs/tab.h"
23 #import "ios/chrome/browser/tabs/tab_model.h" 23 #import "ios/chrome/browser/tabs/tab_model.h"
24 #import "ios/chrome/browser/tabs/tab_model_observer.h" 24 #import "ios/chrome/browser/tabs/tab_model_observer.h"
25 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" 25 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // Owned by its runloop. 176 // Owned by its runloop.
177 NSTimer* _autoscrollTimer; // weak 177 NSTimer* _autoscrollTimer; // weak
178 178
179 // The distance to scroll for each autoscroll timer tick. If negative, the 179 // The distance to scroll for each autoscroll timer tick. If negative, the
180 // tabstrip will scroll to the left; if positive, to the right. 180 // tabstrip will scroll to the left; if positive, to the right.
181 CGFloat _autoscrollDistance; 181 CGFloat _autoscrollDistance;
182 182
183 // The model index of the placeholder gap, if one exists. This value is used 183 // The model index of the placeholder gap, if one exists. This value is used
184 // as the new model index of the dragged tab when it is dropped. 184 // as the new model index of the dragged tab when it is dropped.
185 NSUInteger _placeholderGapModelIndex; 185 NSUInteger _placeholderGapModelIndex;
186
187 base::mac::ObjCPropertyReleaser _propertyReleaser_TabStripController;
188 } 186 }
189 187
190 @property(nonatomic, readonly, retain) TabStripView* tabStripView; 188 @property(nonatomic, readonly, retain) TabStripView* tabStripView;
191 @property(nonatomic, readonly, retain) UIButton* buttonNewTab; 189 @property(nonatomic, readonly, retain) UIButton* buttonNewTab;
192 190
193 // Initializes the tab array based on the the entries in the TabModel. Creates 191 // Initializes the tab array based on the the entries in the TabModel. Creates
194 // one TabView per Tab and adds it to the tabstrip. A later call to 192 // one TabView per Tab and adds it to the tabstrip. A later call to
195 // |-layoutTabs| is needed to properly place the tabs in the correct positions. 193 // |-layoutTabs| is needed to properly place the tabs in the correct positions.
196 - (void)initializeTabArrayFromTabModel; 194 - (void)initializeTabArrayFromTabModel;
197 195
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 @implementation TabStripController 317 @implementation TabStripController
320 318
321 @synthesize buttonNewTab = _buttonNewTab; 319 @synthesize buttonNewTab = _buttonNewTab;
322 @synthesize highlightsSelectedTab = _highlightsSelectedTab; 320 @synthesize highlightsSelectedTab = _highlightsSelectedTab;
323 @synthesize tabStripView = _tabStripView; 321 @synthesize tabStripView = _tabStripView;
324 @synthesize view = _view; 322 @synthesize view = _view;
325 323
326 - (instancetype)initWithTabModel:(TabModel*)tabModel 324 - (instancetype)initWithTabModel:(TabModel*)tabModel
327 style:(TabStrip::Style)style { 325 style:(TabStrip::Style)style {
328 if ((self = [super init])) { 326 if ((self = [super init])) {
329 _propertyReleaser_TabStripController.Init(self, [TabStripController class]);
330 _tabArray.reset([[NSMutableArray alloc] initWithCapacity:10]); 327 _tabArray.reset([[NSMutableArray alloc] initWithCapacity:10]);
331 _closingTabs.reset([[NSMutableSet alloc] initWithCapacity:5]); 328 _closingTabs.reset([[NSMutableSet alloc] initWithCapacity:5]);
332 329
333 _tabModel.reset([tabModel retain]); 330 _tabModel.reset([tabModel retain]);
334 [_tabModel addObserver:self]; 331 [_tabModel addObserver:self];
335 _style = style; 332 _style = style;
336 333
337 // |self.view| setup. 334 // |self.view| setup.
338 CGRect tabStripFrame = [UIApplication sharedApplication].keyWindow.bounds; 335 CGRect tabStripFrame = [UIApplication sharedApplication].keyWindow.bounds;
339 tabStripFrame.size.height = kTabStripHeight; 336 tabStripFrame.size.height = kTabStripHeight;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 422
426 - (instancetype)init { 423 - (instancetype)init {
427 NOTREACHED(); 424 NOTREACHED();
428 return nil; 425 return nil;
429 } 426 }
430 427
431 - (void)dealloc { 428 - (void)dealloc {
432 [_tabStripView setDelegate:nil]; 429 [_tabStripView setDelegate:nil];
433 [_tabStripView setLayoutDelegate:nil]; 430 [_tabStripView setLayoutDelegate:nil];
434 [_tabModel removeObserver:self]; 431 [_tabModel removeObserver:self];
432 base::mac::ReleaseProperties(self);
435 [super dealloc]; 433 [super dealloc];
436 } 434 }
437 435
438 - (id<FullScreenControllerDelegate>)fullscreenDelegate { 436 - (id<FullScreenControllerDelegate>)fullscreenDelegate {
439 return _fullscreenDelegate; 437 return _fullscreenDelegate;
440 } 438 }
441 439
442 - (void)setFullscreenDelegate: 440 - (void)setFullscreenDelegate:
443 (id<FullScreenControllerDelegate>)fullscreenDelegate { 441 (id<FullScreenControllerDelegate>)fullscreenDelegate {
444 _fullscreenDelegate.reset(fullscreenDelegate); 442 _fullscreenDelegate.reset(fullscreenDelegate);
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 1590
1593 @implementation TabStripController (Testing) 1591 @implementation TabStripController (Testing)
1594 1592
1595 - (TabView*)existingTabViewForTab:(Tab*)tab { 1593 - (TabView*)existingTabViewForTab:(Tab*)tab {
1596 NSUInteger tabIndex = [_tabModel indexOfTab:tab]; 1594 NSUInteger tabIndex = [_tabModel indexOfTab:tab];
1597 NSUInteger tabViewIndex = [self indexForModelIndex:tabIndex]; 1595 NSUInteger tabViewIndex = [self indexForModelIndex:tabIndex];
1598 return [_tabArray objectAtIndex:tabViewIndex]; 1596 return [_tabArray objectAtIndex:tabViewIndex];
1599 } 1597 }
1600 1598
1601 @end 1599 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/stack_view/stack_view_controller.mm ('k') | ios/chrome/browser/ui/tabs/tab_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698