Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: ios/chrome/browser/tabs/tab.mm

Issue 2894883004: Removed IsNativeAppLauncherEnabled() experiment (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 53 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
54 #include "ios/chrome/browser/chrome_url_constants.h" 54 #include "ios/chrome/browser/chrome_url_constants.h"
55 #import "ios/chrome/browser/crash_loop_detection_util.h" 55 #import "ios/chrome/browser/crash_loop_detection_util.h"
56 #include "ios/chrome/browser/experimental_flags.h" 56 #include "ios/chrome/browser/experimental_flags.h"
57 #import "ios/chrome/browser/find_in_page/find_in_page_controller.h" 57 #import "ios/chrome/browser/find_in_page/find_in_page_controller.h"
58 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller.h" 58 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller.h"
59 #include "ios/chrome/browser/history/history_service_factory.h" 59 #include "ios/chrome/browser/history/history_service_factory.h"
60 #include "ios/chrome/browser/history/top_sites_factory.h" 60 #include "ios/chrome/browser/history/top_sites_factory.h"
61 #include "ios/chrome/browser/infobars/infobar_manager_impl.h" 61 #include "ios/chrome/browser/infobars/infobar_manager_impl.h"
62 #import "ios/chrome/browser/metrics/tab_usage_recorder.h" 62 #import "ios/chrome/browser/metrics/tab_usage_recorder.h"
63 #import "ios/chrome/browser/native_app_launcher/native_app_navigation_controller .h"
64 #import "ios/chrome/browser/passwords/password_controller.h" 63 #import "ios/chrome/browser/passwords/password_controller.h"
65 #import "ios/chrome/browser/passwords/passwords_ui_delegate_impl.h" 64 #import "ios/chrome/browser/passwords/passwords_ui_delegate_impl.h"
66 #include "ios/chrome/browser/pref_names.h" 65 #include "ios/chrome/browser/pref_names.h"
67 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" 66 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h"
68 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" 67 #include "ios/chrome/browser/search_engines/template_url_service_factory.h"
69 #include "ios/chrome/browser/sessions/ios_chrome_session_tab_helper.h" 68 #include "ios/chrome/browser/sessions/ios_chrome_session_tab_helper.h"
70 #include "ios/chrome/browser/signin/account_consistency_service_factory.h" 69 #include "ios/chrome/browser/signin/account_consistency_service_factory.h"
71 #include "ios/chrome/browser/signin/account_reconcilor_factory.h" 70 #include "ios/chrome/browser/signin/account_reconcilor_factory.h"
72 #include "ios/chrome/browser/signin/authentication_service.h"
73 #include "ios/chrome/browser/signin/authentication_service_factory.h"
74 #include "ios/chrome/browser/signin/signin_capability.h" 71 #include "ios/chrome/browser/signin/signin_capability.h"
75 #import "ios/chrome/browser/snapshots/snapshot_manager.h" 72 #import "ios/chrome/browser/snapshots/snapshot_manager.h"
76 #import "ios/chrome/browser/snapshots/snapshot_overlay_provider.h" 73 #import "ios/chrome/browser/snapshots/snapshot_overlay_provider.h"
77 #import "ios/chrome/browser/snapshots/web_controller_snapshot_helper.h" 74 #import "ios/chrome/browser/snapshots/web_controller_snapshot_helper.h"
78 #import "ios/chrome/browser/tabs/legacy_tab_helper.h" 75 #import "ios/chrome/browser/tabs/legacy_tab_helper.h"
79 #import "ios/chrome/browser/tabs/tab_delegate.h" 76 #import "ios/chrome/browser/tabs/tab_delegate.h"
80 #import "ios/chrome/browser/tabs/tab_dialog_delegate.h" 77 #import "ios/chrome/browser/tabs/tab_dialog_delegate.h"
81 #import "ios/chrome/browser/tabs/tab_headers_delegate.h" 78 #import "ios/chrome/browser/tabs/tab_headers_delegate.h"
82 #import "ios/chrome/browser/tabs/tab_helper_util.h" 79 #import "ios/chrome/browser/tabs/tab_helper_util.h"
83 #import "ios/chrome/browser/tabs/tab_model.h" 80 #import "ios/chrome/browser/tabs/tab_model.h"
(...skipping 14 matching lines...) Expand all
98 #import "ios/chrome/browser/ui/reader_mode/reader_mode_checker.h" 95 #import "ios/chrome/browser/ui/reader_mode/reader_mode_checker.h"
99 #import "ios/chrome/browser/ui/reader_mode/reader_mode_controller.h" 96 #import "ios/chrome/browser/ui/reader_mode/reader_mode_controller.h"
100 #include "ios/chrome/browser/ui/ui_util.h" 97 #include "ios/chrome/browser/ui/ui_util.h"
101 #import "ios/chrome/browser/web/auto_reload_bridge.h" 98 #import "ios/chrome/browser/web/auto_reload_bridge.h"
102 #import "ios/chrome/browser/web/external_app_launcher.h" 99 #import "ios/chrome/browser/web/external_app_launcher.h"
103 #import "ios/chrome/browser/web/navigation_manager_util.h" 100 #import "ios/chrome/browser/web/navigation_manager_util.h"
104 #import "ios/chrome/browser/web/passkit_dialog_provider.h" 101 #import "ios/chrome/browser/web/passkit_dialog_provider.h"
105 #include "ios/chrome/browser/web/print_observer.h" 102 #include "ios/chrome/browser/web/print_observer.h"
106 #import "ios/chrome/browser/xcallback_parameters.h" 103 #import "ios/chrome/browser/xcallback_parameters.h"
107 #include "ios/chrome/grit/ios_strings.h" 104 #include "ios/chrome/grit/ios_strings.h"
108 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
109 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_metad ata.h"
110 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_white list_manager.h"
111 #import "ios/web/navigation/crw_session_controller.h" 105 #import "ios/web/navigation/crw_session_controller.h"
112 #import "ios/web/navigation/navigation_item_impl.h" 106 #import "ios/web/navigation/navigation_item_impl.h"
113 #import "ios/web/navigation/navigation_manager_impl.h" 107 #import "ios/web/navigation/navigation_manager_impl.h"
114 #include "ios/web/public/favicon_status.h" 108 #include "ios/web/public/favicon_status.h"
115 #include "ios/web/public/favicon_url.h" 109 #include "ios/web/public/favicon_url.h"
116 #include "ios/web/public/interstitials/web_interstitial.h" 110 #include "ios/web/public/interstitials/web_interstitial.h"
117 #include "ios/web/public/load_committed_details.h" 111 #include "ios/web/public/load_committed_details.h"
118 #import "ios/web/public/navigation_manager.h" 112 #import "ios/web/public/navigation_manager.h"
119 #include "ios/web/public/referrer.h" 113 #include "ios/web/public/referrer.h"
120 #import "ios/web/public/serializable_user_data_manager.h" 114 #import "ios/web/public/serializable_user_data_manager.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 252
259 // Handles suggestions for form entry. 253 // Handles suggestions for form entry.
260 FormSuggestionController* _suggestionController; 254 FormSuggestionController* _suggestionController;
261 255
262 // Manages the input accessory view during form input. 256 // Manages the input accessory view during form input.
263 FormInputAccessoryViewController* _inputAccessoryViewController; 257 FormInputAccessoryViewController* _inputAccessoryViewController;
264 258
265 // Handles autofill. 259 // Handles autofill.
266 AutofillController* _autofillController; 260 AutofillController* _autofillController;
267 261
268 // Handles GAL infobar on web pages.
269 NativeAppNavigationController* _nativeAppNavigationController;
270
271 // Handles caching and retrieving of snapshots. 262 // Handles caching and retrieving of snapshots.
272 SnapshotManager* _snapshotManager; 263 SnapshotManager* _snapshotManager;
273 264
274 // Handles retrieving, generating and updating snapshots of CRWWebController's 265 // Handles retrieving, generating and updating snapshots of CRWWebController's
275 // web page. 266 // web page.
276 WebControllerSnapshotHelper* _webControllerSnapshotHelper; 267 WebControllerSnapshotHelper* _webControllerSnapshotHelper;
277 268
278 // Handles support for window.print JavaScript calls. 269 // Handles support for window.print JavaScript calls.
279 std::unique_ptr<PrintObserver> _printObserver; 270 std::unique_ptr<PrintObserver> _printObserver;
280 271
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 312
322 // Adds the current session entry to this history database. 313 // Adds the current session entry to this history database.
323 - (void)addCurrentEntryToHistoryDB; 314 - (void)addCurrentEntryToHistoryDB;
324 315
325 // Adds any cached entries from |_addPageVector| to the history DB. 316 // Adds any cached entries from |_addPageVector| to the history DB.
326 - (void)commitCachedEntriesToHistoryDB; 317 - (void)commitCachedEntriesToHistoryDB;
327 318
328 // Returns the OpenInController for this tab. 319 // Returns the OpenInController for this tab.
329 - (OpenInController*)openInController; 320 - (OpenInController*)openInController;
330 321
331 // Initialize the Native App Launcher controller.
332 - (void)initNativeAppNavigationController;
333
334 // Handles exportable files if possible. 322 // Handles exportable files if possible.
335 - (void)handleExportableFile:(net::HttpResponseHeaders*)headers; 323 - (void)handleExportableFile:(net::HttpResponseHeaders*)headers;
336 324
337 // Called after the session history is replaced, useful for updating members 325 // Called after the session history is replaced, useful for updating members
338 // with new sessionID. 326 // with new sessionID.
339 - (void)didReplaceSessionHistory; 327 - (void)didReplaceSessionHistory;
340 328
341 // Called when the UIApplication's state becomes active. 329 // Called when the UIApplication's state becomes active.
342 - (void)applicationDidBecomeActive; 330 - (void)applicationDidBecomeActive;
343 331
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 459
472 [self updateLastVisitedTimestamp]; 460 [self updateLastVisitedTimestamp];
473 [[self webController] addObserver:self]; 461 [[self webController] addObserver:self];
474 [[self webController] setDelegate:self]; 462 [[self webController] setDelegate:self];
475 463
476 _snapshotManager = [[SnapshotManager alloc] init]; 464 _snapshotManager = [[SnapshotManager alloc] init];
477 _webControllerSnapshotHelper = [[WebControllerSnapshotHelper alloc] 465 _webControllerSnapshotHelper = [[WebControllerSnapshotHelper alloc]
478 initWithSnapshotManager:_snapshotManager 466 initWithSnapshotManager:_snapshotManager
479 tab:self]; 467 tab:self];
480 468
481 if (experimental_flags::IsNativeAppLauncherEnabled())
482 [self initNativeAppNavigationController];
483
484 [[NSNotificationCenter defaultCenter] 469 [[NSNotificationCenter defaultCenter]
485 addObserver:self 470 addObserver:self
486 selector:@selector(applicationDidBecomeActive) 471 selector:@selector(applicationDidBecomeActive)
487 name:UIApplicationDidBecomeActiveNotification 472 name:UIApplicationDidBecomeActiveNotification
488 object:nil]; 473 object:nil];
489 } 474 }
490 return self; 475 return self;
491 } 476 }
492 477
493 - (void)attachTabHelpers { 478 - (void)attachTabHelpers {
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 1535
1551 - (BOOL)webController:(CRWWebController*)webController 1536 - (BOOL)webController:(CRWWebController*)webController
1552 shouldOpenExternalURL:(const GURL&)URL { 1537 shouldOpenExternalURL:(const GURL&)URL {
1553 if (_isPrerenderTab && !isLinkLoadingPrerenderTab_) { 1538 if (_isPrerenderTab && !isLinkLoadingPrerenderTab_) {
1554 [delegate_ discardPrerender]; 1539 [delegate_ discardPrerender];
1555 return NO; 1540 return NO;
1556 } 1541 }
1557 return YES; 1542 return YES;
1558 } 1543 }
1559 1544
1560 - (BOOL)urlTriggersNativeAppLaunch:(const GURL&)url
1561 sourceURL:(const GURL&)sourceURL
1562 linkClicked:(BOOL)linkClicked {
1563 // TODO(crbug/711511): If Native App Launcher is not enabled, returning NO
1564 // bypasses all Link Navigation logic. This call should eventually be
1565 // eliminated.
1566 if (!experimental_flags::IsNativeAppLauncherEnabled())
1567 return NO;
1568
1569 // Don't open any native app directly when prerendering or from Incognito.
1570 if (_isPrerenderTab || self.browserState->IsOffTheRecord())
1571 return NO;
1572
1573 id<NativeAppMetadata> metadata =
1574 [ios::GetChromeBrowserProvider()->GetNativeAppWhitelistManager()
1575 nativeAppForURL:url];
1576 if (![metadata shouldAutoOpenLinks])
1577 return NO;
1578
1579 AuthenticationService* authenticationService =
1580 AuthenticationServiceFactory::GetForBrowserState(self.browserState);
1581 ChromeIdentity* identity = authenticationService->GetAuthenticatedIdentity();
1582
1583 // Attempts to open external app without x-callback.
1584 if ([self openExternalURL:[metadata launchURLWithURL:url identity:identity]
1585 sourceURL:sourceURL
1586 linkClicked:linkClicked]) {
1587 return YES;
1588 }
1589
1590 // Auto-open didn't work. Reset the auto-open flag.
1591 [metadata unsetShouldAutoOpenLinks];
1592 return NO;
1593 }
1594
1595 - (double)lastVisitedTimestamp { 1545 - (double)lastVisitedTimestamp {
1596 return _lastVisitedTimestamp; 1546 return _lastVisitedTimestamp;
1597 } 1547 }
1598 1548
1599 - (void)updateLastVisitedTimestamp { 1549 - (void)updateLastVisitedTimestamp {
1600 _lastVisitedTimestamp = [[NSDate date] timeIntervalSince1970]; 1550 _lastVisitedTimestamp = [[NSDate date] timeIntervalSince1970];
1601 } 1551 }
1602 1552
1603 - (infobars::InfoBarManager*)infoBarManager { 1553 - (infobars::InfoBarManager*)infoBarManager {
1604 DCHECK(self.webState); 1554 DCHECK(self.webState);
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 inBackground:NO 1794 inBackground:NO
1845 appendTo:kLastTab]; 1795 appendTo:kLastTab];
1846 [self.view chromeExecuteCommand:command]; 1796 [self.view chromeExecuteCommand:command];
1847 } else { 1797 } else {
1848 GenericChromeCommand* command = 1798 GenericChromeCommand* command =
1849 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_INCOGNITO_TAB]; 1799 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_INCOGNITO_TAB];
1850 [self.view chromeExecuteCommand:command]; 1800 [self.view chromeExecuteCommand:command];
1851 } 1801 }
1852 } 1802 }
1853 1803
1854 - (NativeAppNavigationController*)nativeAppNavigationController {
1855 // TODO(crbug.com/711511): If Native App Launcher is not enabled, simply
1856 // return nil here. This method should eventually be eliminated.
1857 if (!experimental_flags::IsNativeAppLauncherEnabled())
1858 return nil;
1859 return _nativeAppNavigationController;
1860 }
1861
1862 - (void)initNativeAppNavigationController {
1863 if (_browserState->IsOffTheRecord())
1864 return;
1865 DCHECK(!_nativeAppNavigationController);
1866 _nativeAppNavigationController =
1867 [[NativeAppNavigationController alloc] initWithWebState:self.webState];
1868 DCHECK(_nativeAppNavigationController);
1869 }
1870
1871 - (void)wasShown { 1804 - (void)wasShown {
1872 _visible = YES; 1805 _visible = YES;
1873 [self updateFullscreenWithToolbarVisible:YES]; 1806 [self updateFullscreenWithToolbarVisible:YES];
1874 [self.webController wasShown]; 1807 [self.webController wasShown];
1875 [_inputAccessoryViewController wasShown]; 1808 [_inputAccessoryViewController wasShown];
1876 } 1809 }
1877 1810
1878 - (void)wasHidden { 1811 - (void)wasHidden {
1879 _visible = NO; 1812 _visible = NO;
1880 [self updateFullscreenWithToolbarVisible:YES]; 1813 [self updateFullscreenWithToolbarVisible:YES];
(...skipping 20 matching lines...) Expand all
1901 1834
1902 - (TabModel*)parentTabModel { 1835 - (TabModel*)parentTabModel {
1903 return _parentTabModel; 1836 return _parentTabModel;
1904 } 1837 }
1905 1838
1906 - (FormInputAccessoryViewController*)inputAccessoryViewController { 1839 - (FormInputAccessoryViewController*)inputAccessoryViewController {
1907 return _inputAccessoryViewController; 1840 return _inputAccessoryViewController;
1908 } 1841 }
1909 1842
1910 @end 1843 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698