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

Side by Side Diff: ios/chrome/browser/ui/tabs/tab_strip_controller.mm

Issue 2881183002: Revert of Replace ObjCPropertyReleaser with ReleaseProperties() project-wide. (Closed)
Patch Set: 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_release_properties.h" 15 #include "base/mac/objc_property_releaser.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;
186 } 188 }
187 189
188 @property(nonatomic, readonly, retain) TabStripView* tabStripView; 190 @property(nonatomic, readonly, retain) TabStripView* tabStripView;
189 @property(nonatomic, readonly, retain) UIButton* buttonNewTab; 191 @property(nonatomic, readonly, retain) UIButton* buttonNewTab;
190 192
191 // Initializes the tab array based on the the entries in the TabModel. Creates 193 // Initializes the tab array based on the the entries in the TabModel. Creates
192 // one TabView per Tab and adds it to the tabstrip. A later call to 194 // one TabView per Tab and adds it to the tabstrip. A later call to
193 // |-layoutTabs| is needed to properly place the tabs in the correct positions. 195 // |-layoutTabs| is needed to properly place the tabs in the correct positions.
194 - (void)initializeTabArrayFromTabModel; 196 - (void)initializeTabArrayFromTabModel;
195 197
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 @implementation TabStripController 319 @implementation TabStripController
318 320
319 @synthesize buttonNewTab = _buttonNewTab; 321 @synthesize buttonNewTab = _buttonNewTab;
320 @synthesize highlightsSelectedTab = _highlightsSelectedTab; 322 @synthesize highlightsSelectedTab = _highlightsSelectedTab;
321 @synthesize tabStripView = _tabStripView; 323 @synthesize tabStripView = _tabStripView;
322 @synthesize view = _view; 324 @synthesize view = _view;
323 325
324 - (instancetype)initWithTabModel:(TabModel*)tabModel 326 - (instancetype)initWithTabModel:(TabModel*)tabModel
325 style:(TabStrip::Style)style { 327 style:(TabStrip::Style)style {
326 if ((self = [super init])) { 328 if ((self = [super init])) {
329 _propertyReleaser_TabStripController.Init(self, [TabStripController class]);
327 _tabArray.reset([[NSMutableArray alloc] initWithCapacity:10]); 330 _tabArray.reset([[NSMutableArray alloc] initWithCapacity:10]);
328 _closingTabs.reset([[NSMutableSet alloc] initWithCapacity:5]); 331 _closingTabs.reset([[NSMutableSet alloc] initWithCapacity:5]);
329 332
330 _tabModel.reset([tabModel retain]); 333 _tabModel.reset([tabModel retain]);
331 [_tabModel addObserver:self]; 334 [_tabModel addObserver:self];
332 _style = style; 335 _style = style;
333 336
334 // |self.view| setup. 337 // |self.view| setup.
335 CGRect tabStripFrame = [UIApplication sharedApplication].keyWindow.bounds; 338 CGRect tabStripFrame = [UIApplication sharedApplication].keyWindow.bounds;
336 tabStripFrame.size.height = kTabStripHeight; 339 tabStripFrame.size.height = kTabStripHeight;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 425
423 - (instancetype)init { 426 - (instancetype)init {
424 NOTREACHED(); 427 NOTREACHED();
425 return nil; 428 return nil;
426 } 429 }
427 430
428 - (void)dealloc { 431 - (void)dealloc {
429 [_tabStripView setDelegate:nil]; 432 [_tabStripView setDelegate:nil];
430 [_tabStripView setLayoutDelegate:nil]; 433 [_tabStripView setLayoutDelegate:nil];
431 [_tabModel removeObserver:self]; 434 [_tabModel removeObserver:self];
432 base::mac::ReleaseProperties(self);
433 [super dealloc]; 435 [super dealloc];
434 } 436 }
435 437
436 - (id<FullScreenControllerDelegate>)fullscreenDelegate { 438 - (id<FullScreenControllerDelegate>)fullscreenDelegate {
437 return _fullscreenDelegate; 439 return _fullscreenDelegate;
438 } 440 }
439 441
440 - (void)setFullscreenDelegate: 442 - (void)setFullscreenDelegate:
441 (id<FullScreenControllerDelegate>)fullscreenDelegate { 443 (id<FullScreenControllerDelegate>)fullscreenDelegate {
442 _fullscreenDelegate.reset(fullscreenDelegate); 444 _fullscreenDelegate.reset(fullscreenDelegate);
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 1592
1591 @implementation TabStripController (Testing) 1593 @implementation TabStripController (Testing)
1592 1594
1593 - (TabView*)existingTabViewForTab:(Tab*)tab { 1595 - (TabView*)existingTabViewForTab:(Tab*)tab {
1594 NSUInteger tabIndex = [_tabModel indexOfTab:tab]; 1596 NSUInteger tabIndex = [_tabModel indexOfTab:tab];
1595 NSUInteger tabViewIndex = [self indexForModelIndex:tabIndex]; 1597 NSUInteger tabViewIndex = [self indexForModelIndex:tabIndex];
1596 return [_tabArray objectAtIndex:tabViewIndex]; 1598 return [_tabArray objectAtIndex:tabViewIndex];
1597 } 1599 }
1598 1600
1599 @end 1601 @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