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

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

Issue 2821453003: Removes Native App Launcher functionality. (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
« no previous file with comments | « no previous file | 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 55 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
56 #include "ios/chrome/browser/chrome_url_constants.h" 56 #include "ios/chrome/browser/chrome_url_constants.h"
57 #import "ios/chrome/browser/crash_loop_detection_util.h" 57 #import "ios/chrome/browser/crash_loop_detection_util.h"
58 #include "ios/chrome/browser/experimental_flags.h" 58 #include "ios/chrome/browser/experimental_flags.h"
59 #import "ios/chrome/browser/find_in_page/find_in_page_controller.h" 59 #import "ios/chrome/browser/find_in_page/find_in_page_controller.h"
60 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller.h" 60 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller.h"
61 #include "ios/chrome/browser/history/history_service_factory.h" 61 #include "ios/chrome/browser/history/history_service_factory.h"
62 #include "ios/chrome/browser/history/top_sites_factory.h" 62 #include "ios/chrome/browser/history/top_sites_factory.h"
63 #include "ios/chrome/browser/infobars/infobar_manager_impl.h" 63 #include "ios/chrome/browser/infobars/infobar_manager_impl.h"
64 #import "ios/chrome/browser/metrics/tab_usage_recorder.h" 64 #import "ios/chrome/browser/metrics/tab_usage_recorder.h"
65 #import "ios/chrome/browser/native_app_launcher/native_app_navigation_controller .h"
66 #import "ios/chrome/browser/passwords/password_controller.h" 65 #import "ios/chrome/browser/passwords/password_controller.h"
67 #import "ios/chrome/browser/passwords/passwords_ui_delegate_impl.h" 66 #import "ios/chrome/browser/passwords/passwords_ui_delegate_impl.h"
68 #include "ios/chrome/browser/pref_names.h" 67 #include "ios/chrome/browser/pref_names.h"
69 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" 68 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h"
70 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" 69 #include "ios/chrome/browser/search_engines/template_url_service_factory.h"
71 #include "ios/chrome/browser/sessions/ios_chrome_session_tab_helper.h" 70 #include "ios/chrome/browser/sessions/ios_chrome_session_tab_helper.h"
72 #include "ios/chrome/browser/signin/account_consistency_service_factory.h" 71 #include "ios/chrome/browser/signin/account_consistency_service_factory.h"
73 #include "ios/chrome/browser/signin/account_reconcilor_factory.h" 72 #include "ios/chrome/browser/signin/account_reconcilor_factory.h"
74 #include "ios/chrome/browser/signin/authentication_service.h"
75 #include "ios/chrome/browser/signin/authentication_service_factory.h"
76 #include "ios/chrome/browser/signin/signin_capability.h" 73 #include "ios/chrome/browser/signin/signin_capability.h"
77 #import "ios/chrome/browser/snapshots/snapshot_manager.h" 74 #import "ios/chrome/browser/snapshots/snapshot_manager.h"
78 #import "ios/chrome/browser/snapshots/snapshot_overlay_provider.h" 75 #import "ios/chrome/browser/snapshots/snapshot_overlay_provider.h"
79 #import "ios/chrome/browser/snapshots/web_controller_snapshot_helper.h" 76 #import "ios/chrome/browser/snapshots/web_controller_snapshot_helper.h"
80 #import "ios/chrome/browser/tabs/legacy_tab_helper.h" 77 #import "ios/chrome/browser/tabs/legacy_tab_helper.h"
81 #import "ios/chrome/browser/tabs/tab_delegate.h" 78 #import "ios/chrome/browser/tabs/tab_delegate.h"
82 #import "ios/chrome/browser/tabs/tab_dialog_delegate.h" 79 #import "ios/chrome/browser/tabs/tab_dialog_delegate.h"
83 #import "ios/chrome/browser/tabs/tab_headers_delegate.h" 80 #import "ios/chrome/browser/tabs/tab_headers_delegate.h"
84 #import "ios/chrome/browser/tabs/tab_helper_util.h" 81 #import "ios/chrome/browser/tabs/tab_helper_util.h"
85 #import "ios/chrome/browser/tabs/tab_model.h" 82 #import "ios/chrome/browser/tabs/tab_model.h"
(...skipping 14 matching lines...) Expand all
100 #import "ios/chrome/browser/ui/reader_mode/reader_mode_checker.h" 97 #import "ios/chrome/browser/ui/reader_mode/reader_mode_checker.h"
101 #import "ios/chrome/browser/ui/reader_mode/reader_mode_controller.h" 98 #import "ios/chrome/browser/ui/reader_mode/reader_mode_controller.h"
102 #include "ios/chrome/browser/ui/ui_util.h" 99 #include "ios/chrome/browser/ui/ui_util.h"
103 #import "ios/chrome/browser/web/auto_reload_bridge.h" 100 #import "ios/chrome/browser/web/auto_reload_bridge.h"
104 #import "ios/chrome/browser/web/external_app_launcher.h" 101 #import "ios/chrome/browser/web/external_app_launcher.h"
105 #import "ios/chrome/browser/web/navigation_manager_util.h" 102 #import "ios/chrome/browser/web/navigation_manager_util.h"
106 #import "ios/chrome/browser/web/passkit_dialog_provider.h" 103 #import "ios/chrome/browser/web/passkit_dialog_provider.h"
107 #include "ios/chrome/browser/web/print_observer.h" 104 #include "ios/chrome/browser/web/print_observer.h"
108 #import "ios/chrome/browser/xcallback_parameters.h" 105 #import "ios/chrome/browser/xcallback_parameters.h"
109 #include "ios/chrome/grit/ios_strings.h" 106 #include "ios/chrome/grit/ios_strings.h"
110 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
111 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_metad ata.h"
112 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_white list_manager.h"
113 #import "ios/web/navigation/crw_session_controller.h" 107 #import "ios/web/navigation/crw_session_controller.h"
114 #import "ios/web/navigation/navigation_item_impl.h" 108 #import "ios/web/navigation/navigation_item_impl.h"
115 #import "ios/web/navigation/navigation_manager_impl.h" 109 #import "ios/web/navigation/navigation_manager_impl.h"
116 #include "ios/web/public/favicon_status.h" 110 #include "ios/web/public/favicon_status.h"
117 #include "ios/web/public/favicon_url.h" 111 #include "ios/web/public/favicon_url.h"
118 #include "ios/web/public/interstitials/web_interstitial.h" 112 #include "ios/web/public/interstitials/web_interstitial.h"
119 #include "ios/web/public/load_committed_details.h" 113 #include "ios/web/public/load_committed_details.h"
120 #import "ios/web/public/navigation_manager.h" 114 #import "ios/web/public/navigation_manager.h"
121 #include "ios/web/public/referrer.h" 115 #include "ios/web/public/referrer.h"
122 #import "ios/web/public/serializable_user_data_manager.h" 116 #import "ios/web/public/serializable_user_data_manager.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 inputAccessoryViewController_; 270 inputAccessoryViewController_;
277 271
278 // TODO(crbug.com/661665): move the WebContentsObservers into their own 272 // TODO(crbug.com/661665): move the WebContentsObservers into their own
279 // container. 273 // container.
280 // Handles saving and autofill of passwords. 274 // Handles saving and autofill of passwords.
281 base::scoped_nsobject<PasswordController> passwordController_; 275 base::scoped_nsobject<PasswordController> passwordController_;
282 276
283 // Handles autofill. 277 // Handles autofill.
284 base::scoped_nsobject<AutofillController> autofillController_; 278 base::scoped_nsobject<AutofillController> autofillController_;
285 279
286 // Handles GAL infobar on web pages.
287 base::scoped_nsobject<NativeAppNavigationController>
288 nativeAppNavigationController_;
289
290 // Handles caching and retrieving of snapshots. 280 // Handles caching and retrieving of snapshots.
291 base::scoped_nsobject<SnapshotManager> snapshotManager_; 281 base::scoped_nsobject<SnapshotManager> snapshotManager_;
292 282
293 // Handles retrieving, generating and updating snapshots of CRWWebController's 283 // Handles retrieving, generating and updating snapshots of CRWWebController's
294 // web page. 284 // web page.
295 base::scoped_nsobject<WebControllerSnapshotHelper> 285 base::scoped_nsobject<WebControllerSnapshotHelper>
296 webControllerSnapshotHelper_; 286 webControllerSnapshotHelper_;
297 287
298 // Handles support for window.print JavaScript calls. 288 // Handles support for window.print JavaScript calls.
299 std::unique_ptr<PrintObserver> printObserver_; 289 std::unique_ptr<PrintObserver> printObserver_;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 334
345 // Adds the current session entry to this history database. 335 // Adds the current session entry to this history database.
346 - (void)addCurrentEntryToHistoryDB; 336 - (void)addCurrentEntryToHistoryDB;
347 337
348 // Adds any cached entries from |addPageVector_| to the history DB. 338 // Adds any cached entries from |addPageVector_| to the history DB.
349 - (void)commitCachedEntriesToHistoryDB; 339 - (void)commitCachedEntriesToHistoryDB;
350 340
351 // Returns the OpenInController for this tab. 341 // Returns the OpenInController for this tab.
352 - (OpenInController*)openInController; 342 - (OpenInController*)openInController;
353 343
354 // Initialize the Native App Launcher controller.
355 - (void)initNativeAppNavigationController;
356
357 // Handles exportable files if possible. 344 // Handles exportable files if possible.
358 - (void)handleExportableFile:(net::HttpResponseHeaders*)headers; 345 - (void)handleExportableFile:(net::HttpResponseHeaders*)headers;
359 346
360 // Called after the session history is replaced, useful for updating members 347 // Called after the session history is replaced, useful for updating members
361 // with new sessionID. 348 // with new sessionID.
362 - (void)didReplaceSessionHistory; 349 - (void)didReplaceSessionHistory;
363 350
364 // Called when the UIApplication's state becomes active. 351 // Called when the UIApplication's state becomes active.
365 - (void)applicationDidBecomeActive; 352 - (void)applicationDidBecomeActive;
366 353
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 486
500 [self updateLastVisitedTimestamp]; 487 [self updateLastVisitedTimestamp];
501 [[self webController] addObserver:self]; 488 [[self webController] addObserver:self];
502 [[self webController] setDelegate:self]; 489 [[self webController] setDelegate:self];
503 490
504 snapshotManager_.reset([[SnapshotManager alloc] init]); 491 snapshotManager_.reset([[SnapshotManager alloc] init]);
505 webControllerSnapshotHelper_.reset([[WebControllerSnapshotHelper alloc] 492 webControllerSnapshotHelper_.reset([[WebControllerSnapshotHelper alloc]
506 initWithSnapshotManager:snapshotManager_ 493 initWithSnapshotManager:snapshotManager_
507 tab:self]); 494 tab:self]);
508 495
509 [self initNativeAppNavigationController];
510
511 [[NSNotificationCenter defaultCenter] 496 [[NSNotificationCenter defaultCenter]
512 addObserver:self 497 addObserver:self
513 selector:@selector(applicationDidBecomeActive) 498 selector:@selector(applicationDidBecomeActive)
514 name:UIApplicationDidBecomeActiveNotification 499 name:UIApplicationDidBecomeActiveNotification
515 object:nil]; 500 object:nil];
516 } 501 }
517 return self; 502 return self;
518 } 503 }
519 504
520 - (void)attachTabHelpers { 505 - (void)attachTabHelpers {
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 if (isPrerenderTab_ && !isLinkLoadingPrerenderTab_) { 1604 if (isPrerenderTab_ && !isLinkLoadingPrerenderTab_) {
1620 [delegate_ discardPrerender]; 1605 [delegate_ discardPrerender];
1621 return NO; 1606 return NO;
1622 } 1607 }
1623 return YES; 1608 return YES;
1624 } 1609 }
1625 1610
1626 - (BOOL)urlTriggersNativeAppLaunch:(const GURL&)url 1611 - (BOOL)urlTriggersNativeAppLaunch:(const GURL&)url
1627 sourceURL:(const GURL&)sourceURL 1612 sourceURL:(const GURL&)sourceURL
1628 linkClicked:(BOOL)linkClicked { 1613 linkClicked:(BOOL)linkClicked {
1629 // Don't open any native app directly when prerendering or from Incognito. 1614 // TODO(crbug/711511): Returning NO bypasses all Link Navigation logic
1630 if (isPrerenderTab_ || self.browserState->IsOffTheRecord()) 1615 // for Native App Launcher. This call should eventually be eliminated.
1631 return NO;
1632
1633 base::scoped_nsprotocol<id<NativeAppMetadata>> metadata(
1634 [[ios::GetChromeBrowserProvider()->GetNativeAppWhitelistManager()
1635 nativeAppForURL:url] retain]);
1636 if (![metadata shouldAutoOpenLinks])
1637 return NO;
1638
1639 AuthenticationService* authenticationService =
1640 AuthenticationServiceFactory::GetForBrowserState(self.browserState);
1641 ChromeIdentity* identity = authenticationService->GetAuthenticatedIdentity();
1642
1643 // Attempts to open external app without x-callback.
1644 if ([self openExternalURL:[metadata launchURLWithURL:url identity:identity]
1645 sourceURL:sourceURL
1646 linkClicked:linkClicked]) {
1647 return YES;
1648 }
1649
1650 // Auto-open didn't work. Reset the auto-open flag.
1651 [metadata unsetShouldAutoOpenLinks];
1652 return NO; 1616 return NO;
1653 } 1617 }
1654 1618
1655 - (double)lastVisitedTimestamp { 1619 - (double)lastVisitedTimestamp {
1656 return lastVisitedTimestamp_; 1620 return lastVisitedTimestamp_;
1657 } 1621 }
1658 1622
1659 - (void)updateLastVisitedTimestamp { 1623 - (void)updateLastVisitedTimestamp {
1660 lastVisitedTimestamp_ = [[NSDate date] timeIntervalSince1970]; 1624 lastVisitedTimestamp_ = [[NSDate date] timeIntervalSince1970];
1661 } 1625 }
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1907 appendTo:kLastTab]); 1871 appendTo:kLastTab]);
1908 [self.view chromeExecuteCommand:command]; 1872 [self.view chromeExecuteCommand:command];
1909 } else { 1873 } else {
1910 base::scoped_nsobject<GenericChromeCommand> chromeCommand( 1874 base::scoped_nsobject<GenericChromeCommand> chromeCommand(
1911 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_INCOGNITO_TAB]); 1875 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_INCOGNITO_TAB]);
1912 [self.view chromeExecuteCommand:chromeCommand]; 1876 [self.view chromeExecuteCommand:chromeCommand];
1913 } 1877 }
1914 } 1878 }
1915 1879
1916 - (NativeAppNavigationController*)nativeAppNavigationController { 1880 - (NativeAppNavigationController*)nativeAppNavigationController {
1917 return nativeAppNavigationController_; 1881 // TODO(crbug.com/711511): This call should eventually be eliminated.
1918 } 1882 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 } 1883 }
1928 1884
1929 - (id<PassKitDialogProvider>)passKitDialogProvider { 1885 - (id<PassKitDialogProvider>)passKitDialogProvider {
1930 return passKitDialogProvider_.get(); 1886 return passKitDialogProvider_.get();
1931 } 1887 }
1932 1888
1933 - (void)setPassKitDialogProvider:(id<PassKitDialogProvider>)provider { 1889 - (void)setPassKitDialogProvider:(id<PassKitDialogProvider>)provider {
1934 passKitDialogProvider_.reset(provider); 1890 passKitDialogProvider_.reset(provider);
1935 } 1891 }
1936 1892
(...skipping 30 matching lines...) Expand all
1967 1923
1968 - (TabModel*)parentTabModel { 1924 - (TabModel*)parentTabModel {
1969 return parentTabModel_; 1925 return parentTabModel_;
1970 } 1926 }
1971 1927
1972 - (FormInputAccessoryViewController*)inputAccessoryViewController { 1928 - (FormInputAccessoryViewController*)inputAccessoryViewController {
1973 return inputAccessoryViewController_.get(); 1929 return inputAccessoryViewController_.get();
1974 } 1930 }
1975 1931
1976 @end 1932 @end
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/tabs/tab_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698