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/browser_view_controller.h" | 5 #import "ios/chrome/browser/ui/browser_view_controller.h" |
6 | 6 |
7 #import <AssetsLibrary/AssetsLibrary.h> | 7 #import <AssetsLibrary/AssetsLibrary.h> |
8 #import <MobileCoreServices/MobileCoreServices.h> | 8 #import <MobileCoreServices/MobileCoreServices.h> |
9 #import <PassKit/PassKit.h> | 9 #import <PassKit/PassKit.h> |
10 #import <Photos/Photos.h> | 10 #import <Photos/Photos.h> |
(...skipping 3660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3671 // In debug the app can continue working even after the CHECK. Adding a | 3671 // In debug the app can continue working even after the CHECK. Adding a |
3672 // return avoids the crash url to be added to the history. | 3672 // return avoids the crash url to be added to the history. |
3673 return; | 3673 return; |
3674 } | 3674 } |
3675 | 3675 |
3676 if (url == [_preloadController prerenderedURL]) { | 3676 if (url == [_preloadController prerenderedURL]) { |
3677 Tab* oldTab = [_model currentTab]; | 3677 Tab* oldTab = [_model currentTab]; |
3678 Tab* newTab = [_preloadController releasePrerenderContents]; | 3678 Tab* newTab = [_preloadController releasePrerenderContents]; |
3679 DCHECK(oldTab); | 3679 DCHECK(oldTab); |
3680 DCHECK(newTab); | 3680 DCHECK(newTab); |
3681 if (oldTab && newTab) { | 3681 bool canPruneItems = |
| 3682 [newTab navigationManager]->CanPruneAllButLastCommittedItem(); |
| 3683 if (oldTab && newTab && canPruneItems) { |
3682 [oldTab recordStateInHistory]; | 3684 [oldTab recordStateInHistory]; |
3683 DCHECK([newTab navigationManager]); | 3685 [newTab navigationManager]->CopyStateFromAndPrune( |
3684 CRWSessionController* newHistory = | 3686 [oldTab navigationManager]); |
3685 [newTab navigationManagerImpl]->GetSessionController(); | |
3686 DCHECK([oldTab navigationManager]); | |
3687 CRWSessionController* oldHistory = | |
3688 [oldTab navigationManagerImpl]->GetSessionController(); | |
3689 [newHistory insertStateFromSessionController:oldHistory]; | |
3690 [[newTab nativeAppNavigationController] | 3687 [[newTab nativeAppNavigationController] |
3691 copyStateFrom:[oldTab nativeAppNavigationController]]; | 3688 copyStateFrom:[oldTab nativeAppNavigationController]]; |
3692 [_model replaceTab:oldTab withTab:newTab]; | 3689 [_model replaceTab:oldTab withTab:newTab]; |
3693 | 3690 |
3694 // Set isPrerenderTab to NO after replacing the tab. This will allow the | 3691 // Set isPrerenderTab to NO after replacing the tab. This will allow the |
3695 // BrowserViewController to detect that a pre-rendered tab is switched in, | 3692 // BrowserViewController to detect that a pre-rendered tab is switched in, |
3696 // and show the prerendering animation. | 3693 // and show the prerendering animation. |
3697 newTab.isPrerenderTab = NO; | 3694 newTab.isPrerenderTab = NO; |
3698 | 3695 |
3699 [self tabLoadComplete:newTab withSuccess:newTab.loadFinished]; | 3696 [self tabLoadComplete:newTab withSuccess:newTab.loadFinished]; |
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5129 | 5126 |
5130 - (UIView*)voiceSearchButton { | 5127 - (UIView*)voiceSearchButton { |
5131 return _voiceSearchButton; | 5128 return _voiceSearchButton; |
5132 } | 5129 } |
5133 | 5130 |
5134 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { | 5131 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { |
5135 return [self currentLogoAnimationControllerOwner]; | 5132 return [self currentLogoAnimationControllerOwner]; |
5136 } | 5133 } |
5137 | 5134 |
5138 @end | 5135 @end |
OLD | NEW |