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 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1632 // tab's view hasn't been displayed yet because it was in a new tab | 1632 // tab's view hasn't been displayed yet because it was in a new tab |
1633 // animation. | 1633 // animation. |
1634 Tab* currentTab = [_model currentTab]; | 1634 Tab* currentTab = [_model currentTab]; |
1635 if (currentTab) { | 1635 if (currentTab) { |
1636 [self tabSelected:currentTab]; | 1636 [self tabSelected:currentTab]; |
1637 } | 1637 } |
1638 startVoiceSearchIfNecessaryBlock(); | 1638 startVoiceSearchIfNecessaryBlock(); |
1639 | 1639 |
1640 if (self.foregroundTabWasAddedCompletionBlock) { | 1640 if (self.foregroundTabWasAddedCompletionBlock) { |
1641 self.foregroundTabWasAddedCompletionBlock(); | 1641 self.foregroundTabWasAddedCompletionBlock(); |
| 1642 self.foregroundTabWasAddedCompletionBlock = nil; |
1642 } | 1643 } |
1643 }); | 1644 }); |
1644 } else { | 1645 } else { |
1645 // -updateSnapshotWithOverlay will force a screen redraw, so take the | 1646 // -updateSnapshotWithOverlay will force a screen redraw, so take the |
1646 // snapshot before adding the views needed for the background animation. | 1647 // snapshot before adding the views needed for the background animation. |
1647 Tab* topTab = [_model currentTab]; | 1648 Tab* topTab = [_model currentTab]; |
1648 UIImage* image = [topTab updateSnapshotWithOverlay:YES | 1649 UIImage* image = [topTab updateSnapshotWithOverlay:YES |
1649 visibleFrameOnly:self.isToolbarOnScreen]; | 1650 visibleFrameOnly:self.isToolbarOnScreen]; |
1650 // Add three layers in order on top of the contentArea for the animation: | 1651 // Add three layers in order on top of the contentArea for the animation: |
1651 // 1. The black "background" screen. | 1652 // 1. The black "background" screen. |
(...skipping 18 matching lines...) Expand all Loading... |
1670 [topCard removeFromSuperview]; | 1671 [topCard removeFromSuperview]; |
1671 self.inNewTabAnimation = NO; | 1672 self.inNewTabAnimation = NO; |
1672 // Resnapshot the top card if it has its own toolbar, as the toolbar | 1673 // Resnapshot the top card if it has its own toolbar, as the toolbar |
1673 // will be captured in the new tab animation, but isn't desired for | 1674 // will be captured in the new tab animation, but isn't desired for |
1674 // the stack view snapshots. | 1675 // the stack view snapshots. |
1675 id nativeController = [self nativeControllerForTab:topTab]; | 1676 id nativeController = [self nativeControllerForTab:topTab]; |
1676 if ([nativeController conformsToProtocol:@protocol(ToolbarOwner)]) | 1677 if ([nativeController conformsToProtocol:@protocol(ToolbarOwner)]) |
1677 [topTab updateSnapshotWithOverlay:YES visibleFrameOnly:YES]; | 1678 [topTab updateSnapshotWithOverlay:YES visibleFrameOnly:YES]; |
1678 startVoiceSearchIfNecessaryBlock(); | 1679 startVoiceSearchIfNecessaryBlock(); |
1679 }); | 1680 }); |
| 1681 // Reset the foreground tab completion block so that it can never be |
| 1682 // called more than once regardless of foreground/background tab |
| 1683 // appearances. |
| 1684 self.foregroundTabWasAddedCompletionBlock = nil; |
1680 } | 1685 } |
1681 // Reset the foreground tab completion block so that it can never be | |
1682 // called more than once regardless of foreground/background tab appearances. | |
1683 self.foregroundTabWasAddedCompletionBlock = nil; | |
1684 } | 1686 } |
1685 | 1687 |
1686 #pragma mark - UI Configuration and Layout | 1688 #pragma mark - UI Configuration and Layout |
1687 | 1689 |
1688 - (void)updateWithTabModel:(TabModel*)model | 1690 - (void)updateWithTabModel:(TabModel*)model |
1689 browserState:(ios::ChromeBrowserState*)browserState { | 1691 browserState:(ios::ChromeBrowserState*)browserState { |
1690 DCHECK(model); | 1692 DCHECK(model); |
1691 DCHECK(browserState); | 1693 DCHECK(browserState); |
1692 DCHECK(!_model); | 1694 DCHECK(!_model); |
1693 DCHECK(!_browserState); | 1695 DCHECK(!_browserState); |
(...skipping 3546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5240 | 5242 |
5241 - (UIView*)voiceSearchButton { | 5243 - (UIView*)voiceSearchButton { |
5242 return _voiceSearchButton; | 5244 return _voiceSearchButton; |
5243 } | 5245 } |
5244 | 5246 |
5245 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { | 5247 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { |
5246 return [self currentLogoAnimationControllerOwner]; | 5248 return [self currentLogoAnimationControllerOwner]; |
5247 } | 5249 } |
5248 | 5250 |
5249 @end | 5251 @end |
OLD | NEW |