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> |
(...skipping 2027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2038 [NSObject cancelPreviousPerformRequestsWithTarget:self]; | 2038 [NSObject cancelPreviousPerformRequestsWithTarget:self]; |
2039 | 2039 |
2040 // This uses a custom animation, so ignore the change that would be triggered | 2040 // This uses a custom animation, so ignore the change that would be triggered |
2041 // by adding a new tab to the model. This is left on since the stack view is | 2041 // by adding a new tab to the model. This is left on since the stack view is |
2042 // going away at this point, so staying in sync doesn't matter any more. | 2042 // going away at this point, so staying in sync doesn't matter any more. |
2043 [_activeCardSet setIgnoresTabModelChanges:YES]; | 2043 [_activeCardSet setIgnoresTabModelChanges:YES]; |
2044 if (position == NSNotFound) | 2044 if (position == NSNotFound) |
2045 position = [_activeCardSet.tabModel count]; | 2045 position = [_activeCardSet.tabModel count]; |
2046 DCHECK(position <= [_activeCardSet.tabModel count]); | 2046 DCHECK(position <= [_activeCardSet.tabModel count]); |
2047 | 2047 |
2048 Tab* tab = [_activeCardSet.tabModel insertOrUpdateTabWithURL:URL | 2048 Tab* tab = [_activeCardSet.tabModel insertTabWithURL:URL |
2049 referrer:web::Referrer() | 2049 referrer:web::Referrer() |
2050 transition:transition | 2050 transition:transition |
2051 windowName:nil | 2051 opener:nil |
2052 opener:nil | 2052 openedByDOM:NO |
2053 openedByDOM:NO | 2053 atIndex:position |
2054 atIndex:position | 2054 inBackground:NO]; |
2055 inBackground:NO]; | |
2056 [_activeCardSet.tabModel setCurrentTab:tab]; | 2055 [_activeCardSet.tabModel setCurrentTab:tab]; |
2057 | 2056 |
2058 [_delegate tabSwitcher:self | 2057 [_delegate tabSwitcher:self |
2059 dismissTransitionWillStartWithActiveModel:_activeCardSet.tabModel]; | 2058 dismissTransitionWillStartWithActiveModel:_activeCardSet.tabModel]; |
2060 | 2059 |
2061 CGFloat statusBarHeight = StatusBarHeight(); | 2060 CGFloat statusBarHeight = StatusBarHeight(); |
2062 CGRect viewBounds, remainder; | 2061 CGRect viewBounds, remainder; |
2063 CGRectDivide([self.view bounds], &remainder, &viewBounds, statusBarHeight, | 2062 CGRectDivide([self.view bounds], &remainder, &viewBounds, statusBarHeight, |
2064 CGRectMinYEdge); | 2063 CGRectMinYEdge); |
2065 UIImageView* newCard = | 2064 UIImageView* newCard = |
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3504 | 3503 |
3505 @end | 3504 @end |
3506 | 3505 |
3507 @implementation StackViewController (Testing) | 3506 @implementation StackViewController (Testing) |
3508 | 3507 |
3509 - (UIScrollView*)scrollView { | 3508 - (UIScrollView*)scrollView { |
3510 return _scrollView.get(); | 3509 return _scrollView.get(); |
3511 } | 3510 } |
3512 | 3511 |
3513 @end | 3512 @end |
OLD | NEW |