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

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

Issue 2894883004: Removed IsNativeAppLauncherEnabled() experiment (Closed)
Patch Set: rebase Created 3 years, 6 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
« no previous file with comments | « ios/chrome/browser/tabs/tab.h ('k') | ios/chrome/browser/tabs/tab_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/navigation_item_impl.h" 105 #import "ios/web/navigation/navigation_item_impl.h"
112 #import "ios/web/navigation/navigation_manager_impl.h" 106 #import "ios/web/navigation/navigation_manager_impl.h"
113 #include "ios/web/public/favicon_status.h" 107 #include "ios/web/public/favicon_status.h"
114 #include "ios/web/public/favicon_url.h" 108 #include "ios/web/public/favicon_url.h"
115 #include "ios/web/public/interstitials/web_interstitial.h" 109 #include "ios/web/public/interstitials/web_interstitial.h"
116 #include "ios/web/public/load_committed_details.h" 110 #include "ios/web/public/load_committed_details.h"
117 #import "ios/web/public/navigation_manager.h" 111 #import "ios/web/public/navigation_manager.h"
118 #include "ios/web/public/referrer.h" 112 #include "ios/web/public/referrer.h"
119 #import "ios/web/public/serializable_user_data_manager.h" 113 #import "ios/web/public/serializable_user_data_manager.h"
120 #include "ios/web/public/ssl_status.h" 114 #include "ios/web/public/ssl_status.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 251
258 // Handles suggestions for form entry. 252 // Handles suggestions for form entry.
259 FormSuggestionController* _suggestionController; 253 FormSuggestionController* _suggestionController;
260 254
261 // Manages the input accessory view during form input. 255 // Manages the input accessory view during form input.
262 FormInputAccessoryViewController* _inputAccessoryViewController; 256 FormInputAccessoryViewController* _inputAccessoryViewController;
263 257
264 // Handles autofill. 258 // Handles autofill.
265 AutofillController* _autofillController; 259 AutofillController* _autofillController;
266 260
267 // Handles GAL infobar on web pages.
268 NativeAppNavigationController* _nativeAppNavigationController;
269
270 // Handles caching and retrieving of snapshots. 261 // Handles caching and retrieving of snapshots.
271 SnapshotManager* _snapshotManager; 262 SnapshotManager* _snapshotManager;
272 263
273 // Handles retrieving, generating and updating snapshots of CRWWebController's 264 // Handles retrieving, generating and updating snapshots of CRWWebController's
274 // web page. 265 // web page.
275 WebControllerSnapshotHelper* _webControllerSnapshotHelper; 266 WebControllerSnapshotHelper* _webControllerSnapshotHelper;
276 267
277 // Handles support for window.print JavaScript calls. 268 // Handles support for window.print JavaScript calls.
278 std::unique_ptr<PrintObserver> _printObserver; 269 std::unique_ptr<PrintObserver> _printObserver;
279 270
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 311
321 // Adds the current session entry to this history database. 312 // Adds the current session entry to this history database.
322 - (void)addCurrentEntryToHistoryDB; 313 - (void)addCurrentEntryToHistoryDB;
323 314
324 // Adds any cached entries from |_addPageVector| to the history DB. 315 // Adds any cached entries from |_addPageVector| to the history DB.
325 - (void)commitCachedEntriesToHistoryDB; 316 - (void)commitCachedEntriesToHistoryDB;
326 317
327 // Returns the OpenInController for this tab. 318 // Returns the OpenInController for this tab.
328 - (OpenInController*)openInController; 319 - (OpenInController*)openInController;
329 320
330 // Initialize the Native App Launcher controller.
331 - (void)initNativeAppNavigationController;
332
333 // Handles exportable files if possible. 321 // Handles exportable files if possible.
334 - (void)handleExportableFile:(net::HttpResponseHeaders*)headers; 322 - (void)handleExportableFile:(net::HttpResponseHeaders*)headers;
335 323
336 // Called after the session history is replaced, useful for updating members 324 // Called after the session history is replaced, useful for updating members
337 // with new sessionID. 325 // with new sessionID.
338 - (void)didReplaceSessionHistory; 326 - (void)didReplaceSessionHistory;
339 327
340 // Called when the UIApplication's state becomes active. 328 // Called when the UIApplication's state becomes active.
341 - (void)applicationDidBecomeActive; 329 - (void)applicationDidBecomeActive;
342 330
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 458
471 [self updateLastVisitedTimestamp]; 459 [self updateLastVisitedTimestamp];
472 [[self webController] addObserver:self]; 460 [[self webController] addObserver:self];
473 [[self webController] setDelegate:self]; 461 [[self webController] setDelegate:self];
474 462
475 _snapshotManager = [[SnapshotManager alloc] initWithWebState:webState]; 463 _snapshotManager = [[SnapshotManager alloc] initWithWebState:webState];
476 _webControllerSnapshotHelper = [[WebControllerSnapshotHelper alloc] 464 _webControllerSnapshotHelper = [[WebControllerSnapshotHelper alloc]
477 initWithSnapshotManager:_snapshotManager 465 initWithSnapshotManager:_snapshotManager
478 tab:self]; 466 tab:self];
479 467
480 if (experimental_flags::IsNativeAppLauncherEnabled())
481 [self initNativeAppNavigationController];
482
483 [[NSNotificationCenter defaultCenter] 468 [[NSNotificationCenter defaultCenter]
484 addObserver:self 469 addObserver:self
485 selector:@selector(applicationDidBecomeActive) 470 selector:@selector(applicationDidBecomeActive)
486 name:UIApplicationDidBecomeActiveNotification 471 name:UIApplicationDidBecomeActiveNotification
487 object:nil]; 472 object:nil];
488 } 473 }
489 return self; 474 return self;
490 } 475 }
491 476
492 - (void)attachTabHelpers { 477 - (void)attachTabHelpers {
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 1528
1544 - (BOOL)webController:(CRWWebController*)webController 1529 - (BOOL)webController:(CRWWebController*)webController
1545 shouldOpenExternalURL:(const GURL&)URL { 1530 shouldOpenExternalURL:(const GURL&)URL {
1546 if (_isPrerenderTab && !isLinkLoadingPrerenderTab_) { 1531 if (_isPrerenderTab && !isLinkLoadingPrerenderTab_) {
1547 [delegate_ discardPrerender]; 1532 [delegate_ discardPrerender];
1548 return NO; 1533 return NO;
1549 } 1534 }
1550 return YES; 1535 return YES;
1551 } 1536 }
1552 1537
1553 - (BOOL)urlTriggersNativeAppLaunch:(const GURL&)url
1554 sourceURL:(const GURL&)sourceURL
1555 linkClicked:(BOOL)linkClicked {
1556 // TODO(crbug/711511): If Native App Launcher is not enabled, returning NO
1557 // bypasses all Link Navigation logic. This call should eventually be
1558 // eliminated.
1559 if (!experimental_flags::IsNativeAppLauncherEnabled())
1560 return NO;
1561
1562 // Don't open any native app directly when prerendering or from Incognito.
1563 if (_isPrerenderTab || self.browserState->IsOffTheRecord())
1564 return NO;
1565
1566 id<NativeAppMetadata> metadata =
1567 [ios::GetChromeBrowserProvider()->GetNativeAppWhitelistManager()
1568 nativeAppForURL:url];
1569 if (![metadata shouldAutoOpenLinks])
1570 return NO;
1571
1572 AuthenticationService* authenticationService =
1573 AuthenticationServiceFactory::GetForBrowserState(self.browserState);
1574 ChromeIdentity* identity = authenticationService->GetAuthenticatedIdentity();
1575
1576 // Attempts to open external app without x-callback.
1577 if ([self openExternalURL:[metadata launchURLWithURL:url identity:identity]
1578 sourceURL:sourceURL
1579 linkClicked:linkClicked]) {
1580 return YES;
1581 }
1582
1583 // Auto-open didn't work. Reset the auto-open flag.
1584 [metadata unsetShouldAutoOpenLinks];
1585 return NO;
1586 }
1587
1588 - (double)lastVisitedTimestamp { 1538 - (double)lastVisitedTimestamp {
1589 return _lastVisitedTimestamp; 1539 return _lastVisitedTimestamp;
1590 } 1540 }
1591 1541
1592 - (void)updateLastVisitedTimestamp { 1542 - (void)updateLastVisitedTimestamp {
1593 _lastVisitedTimestamp = [[NSDate date] timeIntervalSince1970]; 1543 _lastVisitedTimestamp = [[NSDate date] timeIntervalSince1970];
1594 } 1544 }
1595 1545
1596 - (infobars::InfoBarManager*)infoBarManager { 1546 - (infobars::InfoBarManager*)infoBarManager {
1597 DCHECK(self.webState); 1547 DCHECK(self.webState);
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 inBackground:NO 1787 inBackground:NO
1838 appendTo:kLastTab]; 1788 appendTo:kLastTab];
1839 [self.view chromeExecuteCommand:command]; 1789 [self.view chromeExecuteCommand:command];
1840 } else { 1790 } else {
1841 GenericChromeCommand* command = 1791 GenericChromeCommand* command =
1842 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_INCOGNITO_TAB]; 1792 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_INCOGNITO_TAB];
1843 [self.view chromeExecuteCommand:command]; 1793 [self.view chromeExecuteCommand:command];
1844 } 1794 }
1845 } 1795 }
1846 1796
1847 - (NativeAppNavigationController*)nativeAppNavigationController {
1848 // TODO(crbug.com/711511): If Native App Launcher is not enabled, simply
1849 // return nil here. This method should eventually be eliminated.
1850 if (!experimental_flags::IsNativeAppLauncherEnabled())
1851 return nil;
1852 return _nativeAppNavigationController;
1853 }
1854
1855 - (void)initNativeAppNavigationController {
1856 if (_browserState->IsOffTheRecord())
1857 return;
1858 DCHECK(!_nativeAppNavigationController);
1859 _nativeAppNavigationController =
1860 [[NativeAppNavigationController alloc] initWithWebState:self.webState];
1861 DCHECK(_nativeAppNavigationController);
1862 }
1863
1864 - (void)wasShown { 1797 - (void)wasShown {
1865 _visible = YES; 1798 _visible = YES;
1866 [self updateFullscreenWithToolbarVisible:YES]; 1799 [self updateFullscreenWithToolbarVisible:YES];
1867 [self.webController wasShown]; 1800 [self.webController wasShown];
1868 [_inputAccessoryViewController wasShown]; 1801 [_inputAccessoryViewController wasShown];
1869 } 1802 }
1870 1803
1871 - (void)wasHidden { 1804 - (void)wasHidden {
1872 _visible = NO; 1805 _visible = NO;
1873 [self updateFullscreenWithToolbarVisible:YES]; 1806 [self updateFullscreenWithToolbarVisible:YES];
(...skipping 20 matching lines...) Expand all
1894 1827
1895 - (TabModel*)parentTabModel { 1828 - (TabModel*)parentTabModel {
1896 return _parentTabModel; 1829 return _parentTabModel;
1897 } 1830 }
1898 1831
1899 - (FormInputAccessoryViewController*)inputAccessoryViewController { 1832 - (FormInputAccessoryViewController*)inputAccessoryViewController {
1900 return _inputAccessoryViewController; 1833 return _inputAccessoryViewController;
1901 } 1834 }
1902 1835
1903 @end 1836 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/tabs/tab.h ('k') | ios/chrome/browser/tabs/tab_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698