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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 inputAccessoryViewController_; | 270 inputAccessoryViewController_; |
271 | 271 |
272 // TODO(crbug.com/661665): move the WebContentsObservers into their own | 272 // TODO(crbug.com/661665): move the WebContentsObservers into their own |
273 // container. | 273 // container. |
274 // Handles saving and autofill of passwords. | 274 // Handles saving and autofill of passwords. |
275 base::scoped_nsobject<PasswordController> passwordController_; | 275 base::scoped_nsobject<PasswordController> passwordController_; |
276 | 276 |
277 // Handles autofill. | 277 // Handles autofill. |
278 base::scoped_nsobject<AutofillController> autofillController_; | 278 base::scoped_nsobject<AutofillController> autofillController_; |
279 | 279 |
280 // Handles GAL infobar on web pages. | |
281 base::scoped_nsobject<NativeAppNavigationController> | |
Eugene But (OOO till 7-30)
2017/04/14 14:30:51
Are there any includes which now can be removed (n
pkl (ping after 24h if needed)
2017/04/14 16:59:23
Yes. Done.
| |
282 nativeAppNavigationController_; | |
283 | |
284 // Handles caching and retrieving of snapshots. | 280 // Handles caching and retrieving of snapshots. |
285 base::scoped_nsobject<SnapshotManager> snapshotManager_; | 281 base::scoped_nsobject<SnapshotManager> snapshotManager_; |
286 | 282 |
287 // Handles retrieving, generating and updating snapshots of CRWWebController's | 283 // Handles retrieving, generating and updating snapshots of CRWWebController's |
288 // web page. | 284 // web page. |
289 base::scoped_nsobject<WebControllerSnapshotHelper> | 285 base::scoped_nsobject<WebControllerSnapshotHelper> |
290 webControllerSnapshotHelper_; | 286 webControllerSnapshotHelper_; |
291 | 287 |
292 // Handles support for window.print JavaScript calls. | 288 // Handles support for window.print JavaScript calls. |
293 std::unique_ptr<PrintObserver> printObserver_; | 289 std::unique_ptr<PrintObserver> printObserver_; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
338 | 334 |
339 // Adds the current session entry to this history database. | 335 // Adds the current session entry to this history database. |
340 - (void)addCurrentEntryToHistoryDB; | 336 - (void)addCurrentEntryToHistoryDB; |
341 | 337 |
342 // Adds any cached entries from |addPageVector_| to the history DB. | 338 // Adds any cached entries from |addPageVector_| to the history DB. |
343 - (void)commitCachedEntriesToHistoryDB; | 339 - (void)commitCachedEntriesToHistoryDB; |
344 | 340 |
345 // Returns the OpenInController for this tab. | 341 // Returns the OpenInController for this tab. |
346 - (OpenInController*)openInController; | 342 - (OpenInController*)openInController; |
347 | 343 |
348 // Initialize the Native App Launcher controller. | |
349 - (void)initNativeAppNavigationController; | |
350 | |
351 // Handles exportable files if possible. | 344 // Handles exportable files if possible. |
352 - (void)handleExportableFile:(net::HttpResponseHeaders*)headers; | 345 - (void)handleExportableFile:(net::HttpResponseHeaders*)headers; |
353 | 346 |
354 // Called after the session history is replaced, useful for updating members | 347 // Called after the session history is replaced, useful for updating members |
355 // with new sessionID. | 348 // with new sessionID. |
356 - (void)didReplaceSessionHistory; | 349 - (void)didReplaceSessionHistory; |
357 | 350 |
358 // Called when the UIApplication's state becomes active. | 351 // Called when the UIApplication's state becomes active. |
359 - (void)applicationDidBecomeActive; | 352 - (void)applicationDidBecomeActive; |
360 | 353 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
493 | 486 |
494 [self updateLastVisitedTimestamp]; | 487 [self updateLastVisitedTimestamp]; |
495 [[self webController] addObserver:self]; | 488 [[self webController] addObserver:self]; |
496 [[self webController] setDelegate:self]; | 489 [[self webController] setDelegate:self]; |
497 | 490 |
498 snapshotManager_.reset([[SnapshotManager alloc] init]); | 491 snapshotManager_.reset([[SnapshotManager alloc] init]); |
499 webControllerSnapshotHelper_.reset([[WebControllerSnapshotHelper alloc] | 492 webControllerSnapshotHelper_.reset([[WebControllerSnapshotHelper alloc] |
500 initWithSnapshotManager:snapshotManager_ | 493 initWithSnapshotManager:snapshotManager_ |
501 tab:self]); | 494 tab:self]); |
502 | 495 |
503 [self initNativeAppNavigationController]; | |
504 | |
505 [[NSNotificationCenter defaultCenter] | 496 [[NSNotificationCenter defaultCenter] |
506 addObserver:self | 497 addObserver:self |
507 selector:@selector(applicationDidBecomeActive) | 498 selector:@selector(applicationDidBecomeActive) |
508 name:UIApplicationDidBecomeActiveNotification | 499 name:UIApplicationDidBecomeActiveNotification |
509 object:nil]; | 500 object:nil]; |
510 } | 501 } |
511 return self; | 502 return self; |
512 } | 503 } |
513 | 504 |
514 - (void)attachTabHelpers { | 505 - (void)attachTabHelpers { |
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1601 if (isPrerenderTab_ && !isLinkLoadingPrerenderTab_) { | 1592 if (isPrerenderTab_ && !isLinkLoadingPrerenderTab_) { |
1602 [delegate_ discardPrerender]; | 1593 [delegate_ discardPrerender]; |
1603 return NO; | 1594 return NO; |
1604 } | 1595 } |
1605 return YES; | 1596 return YES; |
1606 } | 1597 } |
1607 | 1598 |
1608 - (BOOL)urlTriggersNativeAppLaunch:(const GURL&)url | 1599 - (BOOL)urlTriggersNativeAppLaunch:(const GURL&)url |
1609 sourceURL:(const GURL&)sourceURL | 1600 sourceURL:(const GURL&)sourceURL |
1610 linkClicked:(BOOL)linkClicked { | 1601 linkClicked:(BOOL)linkClicked { |
1611 // Don't open any native app directly when prerendering or from Incognito. | 1602 // TODO(crbug/711511): Returning NO bypasses all Link Navigation logic |
1612 if (isPrerenderTab_ || self.browserState->IsOffTheRecord()) | 1603 // for Native App Launcher. This call should eventually be eliminated. |
1613 return NO; | |
1614 | |
1615 base::scoped_nsprotocol<id<NativeAppMetadata>> metadata( | |
1616 [[ios::GetChromeBrowserProvider()->GetNativeAppWhitelistManager() | |
1617 nativeAppForURL:url] retain]); | |
1618 if (![metadata shouldAutoOpenLinks]) | |
1619 return NO; | |
1620 | |
1621 AuthenticationService* authenticationService = | |
1622 AuthenticationServiceFactory::GetForBrowserState(self.browserState); | |
1623 ChromeIdentity* identity = authenticationService->GetAuthenticatedIdentity(); | |
1624 | |
1625 // Attempts to open external app without x-callback. | |
1626 if ([self openExternalURL:[metadata launchURLWithURL:url identity:identity] | |
1627 sourceURL:sourceURL | |
1628 linkClicked:linkClicked]) { | |
1629 return YES; | |
1630 } | |
1631 | |
1632 // Auto-open didn't work. Reset the auto-open flag. | |
1633 [metadata unsetShouldAutoOpenLinks]; | |
1634 return NO; | 1604 return NO; |
1635 } | 1605 } |
1636 | 1606 |
1637 - (double)lastVisitedTimestamp { | 1607 - (double)lastVisitedTimestamp { |
1638 return lastVisitedTimestamp_; | 1608 return lastVisitedTimestamp_; |
1639 } | 1609 } |
1640 | 1610 |
1641 - (void)updateLastVisitedTimestamp { | 1611 - (void)updateLastVisitedTimestamp { |
1642 lastVisitedTimestamp_ = [[NSDate date] timeIntervalSince1970]; | 1612 lastVisitedTimestamp_ = [[NSDate date] timeIntervalSince1970]; |
1643 } | 1613 } |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1907 appendTo:kLastTab]); | 1877 appendTo:kLastTab]); |
1908 [self.view chromeExecuteCommand:command]; | 1878 [self.view chromeExecuteCommand:command]; |
1909 } else { | 1879 } else { |
1910 base::scoped_nsobject<GenericChromeCommand> chromeCommand( | 1880 base::scoped_nsobject<GenericChromeCommand> chromeCommand( |
1911 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_INCOGNITO_TAB]); | 1881 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_INCOGNITO_TAB]); |
1912 [self.view chromeExecuteCommand:chromeCommand]; | 1882 [self.view chromeExecuteCommand:chromeCommand]; |
1913 } | 1883 } |
1914 } | 1884 } |
1915 | 1885 |
1916 - (NativeAppNavigationController*)nativeAppNavigationController { | 1886 - (NativeAppNavigationController*)nativeAppNavigationController { |
1917 return nativeAppNavigationController_; | 1887 // TODO(crbug.com/711511): This call should eventually be eliminated. |
1918 } | 1888 return nil; |
1919 | |
1920 - (void)initNativeAppNavigationController { | |
1921 if (browserState_->IsOffTheRecord()) | |
1922 return; | |
1923 DCHECK(!nativeAppNavigationController_); | |
1924 nativeAppNavigationController_.reset( | |
1925 [[NativeAppNavigationController alloc] initWithWebState:self.webState]); | |
1926 DCHECK(nativeAppNavigationController_); | |
1927 } | 1889 } |
1928 | 1890 |
1929 - (id<PassKitDialogProvider>)passKitDialogProvider { | 1891 - (id<PassKitDialogProvider>)passKitDialogProvider { |
1930 return passKitDialogProvider_.get(); | 1892 return passKitDialogProvider_.get(); |
1931 } | 1893 } |
1932 | 1894 |
1933 - (void)setPassKitDialogProvider:(id<PassKitDialogProvider>)provider { | 1895 - (void)setPassKitDialogProvider:(id<PassKitDialogProvider>)provider { |
1934 passKitDialogProvider_.reset(provider); | 1896 passKitDialogProvider_.reset(provider); |
1935 } | 1897 } |
1936 | 1898 |
(...skipping 23 matching lines...) Expand all Loading... | |
1960 | 1922 |
1961 - (TabModel*)parentTabModel { | 1923 - (TabModel*)parentTabModel { |
1962 return parentTabModel_; | 1924 return parentTabModel_; |
1963 } | 1925 } |
1964 | 1926 |
1965 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 1927 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
1966 return inputAccessoryViewController_.get(); | 1928 return inputAccessoryViewController_.get(); |
1967 } | 1929 } |
1968 | 1930 |
1969 @end | 1931 @end |
OLD | NEW |