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/tabs/tab.h" | 5 #import "ios/chrome/browser/tabs/tab.h" |
6 | 6 |
7 #import <CoreLocation/CoreLocation.h> | 7 #import <CoreLocation/CoreLocation.h> |
8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
471 | 471 |
472 [self updateLastVisitedTimestamp]; | 472 [self updateLastVisitedTimestamp]; |
473 [[self webController] addObserver:self]; | 473 [[self webController] addObserver:self]; |
474 [[self webController] setDelegate:self]; | 474 [[self webController] setDelegate:self]; |
475 | 475 |
476 snapshotManager_ = [[SnapshotManager alloc] init]; | 476 snapshotManager_ = [[SnapshotManager alloc] init]; |
477 webControllerSnapshotHelper_ = [[WebControllerSnapshotHelper alloc] | 477 webControllerSnapshotHelper_ = [[WebControllerSnapshotHelper alloc] |
478 initWithSnapshotManager:snapshotManager_ | 478 initWithSnapshotManager:snapshotManager_ |
479 tab:self]; | 479 tab:self]; |
480 | 480 |
481 [self initNativeAppNavigationController]; | 481 if (experimental_flags::IsNativeAppLauncherEnabled()) |
482 [self initNativeAppNavigationController]; | |
482 | 483 |
483 [[NSNotificationCenter defaultCenter] | 484 [[NSNotificationCenter defaultCenter] |
484 addObserver:self | 485 addObserver:self |
485 selector:@selector(applicationDidBecomeActive) | 486 selector:@selector(applicationDidBecomeActive) |
486 name:UIApplicationDidBecomeActiveNotification | 487 name:UIApplicationDidBecomeActiveNotification |
487 object:nil]; | 488 object:nil]; |
488 } | 489 } |
489 return self; | 490 return self; |
490 } | 491 } |
491 | 492 |
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1544 if (isPrerenderTab_ && !isLinkLoadingPrerenderTab_) { | 1545 if (isPrerenderTab_ && !isLinkLoadingPrerenderTab_) { |
1545 [delegate_ discardPrerender]; | 1546 [delegate_ discardPrerender]; |
1546 return NO; | 1547 return NO; |
1547 } | 1548 } |
1548 return YES; | 1549 return YES; |
1549 } | 1550 } |
1550 | 1551 |
1551 - (BOOL)urlTriggersNativeAppLaunch:(const GURL&)url | 1552 - (BOOL)urlTriggersNativeAppLaunch:(const GURL&)url |
1552 sourceURL:(const GURL&)sourceURL | 1553 sourceURL:(const GURL&)sourceURL |
1553 linkClicked:(BOOL)linkClicked { | 1554 linkClicked:(BOOL)linkClicked { |
1555 // TODO(crbug/711511): If Native App Launcher is not enabled, returning NO to | |
rohitrao (ping after 24h)
2017/05/03 22:53:07
Remove "to"
pkl (ping after 24h if needed)
2017/05/03 23:20:01
Done.
| |
1556 // bypasses all Link Navigation logic. This call should eventually be | |
1557 // eliminated. | |
1558 if (!experimental_flags::IsNativeAppLauncherEnabled()) | |
1559 return NO; | |
1560 | |
1554 // Don't open any native app directly when prerendering or from Incognito. | 1561 // Don't open any native app directly when prerendering or from Incognito. |
1555 if (isPrerenderTab_ || self.browserState->IsOffTheRecord()) | 1562 if (isPrerenderTab_ || self.browserState->IsOffTheRecord()) |
1556 return NO; | 1563 return NO; |
1557 | 1564 |
1558 id<NativeAppMetadata> metadata = | 1565 id<NativeAppMetadata> metadata = |
1559 [ios::GetChromeBrowserProvider()->GetNativeAppWhitelistManager() | 1566 [ios::GetChromeBrowserProvider()->GetNativeAppWhitelistManager() |
1560 nativeAppForURL:url]; | 1567 nativeAppForURL:url]; |
1561 if (![metadata shouldAutoOpenLinks]) | 1568 if (![metadata shouldAutoOpenLinks]) |
1562 return NO; | 1569 return NO; |
1563 | 1570 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1830 appendTo:kLastTab]; | 1837 appendTo:kLastTab]; |
1831 [self.view chromeExecuteCommand:command]; | 1838 [self.view chromeExecuteCommand:command]; |
1832 } else { | 1839 } else { |
1833 GenericChromeCommand* command = | 1840 GenericChromeCommand* command = |
1834 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_INCOGNITO_TAB]; | 1841 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_INCOGNITO_TAB]; |
1835 [self.view chromeExecuteCommand:command]; | 1842 [self.view chromeExecuteCommand:command]; |
1836 } | 1843 } |
1837 } | 1844 } |
1838 | 1845 |
1839 - (NativeAppNavigationController*)nativeAppNavigationController { | 1846 - (NativeAppNavigationController*)nativeAppNavigationController { |
1847 // TODO(crbug.com/711511): If Native App Launcher is not enabled, simply | |
1848 // return nil here. This method should eventually be eliminated. | |
1849 if (!experimental_flags::IsNativeAppLauncherEnabled()) | |
1850 return nil; | |
1840 return nativeAppNavigationController_; | 1851 return nativeAppNavigationController_; |
1841 } | 1852 } |
1842 | 1853 |
1843 - (void)initNativeAppNavigationController { | 1854 - (void)initNativeAppNavigationController { |
1844 if (browserState_->IsOffTheRecord()) | 1855 if (browserState_->IsOffTheRecord()) |
1845 return; | 1856 return; |
1846 DCHECK(!nativeAppNavigationController_); | 1857 DCHECK(!nativeAppNavigationController_); |
1847 nativeAppNavigationController_ = | 1858 nativeAppNavigationController_ = |
1848 [[NativeAppNavigationController alloc] initWithWebState:self.webState]; | 1859 [[NativeAppNavigationController alloc] initWithWebState:self.webState]; |
1849 DCHECK(nativeAppNavigationController_); | 1860 DCHECK(nativeAppNavigationController_); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1882 | 1893 |
1883 - (TabModel*)parentTabModel { | 1894 - (TabModel*)parentTabModel { |
1884 return parentTabModel_; | 1895 return parentTabModel_; |
1885 } | 1896 } |
1886 | 1897 |
1887 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 1898 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
1888 return inputAccessoryViewController_; | 1899 return inputAccessoryViewController_; |
1889 } | 1900 } |
1890 | 1901 |
1891 @end | 1902 @end |
OLD | NEW |