Chromium Code Reviews| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller.h" | 61 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller.h" |
| 62 #include "ios/chrome/browser/history/history_service_factory.h" | 62 #include "ios/chrome/browser/history/history_service_factory.h" |
| 63 #include "ios/chrome/browser/history/top_sites_factory.h" | 63 #include "ios/chrome/browser/history/top_sites_factory.h" |
| 64 #include "ios/chrome/browser/infobars/infobar_manager_impl.h" | 64 #include "ios/chrome/browser/infobars/infobar_manager_impl.h" |
| 65 #include "ios/chrome/browser/metrics/ios_chrome_origins_seen_service_factory.h" | 65 #include "ios/chrome/browser/metrics/ios_chrome_origins_seen_service_factory.h" |
| 66 #import "ios/chrome/browser/metrics/tab_usage_recorder.h" | 66 #import "ios/chrome/browser/metrics/tab_usage_recorder.h" |
| 67 #import "ios/chrome/browser/native_app_launcher/native_app_navigation_controller .h" | 67 #import "ios/chrome/browser/native_app_launcher/native_app_navigation_controller .h" |
| 68 #import "ios/chrome/browser/passwords/password_controller.h" | 68 #import "ios/chrome/browser/passwords/password_controller.h" |
| 69 #import "ios/chrome/browser/passwords/passwords_ui_delegate_impl.h" | 69 #import "ios/chrome/browser/passwords/passwords_ui_delegate_impl.h" |
| 70 #include "ios/chrome/browser/pref_names.h" | 70 #include "ios/chrome/browser/pref_names.h" |
| 71 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" | |
| 71 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" | 72 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" |
| 72 #include "ios/chrome/browser/sessions/ios_chrome_session_tab_helper.h" | 73 #include "ios/chrome/browser/sessions/ios_chrome_session_tab_helper.h" |
| 73 #include "ios/chrome/browser/signin/account_consistency_service_factory.h" | 74 #include "ios/chrome/browser/signin/account_consistency_service_factory.h" |
| 74 #include "ios/chrome/browser/signin/account_reconcilor_factory.h" | 75 #include "ios/chrome/browser/signin/account_reconcilor_factory.h" |
| 75 #include "ios/chrome/browser/signin/authentication_service.h" | 76 #include "ios/chrome/browser/signin/authentication_service.h" |
| 76 #include "ios/chrome/browser/signin/authentication_service_factory.h" | 77 #include "ios/chrome/browser/signin/authentication_service_factory.h" |
| 77 #include "ios/chrome/browser/signin/signin_capability.h" | 78 #include "ios/chrome/browser/signin/signin_capability.h" |
| 78 #import "ios/chrome/browser/snapshots/snapshot_manager.h" | 79 #import "ios/chrome/browser/snapshots/snapshot_manager.h" |
| 79 #import "ios/chrome/browser/snapshots/snapshot_overlay_provider.h" | 80 #import "ios/chrome/browser/snapshots/snapshot_overlay_provider.h" |
| 80 #import "ios/chrome/browser/snapshots/web_controller_snapshot_helper.h" | 81 #import "ios/chrome/browser/snapshots/web_controller_snapshot_helper.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 | 341 |
| 341 // Adds any cached entries from |addPageVector_| to the history DB. | 342 // Adds any cached entries from |addPageVector_| to the history DB. |
| 342 - (void)commitCachedEntriesToHistoryDB; | 343 - (void)commitCachedEntriesToHistoryDB; |
| 343 | 344 |
| 344 // Returns the OpenInController for this tab. | 345 // Returns the OpenInController for this tab. |
| 345 - (OpenInController*)openInController; | 346 - (OpenInController*)openInController; |
| 346 | 347 |
| 347 // Initialize the Native App Launcher controller. | 348 // Initialize the Native App Launcher controller. |
| 348 - (void)initNativeAppNavigationController; | 349 - (void)initNativeAppNavigationController; |
| 349 | 350 |
| 350 // Opens a link in an external app. Returns YES iff |url| is launched in an | 351 //// Opens a link in an external app. Returns YES iff |url| is launched in an |
| 351 // external app. | 352 //// external app. |
|
jif
2017/03/30 09:05:56
s/////////
Olivier
2017/03/30 15:45:04
This is removed
| |
| 352 - (BOOL)openExternalURL:(const GURL&)url linkClicked:(BOOL)linkClicked; | 353 //- (BOOL)openExternalURL:(const GURL&)url linkClicked:(BOOL)linkClicked; |
|
Eugene But (OOO till 7-30)
2017/03/29 19:56:13
Looks like this is redefinition of CRWWebDelegate
Olivier
2017/03/30 15:45:04
Done.
| |
| 353 | 354 |
| 354 // Handles exportable files if possible. | 355 // Handles exportable files if possible. |
| 355 - (void)handleExportableFile:(net::HttpResponseHeaders*)headers; | 356 - (void)handleExportableFile:(net::HttpResponseHeaders*)headers; |
| 356 | 357 |
| 357 // Called after the session history is replaced, useful for updating members | 358 // Called after the session history is replaced, useful for updating members |
| 358 // with new sessionID. | 359 // with new sessionID. |
| 359 - (void)didReplaceSessionHistory; | 360 - (void)didReplaceSessionHistory; |
| 360 | 361 |
| 361 // Called when the UIApplication's state becomes active. | 362 // Called when the UIApplication's state becomes active. |
| 362 - (void)applicationDidBecomeActive; | 363 - (void)applicationDidBecomeActive; |
| (...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1257 | 1258 |
| 1258 if (self.navigationManager) { | 1259 if (self.navigationManager) { |
| 1259 CRWSessionController* sessionController = | 1260 CRWSessionController* sessionController = |
| 1260 [self navigationManagerImpl]->GetSessionController(); | 1261 [self navigationManagerImpl]->GetSessionController(); |
| 1261 NSInteger itemIndex = [sessionController indexOfItem:item]; | 1262 NSInteger itemIndex = [sessionController indexOfItem:item]; |
| 1262 DCHECK_NE(itemIndex, NSNotFound); | 1263 DCHECK_NE(itemIndex, NSNotFound); |
| 1263 self.navigationManager->GoToIndex(itemIndex); | 1264 self.navigationManager->GoToIndex(itemIndex); |
| 1264 } | 1265 } |
| 1265 } | 1266 } |
| 1266 | 1267 |
| 1267 - (BOOL)openExternalURL:(const GURL&)url linkClicked:(BOOL)linkClicked { | 1268 - (BOOL)openExternalURL:(const GURL&)url |
| 1269 sourceURL:(const GURL&)sourceURL | |
| 1270 linkClicked:(BOOL)linkClicked { | |
| 1268 if (!externalAppLauncher_.get()) | 1271 if (!externalAppLauncher_.get()) |
| 1269 externalAppLauncher_.reset([[ExternalAppLauncher alloc] init]); | 1272 externalAppLauncher_.reset([[ExternalAppLauncher alloc] init]); |
| 1270 | 1273 |
| 1271 // This method may release CRWWebController which may cause a crash | 1274 // This method may release CRWWebController which may cause a crash |
| 1272 // (crbug.com/393949). | 1275 // (crbug.com/393949). |
| 1273 [[self.webController retain] autorelease]; | 1276 [[self.webController retain] autorelease]; |
| 1274 | 1277 |
| 1275 // Make a local url copy for possible modification. | 1278 // Make a local url copy for possible modification. |
| 1276 GURL finalURL = url; | 1279 GURL finalURL = url; |
| 1277 | 1280 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 1304 } | 1307 } |
| 1305 | 1308 |
| 1306 if ([externalAppLauncher_ openURL:finalURL linkClicked:linkClicked]) { | 1309 if ([externalAppLauncher_ openURL:finalURL linkClicked:linkClicked]) { |
| 1307 // Clears pending navigation history after successfully launching the | 1310 // Clears pending navigation history after successfully launching the |
| 1308 // external app. | 1311 // external app. |
| 1309 DCHECK([self navigationManager]); | 1312 DCHECK([self navigationManager]); |
| 1310 [self navigationManager]->DiscardNonCommittedItems(); | 1313 [self navigationManager]->DiscardNonCommittedItems(); |
| 1311 // Ensure the UI reflects the current entry, not the just-discarded pending | 1314 // Ensure the UI reflects the current entry, not the just-discarded pending |
| 1312 // entry. | 1315 // entry. |
| 1313 [parentTabModel_ notifyTabChanged:self]; | 1316 [parentTabModel_ notifyTabChanged:self]; |
| 1317 | |
| 1318 if (sourceURL.is_valid()) { | |
| 1319 ReadingListModel* model = | |
| 1320 ReadingListModelFactory::GetForBrowserState(browserState_); | |
| 1321 if (model && model->loaded()) { | |
| 1322 model->SetReadStatus(sourceURL, true); | |
| 1323 } | |
| 1324 } | |
| 1325 | |
| 1314 return YES; | 1326 return YES; |
| 1315 } | 1327 } |
| 1316 return NO; | 1328 return NO; |
| 1317 } | 1329 } |
| 1318 | 1330 |
| 1331 - (void)currentNavigationWillContinueInExternalApp { | |
|
Eugene But (OOO till 7-30)
2017/03/29 19:56:13
I guess you don't need this anymore
Olivier
2017/03/30 15:45:03
Done.
| |
| 1332 } | |
| 1333 | |
| 1319 - (void)webState:(web::WebState*)webState | 1334 - (void)webState:(web::WebState*)webState |
| 1320 didFinishNavigation:(web::NavigationContext*)navigation { | 1335 didFinishNavigation:(web::NavigationContext*)navigation { |
| 1321 if (navigation->IsSameDocument()) { | 1336 if (navigation->IsSameDocument()) { |
| 1322 auto* faviconDriver = favicon::WebFaviconDriver::FromWebState(webState); | 1337 auto* faviconDriver = favicon::WebFaviconDriver::FromWebState(webState); |
| 1323 if (faviconDriver) { | 1338 if (faviconDriver) { |
| 1324 // Fetch the favicon for the new URL. | 1339 // Fetch the favicon for the new URL. |
| 1325 faviconDriver->FetchFavicon(navigation->GetUrl()); | 1340 faviconDriver->FetchFavicon(navigation->GetUrl()); |
| 1326 } | 1341 } |
| 1327 } | 1342 } |
| 1328 | 1343 |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1739 nativeAppForURL:url] retain]); | 1754 nativeAppForURL:url] retain]); |
| 1740 if (![metadata shouldAutoOpenLinks]) | 1755 if (![metadata shouldAutoOpenLinks]) |
| 1741 return NO; | 1756 return NO; |
| 1742 | 1757 |
| 1743 AuthenticationService* authenticationService = | 1758 AuthenticationService* authenticationService = |
| 1744 AuthenticationServiceFactory::GetForBrowserState(self.browserState); | 1759 AuthenticationServiceFactory::GetForBrowserState(self.browserState); |
| 1745 ChromeIdentity* identity = authenticationService->GetAuthenticatedIdentity(); | 1760 ChromeIdentity* identity = authenticationService->GetAuthenticatedIdentity(); |
| 1746 | 1761 |
| 1747 // Attempts to open external app without x-callback. | 1762 // Attempts to open external app without x-callback. |
| 1748 if ([self openExternalURL:[metadata launchURLWithURL:url identity:identity] | 1763 if ([self openExternalURL:[metadata launchURLWithURL:url identity:identity] |
| 1764 sourceURL:sourceURL | |
| 1749 linkClicked:linkClicked]) { | 1765 linkClicked:linkClicked]) { |
| 1750 return YES; | 1766 return YES; |
| 1751 } | 1767 } |
| 1752 | 1768 |
| 1753 // Auto-open didn't work. Reset the auto-open flag. | 1769 // Auto-open didn't work. Reset the auto-open flag. |
| 1754 [metadata unsetShouldAutoOpenLinks]; | 1770 [metadata unsetShouldAutoOpenLinks]; |
| 1755 return NO; | 1771 return NO; |
| 1756 } | 1772 } |
| 1757 | 1773 |
| 1758 - (double)lastVisitedTimestamp { | 1774 - (double)lastVisitedTimestamp { |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2087 | 2103 |
| 2088 - (TabModel*)parentTabModel { | 2104 - (TabModel*)parentTabModel { |
| 2089 return parentTabModel_; | 2105 return parentTabModel_; |
| 2090 } | 2106 } |
| 2091 | 2107 |
| 2092 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2108 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2093 return inputAccessoryViewController_.get(); | 2109 return inputAccessoryViewController_.get(); |
| 2094 } | 2110 } |
| 2095 | 2111 |
| 2096 @end | 2112 @end |
| OLD | NEW |