| OLD | NEW |
| 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/stack_view/stack_view_controller.h" | 5 #import "ios/chrome/browser/ui/stack_view/stack_view_controller.h" |
| 6 | 6 |
| 7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| 11 #include <limits> | 11 #include <limits> |
| 12 | 12 |
| 13 #include "base/format_macros.h" | 13 #include "base/format_macros.h" |
| 14 #import "base/ios/block_types.h" | 14 #import "base/ios/block_types.h" |
| 15 #import "base/ios/weak_nsobject.h" | 15 #import "base/ios/weak_nsobject.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #import "base/mac/bundle_locations.h" | 17 #import "base/mac/bundle_locations.h" |
| 18 #import "base/mac/foundation_util.h" | 18 #import "base/mac/foundation_util.h" |
| 19 #import "base/mac/objc_property_releaser.h" | 19 #include "base/mac/objc_release_properties.h" |
| 20 #include "base/mac/scoped_block.h" | 20 #include "base/mac/scoped_block.h" |
| 21 #import "base/mac/scoped_nsobject.h" | 21 #import "base/mac/scoped_nsobject.h" |
| 22 #include "base/metrics/histogram_macros.h" | 22 #include "base/metrics/histogram_macros.h" |
| 23 #include "base/metrics/user_metrics.h" | 23 #include "base/metrics/user_metrics.h" |
| 24 #include "base/metrics/user_metrics_action.h" | 24 #include "base/metrics/user_metrics_action.h" |
| 25 #include "base/strings/sys_string_conversions.h" | 25 #include "base/strings/sys_string_conversions.h" |
| 26 #include "ios/chrome/browser/chrome_url_constants.h" | 26 #include "ios/chrome/browser/chrome_url_constants.h" |
| 27 #include "ios/chrome/browser/experimental_flags.h" | 27 #include "ios/chrome/browser/experimental_flags.h" |
| 28 #import "ios/chrome/browser/tabs/tab.h" | 28 #import "ios/chrome/browser/tabs/tab.h" |
| 29 #import "ios/chrome/browser/tabs/tab_model.h" | 29 #import "ios/chrome/browser/tabs/tab_model.h" |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 base::scoped_nsobject<StackCard> _reverseDismissCard; | 482 base::scoped_nsobject<StackCard> _reverseDismissCard; |
| 483 // |YES| if the stack view is in the process of being dismissed. | 483 // |YES| if the stack view is in the process of being dismissed. |
| 484 BOOL _isBeingDismissed; | 484 BOOL _isBeingDismissed; |
| 485 // |YES| if the stack view is currently active. | 485 // |YES| if the stack view is currently active. |
| 486 BOOL _isActive; | 486 BOOL _isActive; |
| 487 // Records whether a memory warning occurred in the current session. | 487 // Records whether a memory warning occurred in the current session. |
| 488 BOOL _receivedMemoryWarningInSession; | 488 BOOL _receivedMemoryWarningInSession; |
| 489 // |YES| if there is card set animation being processed. For testing only. | 489 // |YES| if there is card set animation being processed. For testing only. |
| 490 // Save last touch point used by new tab animation. | 490 // Save last touch point used by new tab animation. |
| 491 CGPoint _lastTapPoint; | 491 CGPoint _lastTapPoint; |
| 492 | |
| 493 base::mac::ObjCPropertyReleaser _propertyReleaserStackViewController; | |
| 494 } | 492 } |
| 495 | 493 |
| 496 @synthesize activeCardSet = _activeCardSet; | 494 @synthesize activeCardSet = _activeCardSet; |
| 497 @synthesize delegate = _delegate; | 495 @synthesize delegate = _delegate; |
| 498 @synthesize dummyToolbarBackgroundView = _dummyToolbarBackgroundView; | 496 @synthesize dummyToolbarBackgroundView = _dummyToolbarBackgroundView; |
| 499 @synthesize inActiveDeckChangeAnimation = _inActiveDeckChangeAnimation; | 497 @synthesize inActiveDeckChangeAnimation = _inActiveDeckChangeAnimation; |
| 500 @synthesize testDelegate = _testDelegate; | 498 @synthesize testDelegate = _testDelegate; |
| 501 @synthesize transitionStyle = _transitionStyle; | 499 @synthesize transitionStyle = _transitionStyle; |
| 502 @synthesize transitionTappedCard = _transitionTappedCard; | 500 @synthesize transitionTappedCard = _transitionTappedCard; |
| 503 @synthesize transitionToolbarController = _transitionToolbarController; | 501 @synthesize transitionToolbarController = _transitionToolbarController; |
| 504 @synthesize transitionToolbarFrame = _transitionToolbarFrame; | 502 @synthesize transitionToolbarFrame = _transitionToolbarFrame; |
| 505 @synthesize transitionToolbarOwner = _transitionToolbarOwner; | 503 @synthesize transitionToolbarOwner = _transitionToolbarOwner; |
| 506 @synthesize transitionWasCancelled = _transitionWasCancelled; | 504 @synthesize transitionWasCancelled = _transitionWasCancelled; |
| 507 | 505 |
| 508 - (instancetype)initWithMainCardSet:(CardSet*)mainCardSet | 506 - (instancetype)initWithMainCardSet:(CardSet*)mainCardSet |
| 509 otrCardSet:(CardSet*)otrCardSet | 507 otrCardSet:(CardSet*)otrCardSet |
| 510 activeCardSet:(CardSet*)activeCardSet { | 508 activeCardSet:(CardSet*)activeCardSet { |
| 511 DCHECK(mainCardSet); | 509 DCHECK(mainCardSet); |
| 512 DCHECK(otrCardSet); | 510 DCHECK(otrCardSet); |
| 513 DCHECK(activeCardSet == otrCardSet || activeCardSet == mainCardSet); | 511 DCHECK(activeCardSet == otrCardSet || activeCardSet == mainCardSet); |
| 514 self = [super initWithNibName:nil bundle:nil]; | 512 self = [super initWithNibName:nil bundle:nil]; |
| 515 if (self) { | 513 if (self) { |
| 516 _propertyReleaserStackViewController.Init(self, | |
| 517 [StackViewController class]); | |
| 518 [self setUpWithMainCardSet:mainCardSet | 514 [self setUpWithMainCardSet:mainCardSet |
| 519 otrCardSet:otrCardSet | 515 otrCardSet:otrCardSet |
| 520 activeCardSet:activeCardSet]; | 516 activeCardSet:activeCardSet]; |
| 521 _swipeDismissesCardRecognizer.reset([[UILongPressGestureRecognizer alloc] | 517 _swipeDismissesCardRecognizer.reset([[UILongPressGestureRecognizer alloc] |
| 522 initWithTarget:self | 518 initWithTarget:self |
| 523 action:@selector(handleLongPressFrom:)]); | 519 action:@selector(handleLongPressFrom:)]); |
| 524 [_swipeDismissesCardRecognizer | 520 [_swipeDismissesCardRecognizer |
| 525 setMinimumPressDuration: | 521 setMinimumPressDuration: |
| 526 kPressDurationForAmbiguousSwipeToTriggerDismissal]; | 522 kPressDurationForAmbiguousSwipeToTriggerDismissal]; |
| 527 [_swipeDismissesCardRecognizer setDelegate:self]; | 523 [_swipeDismissesCardRecognizer setDelegate:self]; |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 } | 805 } |
| 810 | 806 |
| 811 - (void)dealloc { | 807 - (void)dealloc { |
| 812 [_mainCardSet clearGestureRecognizerTargetAndDelegateFromCards:self]; | 808 [_mainCardSet clearGestureRecognizerTargetAndDelegateFromCards:self]; |
| 813 [_otrCardSet clearGestureRecognizerTargetAndDelegateFromCards:self]; | 809 [_otrCardSet clearGestureRecognizerTargetAndDelegateFromCards:self]; |
| 814 // Card sets shouldn't have any other references, but nil the observer just | 810 // Card sets shouldn't have any other references, but nil the observer just |
| 815 // in case one somehow does end up with another ref. | 811 // in case one somehow does end up with another ref. |
| 816 [_mainCardSet setObserver:nil]; | 812 [_mainCardSet setObserver:nil]; |
| 817 [_otrCardSet setObserver:nil]; | 813 [_otrCardSet setObserver:nil]; |
| 818 [self cleanUpViewsAndNotifications]; | 814 [self cleanUpViewsAndNotifications]; |
| 815 base::mac::ReleaseProperties(self); |
| 819 [super dealloc]; | 816 [super dealloc]; |
| 820 } | 817 } |
| 821 | 818 |
| 822 // Overridden to always return NO, ensuring that the status bar shows in | 819 // Overridden to always return NO, ensuring that the status bar shows in |
| 823 // landscape on iOS8. | 820 // landscape on iOS8. |
| 824 - (BOOL)prefersStatusBarHidden { | 821 - (BOOL)prefersStatusBarHidden { |
| 825 return NO; | 822 return NO; |
| 826 } | 823 } |
| 827 | 824 |
| 828 // Called when in the foreground and the OS needs more memory. Release as much | 825 // Called when in the foreground and the OS needs more memory. Release as much |
| (...skipping 2674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3503 | 3500 |
| 3504 @end | 3501 @end |
| 3505 | 3502 |
| 3506 @implementation StackViewController (Testing) | 3503 @implementation StackViewController (Testing) |
| 3507 | 3504 |
| 3508 - (UIScrollView*)scrollView { | 3505 - (UIScrollView*)scrollView { |
| 3509 return _scrollView.get(); | 3506 return _scrollView.get(); |
| 3510 } | 3507 } |
| 3511 | 3508 |
| 3512 @end | 3509 @end |
| OLD | NEW |