| 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/app/main_controller.h" | 5 #import "ios/chrome/app/main_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #import <CoreSpotlight/CoreSpotlight.h> | 10 #import <CoreSpotlight/CoreSpotlight.h> |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 // corresponding function to return YES. | 527 // corresponding function to return YES. |
| 528 // Initializes the application to INITIALIZATION_STAGE_BASIC, which is the | 528 // Initializes the application to INITIALIZATION_STAGE_BASIC, which is the |
| 529 // minimum initialization needed in all cases. | 529 // minimum initialization needed in all cases. |
| 530 - (void)startUpBrowserBasicInitialization; | 530 - (void)startUpBrowserBasicInitialization; |
| 531 // Initializes the application to INITIALIZATION_STAGE_BACKGROUND, which is | 531 // Initializes the application to INITIALIZATION_STAGE_BACKGROUND, which is |
| 532 // needed by background handlers. | 532 // needed by background handlers. |
| 533 - (void)startUpBrowserBackgroundInitialization; | 533 - (void)startUpBrowserBackgroundInitialization; |
| 534 // Initializes the application to INITIALIZATION_STAGE_FOREGROUND, which is | 534 // Initializes the application to INITIALIZATION_STAGE_FOREGROUND, which is |
| 535 // needed when application runs in foreground. | 535 // needed when application runs in foreground. |
| 536 - (void)startUpBrowserForegroundInitialization; | 536 - (void)startUpBrowserForegroundInitialization; |
| 537 // Swaps the UI between Incognito and normal modes. | |
| 538 - (void)swapBrowserModes; | |
| 539 @end | 537 @end |
| 540 | 538 |
| 541 @implementation MainController | 539 @implementation MainController |
| 542 | 540 |
| 543 @synthesize appState = _appState; | 541 @synthesize appState = _appState; |
| 544 @synthesize appLaunchTime = _appLaunchTime; | 542 @synthesize appLaunchTime = _appLaunchTime; |
| 545 @synthesize browserInitializationStage = _browserInitializationStage; | 543 @synthesize browserInitializationStage = _browserInitializationStage; |
| 546 @synthesize window = _window; | 544 @synthesize window = _window; |
| 547 @synthesize isPresentingFirstRunUI = _isPresentingFirstRunUI; | 545 @synthesize isPresentingFirstRunUI = _isPresentingFirstRunUI; |
| 548 @synthesize isColdStart = _isColdStart; | 546 @synthesize isColdStart = _isColdStart; |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 }; | 811 }; |
| 814 [self.browsingDataRemovalController | 812 [self.browsingDataRemovalController |
| 815 removeIOSSpecificIncognitoBrowsingDataFromBrowserState:otrBrowserState | 813 removeIOSSpecificIncognitoBrowsingDataFromBrowserState:otrBrowserState |
| 816 mask:removeAllMask | 814 mask:removeAllMask |
| 817 completionHandler:completion]; | 815 completionHandler:completion]; |
| 818 } | 816 } |
| 819 | 817 |
| 820 - (void)deleteIncognitoBrowserState { | 818 - (void)deleteIncognitoBrowserState { |
| 821 BOOL otrBVCIsCurrent = (self.currentBVC == self.otrBVC); | 819 BOOL otrBVCIsCurrent = (self.currentBVC == self.otrBVC); |
| 822 | 820 |
| 823 const BOOL isOnIPadWithTabSwitcherEnabled = | |
| 824 IsIPadIdiom() && experimental_flags::IsTabSwitcherEnabled(); | |
| 825 | |
| 826 // If the current BVC is the otr BVC, then the user should be in the card | 821 // If the current BVC is the otr BVC, then the user should be in the card |
| 827 // stack, this is not true for the iPad tab switcher. | 822 // stack, this is not true for the iPad tab switcher. |
| 828 DCHECK(isOnIPadWithTabSwitcherEnabled || | 823 DCHECK(IsIPadIdiom() || (!otrBVCIsCurrent || _tabSwitcherIsActive)); |
| 829 (!otrBVCIsCurrent || _tabSwitcherIsActive)); | |
| 830 | 824 |
| 831 // We always clear the otr tab model on iPad. | 825 // We always clear the otr tab model on iPad. |
| 832 // Notify the _tabSwitcherController that its otrBVC will be destroyed. | 826 // Notify the _tabSwitcherController that its otrBVC will be destroyed. |
| 833 if (isOnIPadWithTabSwitcherEnabled || _tabSwitcherIsActive) | 827 if (IsIPadIdiom() || _tabSwitcherIsActive) |
| 834 [_tabSwitcherController setOtrTabModel:nil]; | 828 [_tabSwitcherController setOtrTabModel:nil]; |
| 835 | 829 |
| 836 [_browserViewWrangler | 830 [_browserViewWrangler |
| 837 deleteIncognitoTabModelState:self.browsingDataRemovalController]; | 831 deleteIncognitoTabModelState:self.browsingDataRemovalController]; |
| 838 | 832 |
| 839 if (otrBVCIsCurrent) { | 833 if (otrBVCIsCurrent) { |
| 840 [self activateBVCAndMakeCurrentBVCPrimary]; | 834 [self activateBVCAndMakeCurrentBVCPrimary]; |
| 841 } | 835 } |
| 842 | 836 |
| 843 // Always set the new otr tab model on iPad with tab switcher enabled. | 837 // Always set the new otr tab model on iPad with tab switcher enabled. |
| 844 // Notify the _tabSwitcherController with the new otrBVC. | 838 // Notify the _tabSwitcherController with the new otrBVC. |
| 845 if (isOnIPadWithTabSwitcherEnabled || _tabSwitcherIsActive) | 839 if (IsIPadIdiom() || _tabSwitcherIsActive) |
| 846 [_tabSwitcherController setOtrTabModel:self.otrTabModel]; | 840 [_tabSwitcherController setOtrTabModel:self.otrTabModel]; |
| 847 } | 841 } |
| 848 | 842 |
| 849 - (BrowsingDataRemovalController*)browsingDataRemovalController { | 843 - (BrowsingDataRemovalController*)browsingDataRemovalController { |
| 850 if (!_browsingDataRemovalController) { | 844 if (!_browsingDataRemovalController) { |
| 851 _browsingDataRemovalController.reset( | 845 _browsingDataRemovalController.reset( |
| 852 [[BrowsingDataRemovalController alloc] initWithDelegate:self]); | 846 [[BrowsingDataRemovalController alloc] initWithDelegate:self]); |
| 853 } | 847 } |
| 854 return _browsingDataRemovalController; | 848 return _browsingDataRemovalController; |
| 855 } | 849 } |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 switch (command) { | 1429 switch (command) { |
| 1436 case IDC_NEW_TAB: | 1430 case IDC_NEW_TAB: |
| 1437 [self createNewTabInBVC:self.mainBVC sender:sender]; | 1431 [self createNewTabInBVC:self.mainBVC sender:sender]; |
| 1438 break; | 1432 break; |
| 1439 case IDC_NEW_INCOGNITO_TAB: | 1433 case IDC_NEW_INCOGNITO_TAB: |
| 1440 [self createNewTabInBVC:self.otrBVC sender:sender]; | 1434 [self createNewTabInBVC:self.otrBVC sender:sender]; |
| 1441 break; | 1435 break; |
| 1442 case IDC_OPEN_URL: | 1436 case IDC_OPEN_URL: |
| 1443 [self openUrl:base::mac::ObjCCast<OpenUrlCommand>(sender)]; | 1437 [self openUrl:base::mac::ObjCCast<OpenUrlCommand>(sender)]; |
| 1444 break; | 1438 break; |
| 1445 case IDC_SWITCH_BROWSER_MODES: | |
| 1446 DCHECK(IsIPadIdiom()); | |
| 1447 [self swapBrowserModes]; | |
| 1448 break; | |
| 1449 case IDC_OPTIONS: | 1439 case IDC_OPTIONS: |
| 1450 [self showSettings]; | 1440 [self showSettings]; |
| 1451 break; | 1441 break; |
| 1452 case IDC_REPORT_AN_ISSUE: | 1442 case IDC_REPORT_AN_ISSUE: |
| 1453 dispatch_async(dispatch_get_main_queue(), ^{ | 1443 dispatch_async(dispatch_get_main_queue(), ^{ |
| 1454 [self showReportAnIssue]; | 1444 [self showReportAnIssue]; |
| 1455 }); | 1445 }); |
| 1456 break; | 1446 break; |
| 1457 case IDC_SHOW_SIGNIN_IOS: { | 1447 case IDC_SHOW_SIGNIN_IOS: { |
| 1458 ShowSigninCommand* command = | 1448 ShowSigninCommand* command = |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1477 [self showSyncEncryptionPassphrase]; | 1467 [self showSyncEncryptionPassphrase]; |
| 1478 break; | 1468 break; |
| 1479 case IDC_SHOW_SAVE_PASSWORDS_SETTINGS: | 1469 case IDC_SHOW_SAVE_PASSWORDS_SETTINGS: |
| 1480 [self showSavePasswordsSettings]; | 1470 [self showSavePasswordsSettings]; |
| 1481 break; | 1471 break; |
| 1482 case IDC_SHOW_HISTORY: | 1472 case IDC_SHOW_HISTORY: |
| 1483 [self showHistory]; | 1473 [self showHistory]; |
| 1484 break; | 1474 break; |
| 1485 case IDC_TOGGLE_TAB_SWITCHER: | 1475 case IDC_TOGGLE_TAB_SWITCHER: |
| 1486 DCHECK(!_tabSwitcherIsActive); | 1476 DCHECK(!_tabSwitcherIsActive); |
| 1487 if ((!IsIPadIdiom() || experimental_flags::IsTabSwitcherEnabled()) && | 1477 if (!_isProcessingVoiceSearchCommand) { |
| 1488 !_isProcessingVoiceSearchCommand) { | |
| 1489 [self showTabSwitcher]; | 1478 [self showTabSwitcher]; |
| 1490 _isProcessingTabSwitcherCommand = YES; | 1479 _isProcessingTabSwitcherCommand = YES; |
| 1491 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, | 1480 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, |
| 1492 kExpectedTransitionDurationInNanoSeconds), | 1481 kExpectedTransitionDurationInNanoSeconds), |
| 1493 dispatch_get_main_queue(), ^{ | 1482 dispatch_get_main_queue(), ^{ |
| 1494 _isProcessingTabSwitcherCommand = NO; | 1483 _isProcessingTabSwitcherCommand = NO; |
| 1495 }); | 1484 }); |
| 1496 } | 1485 } |
| 1497 break; | 1486 break; |
| 1498 case IDC_PRELOAD_VOICE_SEARCH: | 1487 case IDC_PRELOAD_VOICE_SEARCH: |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1695 // b) The second condition can happen if some other code (like JS) triggers | 1684 // b) The second condition can happen if some other code (like JS) triggers |
| 1696 // closure of tabs from the otr tab model when it's not current. | 1685 // closure of tabs from the otr tab model when it's not current. |
| 1697 // Nothing to do here. The next user action (like clicking on an existing | 1686 // Nothing to do here. The next user action (like clicking on an existing |
| 1698 // regular tab or creating a new incognito tab from the settings menu) will | 1687 // regular tab or creating a new incognito tab from the settings menu) will |
| 1699 // take care of the logic to mode switch. | 1688 // take care of the logic to mode switch. |
| 1700 if (_tabSwitcherIsActive || ![self.currentTabModel isOffTheRecord]) { | 1689 if (_tabSwitcherIsActive || ![self.currentTabModel isOffTheRecord]) { |
| 1701 return; | 1690 return; |
| 1702 } | 1691 } |
| 1703 | 1692 |
| 1704 if (IsIPadIdiom()) { | 1693 if (IsIPadIdiom()) { |
| 1705 if (experimental_flags::IsTabSwitcherEnabled()) { | 1694 [self showTabSwitcher]; |
| 1706 [self showTabSwitcher]; | |
| 1707 } else { | |
| 1708 // Mode switch if not in regular mode. | |
| 1709 [self swapBrowserModes]; | |
| 1710 } | |
| 1711 } else { | 1695 } else { |
| 1712 self.currentBVC = self.mainBVC; | 1696 self.currentBVC = self.mainBVC; |
| 1713 if ([self.currentTabModel count] == 0U) { | 1697 if ([self.currentTabModel count] == 0U) { |
| 1714 [self showTabSwitcher]; | 1698 [self showTabSwitcher]; |
| 1715 } | 1699 } |
| 1716 } | 1700 } |
| 1717 } | 1701 } |
| 1718 | 1702 |
| 1719 - (void)lastRegularTabClosed { | 1703 - (void)lastRegularTabClosed { |
| 1720 // a) The first condition can happen when the last regular tab is closed from | 1704 // a) The first condition can happen when the last regular tab is closed from |
| 1721 // the tab switcher. | 1705 // the tab switcher. |
| 1722 // b) The second condition can happen if some other code (like JS) triggers | 1706 // b) The second condition can happen if some other code (like JS) triggers |
| 1723 // closure of tabs from the main tab model when the main tab model is not | 1707 // closure of tabs from the main tab model when the main tab model is not |
| 1724 // current. | 1708 // current. |
| 1725 // Nothing to do here. | 1709 // Nothing to do here. |
| 1726 if (_tabSwitcherIsActive || [self.currentTabModel isOffTheRecord]) { | 1710 if (_tabSwitcherIsActive || [self.currentTabModel isOffTheRecord]) { |
| 1727 return; | 1711 return; |
| 1728 } | 1712 } |
| 1729 | 1713 |
| 1730 if (IsIPadIdiom()) { | 1714 [self showTabSwitcher]; |
| 1731 if (experimental_flags::IsTabSwitcherEnabled()) { | |
| 1732 [self showTabSwitcher]; | |
| 1733 } | |
| 1734 } else { | |
| 1735 [self showTabSwitcher]; | |
| 1736 } | |
| 1737 } | 1715 } |
| 1738 | 1716 |
| 1739 #pragma mark - Mode Switching | 1717 #pragma mark - Mode Switching |
| 1740 | 1718 |
| 1741 - (void)switchGlobalStateToMode:(ApplicationMode)mode { | 1719 - (void)switchGlobalStateToMode:(ApplicationMode)mode { |
| 1742 const BOOL incognito = (mode == ApplicationMode::INCOGNITO); | 1720 const BOOL incognito = (mode == ApplicationMode::INCOGNITO); |
| 1743 // Write the state to disk of what is "active". | 1721 // Write the state to disk of what is "active". |
| 1744 NSUserDefaults* standardDefaults = [NSUserDefaults standardUserDefaults]; | 1722 NSUserDefaults* standardDefaults = [NSUserDefaults standardUserDefaults]; |
| 1745 [standardDefaults setBool:incognito forKey:kIncognitoCurrentKey]; | 1723 [standardDefaults setBool:incognito forKey:kIncognitoCurrentKey]; |
| 1746 // Save critical state information for switching between normal and | 1724 // Save critical state information for switching between normal and |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1768 } | 1746 } |
| 1769 | 1747 |
| 1770 - (TabModel*)currentTabModel { | 1748 - (TabModel*)currentTabModel { |
| 1771 return self.currentBVC.tabModel; | 1749 return self.currentBVC.tabModel; |
| 1772 } | 1750 } |
| 1773 | 1751 |
| 1774 - (ios::ChromeBrowserState*)currentBrowserState { | 1752 - (ios::ChromeBrowserState*)currentBrowserState { |
| 1775 return self.currentBVC.browserState; | 1753 return self.currentBVC.browserState; |
| 1776 } | 1754 } |
| 1777 | 1755 |
| 1778 - (void)swapBrowserModes { | |
| 1779 if (self.mainBVC == self.currentBVC) | |
| 1780 self.currentBVC = self.otrBVC; | |
| 1781 else | |
| 1782 self.currentBVC = self.mainBVC; | |
| 1783 // Make sure there is at least one tab open. | |
| 1784 if ([self shouldOpenNTPTabOnActivationOfTabModel:[self currentTabModel]]) | |
| 1785 [self.currentBVC newTab:nil]; | |
| 1786 [_browserViewWrangler updateModeToggle]; | |
| 1787 } | |
| 1788 | |
| 1789 // NOTE: If you change this function, it may have an effect on the performance | 1756 // NOTE: If you change this function, it may have an effect on the performance |
| 1790 // of opening the stack view. Please make sure you also change the corresponding | 1757 // of opening the stack view. Please make sure you also change the corresponding |
| 1791 // code in StackViewControllerPerfTest::MainControllerShowTabSwitcher(). | 1758 // code in StackViewControllerPerfTest::MainControllerShowTabSwitcher(). |
| 1792 - (void)showTabSwitcher { | 1759 - (void)showTabSwitcher { |
| 1793 BrowserViewController* currentBVC = self.currentBVC; | 1760 BrowserViewController* currentBVC = self.currentBVC; |
| 1794 Tab* currentTab = [[currentBVC tabModel] currentTab]; | 1761 Tab* currentTab = [[currentBVC tabModel] currentTab]; |
| 1795 | 1762 |
| 1796 // In order to generate the transition between the current browser view | 1763 // In order to generate the transition between the current browser view |
| 1797 // controller and the tab switcher controller it's possible that multiple | 1764 // controller and the tab switcher controller it's possible that multiple |
| 1798 // screenshots of the same tab are taken. Since taking a screenshot is | 1765 // screenshots of the same tab are taken. Since taking a screenshot is |
| 1799 // expensive we activate snapshot coalescing in the scope of this function | 1766 // expensive we activate snapshot coalescing in the scope of this function |
| 1800 // which will cache the first snapshot for the tab and reuse it instead of | 1767 // which will cache the first snapshot for the tab and reuse it instead of |
| 1801 // regenerating a new one each time. | 1768 // regenerating a new one each time. |
| 1802 [currentTab setSnapshotCoalescingEnabled:YES]; | 1769 [currentTab setSnapshotCoalescingEnabled:YES]; |
| 1803 base::ScopedClosureRunner runner(base::BindBlock(^{ | 1770 base::ScopedClosureRunner runner(base::BindBlock(^{ |
| 1804 [currentTab setSnapshotCoalescingEnabled:NO]; | 1771 [currentTab setSnapshotCoalescingEnabled:NO]; |
| 1805 })); | 1772 })); |
| 1806 | 1773 |
| 1807 if (experimental_flags::IsTabSwitcherEnabled()) | 1774 [currentBVC prepareToEnterTabSwitcher:nil]; |
| 1808 [currentBVC prepareToEnterTabSwitcher:nil]; | |
| 1809 | 1775 |
| 1810 if (!_tabSwitcherController.get()) { | 1776 if (!_tabSwitcherController.get()) { |
| 1811 if (IsIPadIdiom()) { | 1777 if (IsIPadIdiom()) { |
| 1812 _tabSwitcherController.reset([[TabSwitcherController alloc] | 1778 _tabSwitcherController.reset([[TabSwitcherController alloc] |
| 1813 initWithBrowserState:_mainBrowserState | 1779 initWithBrowserState:_mainBrowserState |
| 1814 mainTabModel:self.mainTabModel | 1780 mainTabModel:self.mainTabModel |
| 1815 otrTabModel:self.otrTabModel | 1781 otrTabModel:self.otrTabModel |
| 1816 activeTabModel:self.currentTabModel]); | 1782 activeTabModel:self.currentTabModel]); |
| 1817 } else { | 1783 } else { |
| 1818 _tabSwitcherController.reset([[StackViewController alloc] | 1784 _tabSwitcherController.reset([[StackViewController alloc] |
| 1819 initWithMainTabModel:self.mainTabModel | 1785 initWithMainTabModel:self.mainTabModel |
| 1820 otrTabModel:self.otrTabModel | 1786 otrTabModel:self.otrTabModel |
| 1821 activeTabModel:self.currentTabModel]); | 1787 activeTabModel:self.currentTabModel]); |
| 1822 } | 1788 } |
| 1823 } else { | 1789 } else { |
| 1824 // The StackViewController is kept in memory to avoid the performance hit of | 1790 // The StackViewController is kept in memory to avoid the performance hit of |
| 1825 // loading from the nib on next showing, but clears out its card models to | 1791 // loading from the nib on next showing, but clears out its card models to |
| 1826 // release memory. The tab models are required to rebuild the card stacks. | 1792 // release memory. The tab models are required to rebuild the card stacks. |
| 1827 [_tabSwitcherController | 1793 [_tabSwitcherController |
| 1828 restoreInternalStateWithMainTabModel:self.mainTabModel | 1794 restoreInternalStateWithMainTabModel:self.mainTabModel |
| 1829 otrTabModel:self.otrTabModel | 1795 otrTabModel:self.otrTabModel |
| 1830 activeTabModel:self.currentTabModel]; | 1796 activeTabModel:self.currentTabModel]; |
| 1831 } | 1797 } |
| 1832 _tabSwitcherIsActive = YES; | 1798 _tabSwitcherIsActive = YES; |
| 1833 [_tabSwitcherController setDelegate:self]; | 1799 [_tabSwitcherController setDelegate:self]; |
| 1834 if (IsIPadIdiom() && experimental_flags::IsTabSwitcherEnabled()) { | 1800 if (IsIPadIdiom()) { |
| 1835 TabSwitcherTransitionContext* transitionContext = | 1801 TabSwitcherTransitionContext* transitionContext = |
| 1836 [TabSwitcherTransitionContext | 1802 [TabSwitcherTransitionContext |
| 1837 tabSwitcherTransitionContextWithCurrent:currentBVC | 1803 tabSwitcherTransitionContextWithCurrent:currentBVC |
| 1838 mainBVC:self.mainBVC | 1804 mainBVC:self.mainBVC |
| 1839 otrBVC:self.otrBVC]; | 1805 otrBVC:self.otrBVC]; |
| 1840 [_tabSwitcherController setTransitionContext:transitionContext]; | 1806 [_tabSwitcherController setTransitionContext:transitionContext]; |
| 1841 self.mainViewController.activeViewController = _tabSwitcherController; | 1807 self.mainViewController.activeViewController = _tabSwitcherController; |
| 1842 [_tabSwitcherController showWithSelectedTabAnimation]; | 1808 [_tabSwitcherController showWithSelectedTabAnimation]; |
| 1843 } else { | 1809 } else { |
| 1844 // User interaction is disabled when the stack controller is dismissed. | 1810 // User interaction is disabled when the stack controller is dismissed. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1907 - (void)tabSwitcher:(id<TabSwitcher>)tabSwitcher | 1873 - (void)tabSwitcher:(id<TabSwitcher>)tabSwitcher |
| 1908 dismissTransitionWillStartWithActiveModel:(TabModel*)tabModel { | 1874 dismissTransitionWillStartWithActiveModel:(TabModel*)tabModel { |
| 1909 [self beginDismissingStackViewWithCurrentModel:tabModel]; | 1875 [self beginDismissingStackViewWithCurrentModel:tabModel]; |
| 1910 } | 1876 } |
| 1911 | 1877 |
| 1912 - (void)tabSwitcherDismissTransitionDidEnd:(id<TabSwitcher>)tabSwitcher { | 1878 - (void)tabSwitcherDismissTransitionDidEnd:(id<TabSwitcher>)tabSwitcher { |
| 1913 [self finishDismissingStackView]; | 1879 [self finishDismissingStackView]; |
| 1914 } | 1880 } |
| 1915 | 1881 |
| 1916 - (void)beginDismissingStackViewWithCurrentModel:(TabModel*)tabModel { | 1882 - (void)beginDismissingStackViewWithCurrentModel:(TabModel*)tabModel { |
| 1917 DCHECK(experimental_flags::IsTabSwitcherEnabled() || !IsIPadIdiom()); | |
| 1918 DCHECK(tabModel == self.mainTabModel || tabModel == self.otrTabModel); | 1883 DCHECK(tabModel == self.mainTabModel || tabModel == self.otrTabModel); |
| 1919 | 1884 |
| 1920 _dismissingStackView = YES; | 1885 _dismissingStackView = YES; |
| 1921 // Prevent wayward touches from wreaking havoc while the stack view is being | 1886 // Prevent wayward touches from wreaking havoc while the stack view is being |
| 1922 // dismissed. | 1887 // dismissed. |
| 1923 [[_tabSwitcherController view] setUserInteractionEnabled:NO]; | 1888 [[_tabSwitcherController view] setUserInteractionEnabled:NO]; |
| 1924 BrowserViewController* targetBVC = | 1889 BrowserViewController* targetBVC = |
| 1925 (tabModel == self.mainTabModel) ? self.mainBVC : self.otrBVC; | 1890 (tabModel == self.mainTabModel) ? self.mainBVC : self.otrBVC; |
| 1926 self.currentBVC = targetBVC; | 1891 self.currentBVC = targetBVC; |
| 1927 } | 1892 } |
| 1928 | 1893 |
| 1929 - (void)finishDismissingStackView { | 1894 - (void)finishDismissingStackView { |
| 1930 DCHECK(!IsIPadIdiom() || experimental_flags::IsTabSwitcherEnabled()); | |
| 1931 DCHECK_EQ(self.mainViewController.activeViewController, | 1895 DCHECK_EQ(self.mainViewController.activeViewController, |
| 1932 _tabSwitcherController.get()); | 1896 _tabSwitcherController.get()); |
| 1933 | 1897 |
| 1934 if (_modeToDisplayOnStackViewDismissal == StackViewDismissalMode::NORMAL) { | 1898 if (_modeToDisplayOnStackViewDismissal == StackViewDismissalMode::NORMAL) { |
| 1935 self.currentBVC = self.mainBVC; | 1899 self.currentBVC = self.mainBVC; |
| 1936 } else if (_modeToDisplayOnStackViewDismissal == | 1900 } else if (_modeToDisplayOnStackViewDismissal == |
| 1937 StackViewDismissalMode::INCOGNITO) { | 1901 StackViewDismissalMode::INCOGNITO) { |
| 1938 self.currentBVC = self.otrBVC; | 1902 self.currentBVC = self.otrBVC; |
| 1939 } | 1903 } |
| 1940 | 1904 |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2641 }; | 2605 }; |
| 2642 | 2606 |
| 2643 callbackCounter->IncrementCount(); | 2607 callbackCounter->IncrementCount(); |
| 2644 [self removeBrowsingDataFromBrowserState:_mainBrowserState | 2608 [self removeBrowsingDataFromBrowserState:_mainBrowserState |
| 2645 mask:removeAllMask | 2609 mask:removeAllMask |
| 2646 timePeriod:browsing_data::ALL_TIME | 2610 timePeriod:browsing_data::ALL_TIME |
| 2647 completionHandler:decrementCallbackCounterCount]; | 2611 completionHandler:decrementCallbackCounterCount]; |
| 2648 } | 2612 } |
| 2649 | 2613 |
| 2650 @end | 2614 @end |
| OLD | NEW |