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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 | 499 |
500 [self updateLastVisitedTimestamp]; | 500 [self updateLastVisitedTimestamp]; |
501 [[self webController] addObserver:self]; | 501 [[self webController] addObserver:self]; |
502 [[self webController] setDelegate:self]; | 502 [[self webController] setDelegate:self]; |
503 | 503 |
504 snapshotManager_.reset([[SnapshotManager alloc] init]); | 504 snapshotManager_.reset([[SnapshotManager alloc] init]); |
505 webControllerSnapshotHelper_.reset([[WebControllerSnapshotHelper alloc] | 505 webControllerSnapshotHelper_.reset([[WebControllerSnapshotHelper alloc] |
506 initWithSnapshotManager:snapshotManager_ | 506 initWithSnapshotManager:snapshotManager_ |
507 tab:self]); | 507 tab:self]); |
508 | 508 |
509 [self initNativeAppNavigationController]; | 509 if (experimental_flags::IsNativeAppLauncherEnabled()) |
| 510 [self initNativeAppNavigationController]; |
510 | 511 |
511 [[NSNotificationCenter defaultCenter] | 512 [[NSNotificationCenter defaultCenter] |
512 addObserver:self | 513 addObserver:self |
513 selector:@selector(applicationDidBecomeActive) | 514 selector:@selector(applicationDidBecomeActive) |
514 name:UIApplicationDidBecomeActiveNotification | 515 name:UIApplicationDidBecomeActiveNotification |
515 object:nil]; | 516 object:nil]; |
516 } | 517 } |
517 return self; | 518 return self; |
518 } | 519 } |
519 | 520 |
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 if (isPrerenderTab_ && !isLinkLoadingPrerenderTab_) { | 1625 if (isPrerenderTab_ && !isLinkLoadingPrerenderTab_) { |
1625 [delegate_ discardPrerender]; | 1626 [delegate_ discardPrerender]; |
1626 return NO; | 1627 return NO; |
1627 } | 1628 } |
1628 return YES; | 1629 return YES; |
1629 } | 1630 } |
1630 | 1631 |
1631 - (BOOL)urlTriggersNativeAppLaunch:(const GURL&)url | 1632 - (BOOL)urlTriggersNativeAppLaunch:(const GURL&)url |
1632 sourceURL:(const GURL&)sourceURL | 1633 sourceURL:(const GURL&)sourceURL |
1633 linkClicked:(BOOL)linkClicked { | 1634 linkClicked:(BOOL)linkClicked { |
| 1635 // TODO(crbug/711511): If Native App Launcher is not enabled, returning NO |
| 1636 // bypasses all Link Navigation logic. This call should eventually be |
| 1637 // eliminated. |
| 1638 if (!experimental_flags::IsNativeAppLauncherEnabled()) |
| 1639 return NO; |
| 1640 |
1634 // Don't open any native app directly when prerendering or from Incognito. | 1641 // Don't open any native app directly when prerendering or from Incognito. |
1635 if (isPrerenderTab_ || self.browserState->IsOffTheRecord()) | 1642 if (isPrerenderTab_ || self.browserState->IsOffTheRecord()) |
1636 return NO; | 1643 return NO; |
1637 | 1644 |
1638 base::scoped_nsprotocol<id<NativeAppMetadata>> metadata( | 1645 base::scoped_nsprotocol<id<NativeAppMetadata>> metadata( |
1639 [[ios::GetChromeBrowserProvider()->GetNativeAppWhitelistManager() | 1646 [[ios::GetChromeBrowserProvider()->GetNativeAppWhitelistManager() |
1640 nativeAppForURL:url] retain]); | 1647 nativeAppForURL:url] retain]); |
1641 if (![metadata shouldAutoOpenLinks]) | 1648 if (![metadata shouldAutoOpenLinks]) |
1642 return NO; | 1649 return NO; |
1643 | 1650 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1912 appendTo:kLastTab]); | 1919 appendTo:kLastTab]); |
1913 [self.view chromeExecuteCommand:command]; | 1920 [self.view chromeExecuteCommand:command]; |
1914 } else { | 1921 } else { |
1915 base::scoped_nsobject<GenericChromeCommand> chromeCommand( | 1922 base::scoped_nsobject<GenericChromeCommand> chromeCommand( |
1916 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_INCOGNITO_TAB]); | 1923 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_INCOGNITO_TAB]); |
1917 [self.view chromeExecuteCommand:chromeCommand]; | 1924 [self.view chromeExecuteCommand:chromeCommand]; |
1918 } | 1925 } |
1919 } | 1926 } |
1920 | 1927 |
1921 - (NativeAppNavigationController*)nativeAppNavigationController { | 1928 - (NativeAppNavigationController*)nativeAppNavigationController { |
| 1929 // TODO(crbug.com/711511): If Native App Launcher is not enabled, simply |
| 1930 // return nil here. This method should eventually be eliminated. |
| 1931 if (!experimental_flags::IsNativeAppLauncherEnabled()) |
| 1932 return nil; |
1922 return nativeAppNavigationController_; | 1933 return nativeAppNavigationController_; |
1923 } | 1934 } |
1924 | 1935 |
1925 - (void)initNativeAppNavigationController { | 1936 - (void)initNativeAppNavigationController { |
1926 if (browserState_->IsOffTheRecord()) | 1937 if (browserState_->IsOffTheRecord()) |
1927 return; | 1938 return; |
1928 DCHECK(!nativeAppNavigationController_); | 1939 DCHECK(!nativeAppNavigationController_); |
1929 nativeAppNavigationController_.reset( | 1940 nativeAppNavigationController_.reset( |
1930 [[NativeAppNavigationController alloc] initWithWebState:self.webState]); | 1941 [[NativeAppNavigationController alloc] initWithWebState:self.webState]); |
1931 DCHECK(nativeAppNavigationController_); | 1942 DCHECK(nativeAppNavigationController_); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1972 | 1983 |
1973 - (TabModel*)parentTabModel { | 1984 - (TabModel*)parentTabModel { |
1974 return parentTabModel_; | 1985 return parentTabModel_; |
1975 } | 1986 } |
1976 | 1987 |
1977 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 1988 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
1978 return inputAccessoryViewController_.get(); | 1989 return inputAccessoryViewController_.get(); |
1979 } | 1990 } |
1980 | 1991 |
1981 @end | 1992 @end |
OLD | NEW |