| 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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 // corresponding function to return YES. | 534 // corresponding function to return YES. |
| 535 // Initializes the application to INITIALIZATION_STAGE_BASIC, which is the | 535 // Initializes the application to INITIALIZATION_STAGE_BASIC, which is the |
| 536 // minimum initialization needed in all cases. | 536 // minimum initialization needed in all cases. |
| 537 - (void)startUpBrowserBasicInitialization; | 537 - (void)startUpBrowserBasicInitialization; |
| 538 // Initializes the application to INITIALIZATION_STAGE_BACKGROUND, which is | 538 // Initializes the application to INITIALIZATION_STAGE_BACKGROUND, which is |
| 539 // needed by background handlers. | 539 // needed by background handlers. |
| 540 - (void)startUpBrowserBackgroundInitialization; | 540 - (void)startUpBrowserBackgroundInitialization; |
| 541 // Initializes the application to INITIALIZATION_STAGE_FOREGROUND, which is | 541 // Initializes the application to INITIALIZATION_STAGE_FOREGROUND, which is |
| 542 // needed when application runs in foreground. | 542 // needed when application runs in foreground. |
| 543 - (void)startUpBrowserForegroundInitialization; | 543 - (void)startUpBrowserForegroundInitialization; |
| 544 // Swaps the UI between Incognito and normal modes. | |
| 545 - (void)swapBrowserModes; | |
| 546 @end | 544 @end |
| 547 | 545 |
| 548 @implementation MainController | 546 @implementation MainController |
| 549 | 547 |
| 550 @synthesize appState = _appState; | 548 @synthesize appState = _appState; |
| 551 @synthesize appLaunchTime = _appLaunchTime; | 549 @synthesize appLaunchTime = _appLaunchTime; |
| 552 @synthesize browserInitializationStage = _browserInitializationStage; | 550 @synthesize browserInitializationStage = _browserInitializationStage; |
| 553 @synthesize window = _window; | 551 @synthesize window = _window; |
| 554 @synthesize isPresentingFirstRunUI = _isPresentingFirstRunUI; | 552 @synthesize isPresentingFirstRunUI = _isPresentingFirstRunUI; |
| 555 @synthesize isColdStart = _isColdStart; | 553 @synthesize isColdStart = _isColdStart; |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 }; | 818 }; |
| 821 [self.browsingDataRemovalController | 819 [self.browsingDataRemovalController |
| 822 removeIOSSpecificIncognitoBrowsingDataFromBrowserState:otrBrowserState | 820 removeIOSSpecificIncognitoBrowsingDataFromBrowserState:otrBrowserState |
| 823 mask:removeAllMask | 821 mask:removeAllMask |
| 824 completionHandler:completion]; | 822 completionHandler:completion]; |
| 825 } | 823 } |
| 826 | 824 |
| 827 - (void)deleteIncognitoBrowserState { | 825 - (void)deleteIncognitoBrowserState { |
| 828 BOOL otrBVCIsCurrent = (self.currentBVC == self.otrBVC); | 826 BOOL otrBVCIsCurrent = (self.currentBVC == self.otrBVC); |
| 829 | 827 |
| 830 const BOOL isOnIPadWithTabSwitcherEnabled = | |
| 831 IsIPadIdiom() && experimental_flags::IsTabSwitcherEnabled(); | |
| 832 | |
| 833 // If the current BVC is the otr BVC, then the user should be in the card | 828 // If the current BVC is the otr BVC, then the user should be in the card |
| 834 // stack, this is not true for the iPad tab switcher. | 829 // stack, this is not true for the iPad tab switcher. |
| 835 DCHECK(isOnIPadWithTabSwitcherEnabled || | 830 DCHECK(IsIPadIdiom() || (!otrBVCIsCurrent || _tabSwitcherIsActive)); |
| 836 (!otrBVCIsCurrent || _tabSwitcherIsActive)); | |
| 837 | 831 |
| 838 // We always clear the otr tab model on iPad. | 832 // We always clear the otr tab model on iPad. |
| 839 // Notify the _tabSwitcherController that its otrBVC will be destroyed. | 833 // Notify the _tabSwitcherController that its otrBVC will be destroyed. |
| 840 if (isOnIPadWithTabSwitcherEnabled || _tabSwitcherIsActive) | 834 if (IsIPadIdiom() || _tabSwitcherIsActive) |
| 841 [_tabSwitcherController setOtrTabModel:nil]; | 835 [_tabSwitcherController setOtrTabModel:nil]; |
| 842 | 836 |
| 843 [_browserViewWrangler | 837 [_browserViewWrangler |
| 844 deleteIncognitoTabModelState:self.browsingDataRemovalController]; | 838 deleteIncognitoTabModelState:self.browsingDataRemovalController]; |
| 845 | 839 |
| 846 if (otrBVCIsCurrent) { | 840 if (otrBVCIsCurrent) { |
| 847 [self activateBVCAndMakeCurrentBVCPrimary]; | 841 [self activateBVCAndMakeCurrentBVCPrimary]; |
| 848 } | 842 } |
| 849 | 843 |
| 850 // Always set the new otr tab model on iPad with tab switcher enabled. | 844 // Always set the new otr tab model on iPad with tab switcher enabled. |
| 851 // Notify the _tabSwitcherController with the new otrBVC. | 845 // Notify the _tabSwitcherController with the new otrBVC. |
| 852 if (isOnIPadWithTabSwitcherEnabled || _tabSwitcherIsActive) | 846 if (IsIPadIdiom() || _tabSwitcherIsActive) |
| 853 [_tabSwitcherController setOtrTabModel:self.otrTabModel]; | 847 [_tabSwitcherController setOtrTabModel:self.otrTabModel]; |
| 854 } | 848 } |
| 855 | 849 |
| 856 - (BrowsingDataRemovalController*)browsingDataRemovalController { | 850 - (BrowsingDataRemovalController*)browsingDataRemovalController { |
| 857 if (!_browsingDataRemovalController) { | 851 if (!_browsingDataRemovalController) { |
| 858 _browsingDataRemovalController.reset( | 852 _browsingDataRemovalController.reset( |
| 859 [[BrowsingDataRemovalController alloc] initWithDelegate:self]); | 853 [[BrowsingDataRemovalController alloc] initWithDelegate:self]); |
| 860 } | 854 } |
| 861 return _browsingDataRemovalController; | 855 return _browsingDataRemovalController; |
| 862 } | 856 } |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1472 switch (command) { | 1466 switch (command) { |
| 1473 case IDC_NEW_TAB: | 1467 case IDC_NEW_TAB: |
| 1474 [self createNewTabInBVC:self.mainBVC sender:sender]; | 1468 [self createNewTabInBVC:self.mainBVC sender:sender]; |
| 1475 break; | 1469 break; |
| 1476 case IDC_NEW_INCOGNITO_TAB: | 1470 case IDC_NEW_INCOGNITO_TAB: |
| 1477 [self createNewTabInBVC:self.otrBVC sender:sender]; | 1471 [self createNewTabInBVC:self.otrBVC sender:sender]; |
| 1478 break; | 1472 break; |
| 1479 case IDC_OPEN_URL: | 1473 case IDC_OPEN_URL: |
| 1480 [self openUrl:base::mac::ObjCCast<OpenUrlCommand>(sender)]; | 1474 [self openUrl:base::mac::ObjCCast<OpenUrlCommand>(sender)]; |
| 1481 break; | 1475 break; |
| 1482 case IDC_SWITCH_BROWSER_MODES: | |
| 1483 DCHECK(IsIPadIdiom()); | |
| 1484 [self swapBrowserModes]; | |
| 1485 break; | |
| 1486 case IDC_OPTIONS: | 1476 case IDC_OPTIONS: |
| 1487 [self showSettings]; | 1477 [self showSettings]; |
| 1488 break; | 1478 break; |
| 1489 case IDC_REPORT_AN_ISSUE: | 1479 case IDC_REPORT_AN_ISSUE: |
| 1490 dispatch_async(dispatch_get_main_queue(), ^{ | 1480 dispatch_async(dispatch_get_main_queue(), ^{ |
| 1491 [self showReportAnIssue]; | 1481 [self showReportAnIssue]; |
| 1492 }); | 1482 }); |
| 1493 break; | 1483 break; |
| 1494 case IDC_SHOW_SIGNIN_IOS: { | 1484 case IDC_SHOW_SIGNIN_IOS: { |
| 1495 ShowSigninCommand* command = | 1485 ShowSigninCommand* command = |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1517 [self showSavePasswordsSettings]; | 1507 [self showSavePasswordsSettings]; |
| 1518 break; | 1508 break; |
| 1519 case IDC_SHOW_PHYSICAL_WEB_SETTINGS: | 1509 case IDC_SHOW_PHYSICAL_WEB_SETTINGS: |
| 1520 [self showPhysicalWebSettings]; | 1510 [self showPhysicalWebSettings]; |
| 1521 break; | 1511 break; |
| 1522 case IDC_SHOW_HISTORY: | 1512 case IDC_SHOW_HISTORY: |
| 1523 [self showHistory]; | 1513 [self showHistory]; |
| 1524 break; | 1514 break; |
| 1525 case IDC_TOGGLE_TAB_SWITCHER: | 1515 case IDC_TOGGLE_TAB_SWITCHER: |
| 1526 DCHECK(!_tabSwitcherIsActive); | 1516 DCHECK(!_tabSwitcherIsActive); |
| 1527 if ((!IsIPadIdiom() || experimental_flags::IsTabSwitcherEnabled()) && | 1517 if (!_isProcessingVoiceSearchCommand) { |
| 1528 !_isProcessingVoiceSearchCommand) { | |
| 1529 [self showTabSwitcher]; | 1518 [self showTabSwitcher]; |
| 1530 _isProcessingTabSwitcherCommand = YES; | 1519 _isProcessingTabSwitcherCommand = YES; |
| 1531 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, | 1520 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, |
| 1532 kExpectedTransitionDurationInNanoSeconds), | 1521 kExpectedTransitionDurationInNanoSeconds), |
| 1533 dispatch_get_main_queue(), ^{ | 1522 dispatch_get_main_queue(), ^{ |
| 1534 _isProcessingTabSwitcherCommand = NO; | 1523 _isProcessingTabSwitcherCommand = NO; |
| 1535 }); | 1524 }); |
| 1536 } | 1525 } |
| 1537 break; | 1526 break; |
| 1538 case IDC_PRELOAD_VOICE_SEARCH: | 1527 case IDC_PRELOAD_VOICE_SEARCH: |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1735 // b) The second condition can happen if some other code (like JS) triggers | 1724 // b) The second condition can happen if some other code (like JS) triggers |
| 1736 // closure of tabs from the otr tab model when it's not current. | 1725 // closure of tabs from the otr tab model when it's not current. |
| 1737 // Nothing to do here. The next user action (like clicking on an existing | 1726 // Nothing to do here. The next user action (like clicking on an existing |
| 1738 // regular tab or creating a new incognito tab from the settings menu) will | 1727 // regular tab or creating a new incognito tab from the settings menu) will |
| 1739 // take care of the logic to mode switch. | 1728 // take care of the logic to mode switch. |
| 1740 if (_tabSwitcherIsActive || ![self.currentTabModel isOffTheRecord]) { | 1729 if (_tabSwitcherIsActive || ![self.currentTabModel isOffTheRecord]) { |
| 1741 return; | 1730 return; |
| 1742 } | 1731 } |
| 1743 | 1732 |
| 1744 if (IsIPadIdiom()) { | 1733 if (IsIPadIdiom()) { |
| 1745 if (experimental_flags::IsTabSwitcherEnabled()) { | 1734 [self showTabSwitcher]; |
| 1746 [self showTabSwitcher]; | |
| 1747 } else { | |
| 1748 // Mode switch if not in regular mode. | |
| 1749 [self swapBrowserModes]; | |
| 1750 } | |
| 1751 } else { | 1735 } else { |
| 1752 self.currentBVC = self.mainBVC; | 1736 self.currentBVC = self.mainBVC; |
| 1753 if ([self.currentTabModel count] == 0U) { | 1737 if ([self.currentTabModel count] == 0U) { |
| 1754 [self showTabSwitcher]; | 1738 [self showTabSwitcher]; |
| 1755 } | 1739 } |
| 1756 } | 1740 } |
| 1757 } | 1741 } |
| 1758 | 1742 |
| 1759 - (void)lastRegularTabClosed { | 1743 - (void)lastRegularTabClosed { |
| 1760 // a) The first condition can happen when the last regular tab is closed from | 1744 // a) The first condition can happen when the last regular tab is closed from |
| 1761 // the tab switcher. | 1745 // the tab switcher. |
| 1762 // b) The second condition can happen if some other code (like JS) triggers | 1746 // b) The second condition can happen if some other code (like JS) triggers |
| 1763 // closure of tabs from the main tab model when the main tab model is not | 1747 // closure of tabs from the main tab model when the main tab model is not |
| 1764 // current. | 1748 // current. |
| 1765 // Nothing to do here. | 1749 // Nothing to do here. |
| 1766 if (_tabSwitcherIsActive || [self.currentTabModel isOffTheRecord]) { | 1750 if (_tabSwitcherIsActive || [self.currentTabModel isOffTheRecord]) { |
| 1767 return; | 1751 return; |
| 1768 } | 1752 } |
| 1769 | 1753 |
| 1770 if (IsIPadIdiom()) { | 1754 [self showTabSwitcher]; |
| 1771 if (experimental_flags::IsTabSwitcherEnabled()) { | |
| 1772 [self showTabSwitcher]; | |
| 1773 } | |
| 1774 } else { | |
| 1775 [self showTabSwitcher]; | |
| 1776 } | |
| 1777 } | 1755 } |
| 1778 | 1756 |
| 1779 #pragma mark - Mode Switching | 1757 #pragma mark - Mode Switching |
| 1780 | 1758 |
| 1781 - (void)switchGlobalStateToMode:(ApplicationMode)mode { | 1759 - (void)switchGlobalStateToMode:(ApplicationMode)mode { |
| 1782 const BOOL incognito = (mode == ApplicationMode::INCOGNITO); | 1760 const BOOL incognito = (mode == ApplicationMode::INCOGNITO); |
| 1783 // Write the state to disk of what is "active". | 1761 // Write the state to disk of what is "active". |
| 1784 NSUserDefaults* standardDefaults = [NSUserDefaults standardUserDefaults]; | 1762 NSUserDefaults* standardDefaults = [NSUserDefaults standardUserDefaults]; |
| 1785 [standardDefaults setBool:incognito forKey:kIncognitoCurrentKey]; | 1763 [standardDefaults setBool:incognito forKey:kIncognitoCurrentKey]; |
| 1786 // Save critical state information for switching between normal and | 1764 // Save critical state information for switching between normal and |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1808 } | 1786 } |
| 1809 | 1787 |
| 1810 - (TabModel*)currentTabModel { | 1788 - (TabModel*)currentTabModel { |
| 1811 return self.currentBVC.tabModel; | 1789 return self.currentBVC.tabModel; |
| 1812 } | 1790 } |
| 1813 | 1791 |
| 1814 - (ios::ChromeBrowserState*)currentBrowserState { | 1792 - (ios::ChromeBrowserState*)currentBrowserState { |
| 1815 return self.currentBVC.browserState; | 1793 return self.currentBVC.browserState; |
| 1816 } | 1794 } |
| 1817 | 1795 |
| 1818 - (void)swapBrowserModes { | |
| 1819 if (self.mainBVC == self.currentBVC) | |
| 1820 self.currentBVC = self.otrBVC; | |
| 1821 else | |
| 1822 self.currentBVC = self.mainBVC; | |
| 1823 // Make sure there is at least one tab open. | |
| 1824 if ([self shouldOpenNTPTabOnActivationOfTabModel:[self currentTabModel]]) | |
| 1825 [self.currentBVC newTab:nil]; | |
| 1826 [_browserViewWrangler updateModeToggle]; | |
| 1827 } | |
| 1828 | |
| 1829 // NOTE: If you change this function, it may have an effect on the performance | 1796 // NOTE: If you change this function, it may have an effect on the performance |
| 1830 // of opening the stack view. Please make sure you also change the corresponding | 1797 // of opening the stack view. Please make sure you also change the corresponding |
| 1831 // code in StackViewControllerPerfTest::MainControllerShowTabSwitcher(). | 1798 // code in StackViewControllerPerfTest::MainControllerShowTabSwitcher(). |
| 1832 - (void)showTabSwitcher { | 1799 - (void)showTabSwitcher { |
| 1833 BrowserViewController* currentBVC = self.currentBVC; | 1800 BrowserViewController* currentBVC = self.currentBVC; |
| 1834 Tab* currentTab = [[currentBVC tabModel] currentTab]; | 1801 Tab* currentTab = [[currentBVC tabModel] currentTab]; |
| 1835 | 1802 |
| 1836 // In order to generate the transition between the current browser view | 1803 // In order to generate the transition between the current browser view |
| 1837 // controller and the tab switcher controller it's possible that multiple | 1804 // controller and the tab switcher controller it's possible that multiple |
| 1838 // screenshots of the same tab are taken. Since taking a screenshot is | 1805 // screenshots of the same tab are taken. Since taking a screenshot is |
| 1839 // expensive we activate snapshot coalescing in the scope of this function | 1806 // expensive we activate snapshot coalescing in the scope of this function |
| 1840 // which will cache the first snapshot for the tab and reuse it instead of | 1807 // which will cache the first snapshot for the tab and reuse it instead of |
| 1841 // regenerating a new one each time. | 1808 // regenerating a new one each time. |
| 1842 [currentTab setSnapshotCoalescingEnabled:YES]; | 1809 [currentTab setSnapshotCoalescingEnabled:YES]; |
| 1843 base::ScopedClosureRunner runner(base::BindBlock(^{ | 1810 base::ScopedClosureRunner runner(base::BindBlock(^{ |
| 1844 [currentTab setSnapshotCoalescingEnabled:NO]; | 1811 [currentTab setSnapshotCoalescingEnabled:NO]; |
| 1845 })); | 1812 })); |
| 1846 | 1813 |
| 1847 if (experimental_flags::IsTabSwitcherEnabled()) | 1814 [currentBVC prepareToEnterTabSwitcher:nil]; |
| 1848 [currentBVC prepareToEnterTabSwitcher:nil]; | |
| 1849 | 1815 |
| 1850 if (!_tabSwitcherController.get()) { | 1816 if (!_tabSwitcherController.get()) { |
| 1851 if (IsIPadIdiom()) { | 1817 if (IsIPadIdiom()) { |
| 1852 _tabSwitcherController.reset([[TabSwitcherController alloc] | 1818 _tabSwitcherController.reset([[TabSwitcherController alloc] |
| 1853 initWithBrowserState:_mainBrowserState | 1819 initWithBrowserState:_mainBrowserState |
| 1854 mainTabModel:self.mainTabModel | 1820 mainTabModel:self.mainTabModel |
| 1855 otrTabModel:self.otrTabModel | 1821 otrTabModel:self.otrTabModel |
| 1856 activeTabModel:self.currentTabModel]); | 1822 activeTabModel:self.currentTabModel]); |
| 1857 } else { | 1823 } else { |
| 1858 _tabSwitcherController.reset([[StackViewController alloc] | 1824 _tabSwitcherController.reset([[StackViewController alloc] |
| 1859 initWithMainTabModel:self.mainTabModel | 1825 initWithMainTabModel:self.mainTabModel |
| 1860 otrTabModel:self.otrTabModel | 1826 otrTabModel:self.otrTabModel |
| 1861 activeTabModel:self.currentTabModel]); | 1827 activeTabModel:self.currentTabModel]); |
| 1862 } | 1828 } |
| 1863 } else { | 1829 } else { |
| 1864 // The StackViewController is kept in memory to avoid the performance hit of | 1830 // The StackViewController is kept in memory to avoid the performance hit of |
| 1865 // loading from the nib on next showing, but clears out its card models to | 1831 // loading from the nib on next showing, but clears out its card models to |
| 1866 // release memory. The tab models are required to rebuild the card stacks. | 1832 // release memory. The tab models are required to rebuild the card stacks. |
| 1867 [_tabSwitcherController | 1833 [_tabSwitcherController |
| 1868 restoreInternalStateWithMainTabModel:self.mainTabModel | 1834 restoreInternalStateWithMainTabModel:self.mainTabModel |
| 1869 otrTabModel:self.otrTabModel | 1835 otrTabModel:self.otrTabModel |
| 1870 activeTabModel:self.currentTabModel]; | 1836 activeTabModel:self.currentTabModel]; |
| 1871 } | 1837 } |
| 1872 _tabSwitcherIsActive = YES; | 1838 _tabSwitcherIsActive = YES; |
| 1873 [_tabSwitcherController setDelegate:self]; | 1839 [_tabSwitcherController setDelegate:self]; |
| 1874 if (IsIPadIdiom() && experimental_flags::IsTabSwitcherEnabled()) { | 1840 if (IsIPadIdiom()) { |
| 1875 TabSwitcherTransitionContext* transitionContext = | 1841 TabSwitcherTransitionContext* transitionContext = |
| 1876 [TabSwitcherTransitionContext | 1842 [TabSwitcherTransitionContext |
| 1877 tabSwitcherTransitionContextWithCurrent:currentBVC | 1843 tabSwitcherTransitionContextWithCurrent:currentBVC |
| 1878 mainBVC:self.mainBVC | 1844 mainBVC:self.mainBVC |
| 1879 otrBVC:self.otrBVC]; | 1845 otrBVC:self.otrBVC]; |
| 1880 [_tabSwitcherController setTransitionContext:transitionContext]; | 1846 [_tabSwitcherController setTransitionContext:transitionContext]; |
| 1881 self.mainViewController.activeViewController = _tabSwitcherController; | 1847 self.mainViewController.activeViewController = _tabSwitcherController; |
| 1882 [_tabSwitcherController showWithSelectedTabAnimation]; | 1848 [_tabSwitcherController showWithSelectedTabAnimation]; |
| 1883 } else { | 1849 } else { |
| 1884 // User interaction is disabled when the stack controller is dismissed. | 1850 // User interaction is disabled when the stack controller is dismissed. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1947 - (void)tabSwitcher:(id<TabSwitcher>)tabSwitcher | 1913 - (void)tabSwitcher:(id<TabSwitcher>)tabSwitcher |
| 1948 dismissTransitionWillStartWithActiveModel:(TabModel*)tabModel { | 1914 dismissTransitionWillStartWithActiveModel:(TabModel*)tabModel { |
| 1949 [self beginDismissingStackViewWithCurrentModel:tabModel]; | 1915 [self beginDismissingStackViewWithCurrentModel:tabModel]; |
| 1950 } | 1916 } |
| 1951 | 1917 |
| 1952 - (void)tabSwitcherDismissTransitionDidEnd:(id<TabSwitcher>)tabSwitcher { | 1918 - (void)tabSwitcherDismissTransitionDidEnd:(id<TabSwitcher>)tabSwitcher { |
| 1953 [self finishDismissingStackView]; | 1919 [self finishDismissingStackView]; |
| 1954 } | 1920 } |
| 1955 | 1921 |
| 1956 - (void)beginDismissingStackViewWithCurrentModel:(TabModel*)tabModel { | 1922 - (void)beginDismissingStackViewWithCurrentModel:(TabModel*)tabModel { |
| 1957 DCHECK(experimental_flags::IsTabSwitcherEnabled() || !IsIPadIdiom()); | |
| 1958 DCHECK(tabModel == self.mainTabModel || tabModel == self.otrTabModel); | 1923 DCHECK(tabModel == self.mainTabModel || tabModel == self.otrTabModel); |
| 1959 | 1924 |
| 1960 _dismissingStackView = YES; | 1925 _dismissingStackView = YES; |
| 1961 // Prevent wayward touches from wreaking havoc while the stack view is being | 1926 // Prevent wayward touches from wreaking havoc while the stack view is being |
| 1962 // dismissed. | 1927 // dismissed. |
| 1963 [[_tabSwitcherController view] setUserInteractionEnabled:NO]; | 1928 [[_tabSwitcherController view] setUserInteractionEnabled:NO]; |
| 1964 BrowserViewController* targetBVC = | 1929 BrowserViewController* targetBVC = |
| 1965 (tabModel == self.mainTabModel) ? self.mainBVC : self.otrBVC; | 1930 (tabModel == self.mainTabModel) ? self.mainBVC : self.otrBVC; |
| 1966 self.currentBVC = targetBVC; | 1931 self.currentBVC = targetBVC; |
| 1967 } | 1932 } |
| 1968 | 1933 |
| 1969 - (void)finishDismissingStackView { | 1934 - (void)finishDismissingStackView { |
| 1970 DCHECK(!IsIPadIdiom() || experimental_flags::IsTabSwitcherEnabled()); | |
| 1971 DCHECK_EQ(self.mainViewController.activeViewController, | 1935 DCHECK_EQ(self.mainViewController.activeViewController, |
| 1972 _tabSwitcherController.get()); | 1936 _tabSwitcherController.get()); |
| 1973 | 1937 |
| 1974 if (_modeToDisplayOnStackViewDismissal == StackViewDismissalMode::NORMAL) { | 1938 if (_modeToDisplayOnStackViewDismissal == StackViewDismissalMode::NORMAL) { |
| 1975 self.currentBVC = self.mainBVC; | 1939 self.currentBVC = self.mainBVC; |
| 1976 } else if (_modeToDisplayOnStackViewDismissal == | 1940 } else if (_modeToDisplayOnStackViewDismissal == |
| 1977 StackViewDismissalMode::INCOGNITO) { | 1941 StackViewDismissalMode::INCOGNITO) { |
| 1978 self.currentBVC = self.otrBVC; | 1942 self.currentBVC = self.otrBVC; |
| 1979 } | 1943 } |
| 1980 | 1944 |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2693 }; | 2657 }; |
| 2694 | 2658 |
| 2695 callbackCounter->IncrementCount(); | 2659 callbackCounter->IncrementCount(); |
| 2696 [self removeBrowsingDataFromBrowserState:_mainBrowserState | 2660 [self removeBrowsingDataFromBrowserState:_mainBrowserState |
| 2697 mask:removeAllMask | 2661 mask:removeAllMask |
| 2698 timePeriod:browsing_data::ALL_TIME | 2662 timePeriod:browsing_data::ALL_TIME |
| 2699 completionHandler:decrementCallbackCounterCount]; | 2663 completionHandler:decrementCallbackCounterCount]; |
| 2700 } | 2664 } |
| 2701 | 2665 |
| 2702 @end | 2666 @end |
| OLD | NEW |