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

Unified Diff: ios/chrome/browser/tabs/tab_model.mm

Issue 2823623002: Remove usage of Tab's |url| property from TabModel. (Closed)
Patch Set: test + formatting fixes 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ios/chrome/browser/tabs/tab_model_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/tabs/tab_model.mm
diff --git a/ios/chrome/browser/tabs/tab_model.mm b/ios/chrome/browser/tabs/tab_model.mm
index 193dd1f2225c928b458b6e721b8a817aa3b2a4f4..720595b24cc3ebee9acc748d1a8054049195a57a 100644
--- a/ios/chrome/browser/tabs/tab_model.mm
+++ b/ios/chrome/browser/tabs/tab_model.mm
@@ -593,9 +593,16 @@ - (NSSet*)currentlyReferencedExternalFiles {
return referencedFiles;
// Check the currently open tabs for external files.
for (Tab* tab in self) {
- if (UrlIsExternalFileReference(tab.url)) {
- NSString* fileName = base::SysUTF8ToNSString(tab.url.ExtractFileName());
- [referencedFiles addObject:fileName];
+ const GURL& lastCommittedURL = tab.lastCommittedURL;
+ if (UrlIsExternalFileReference(lastCommittedURL)) {
+ [referencedFiles addObject:base::SysUTF8ToNSString(
+ lastCommittedURL.ExtractFileName())];
+ }
+ web::NavigationItem* pendingItem =
+ tab.webState->GetNavigationManager()->GetPendingItem();
+ if (pendingItem && UrlIsExternalFileReference(pendingItem->GetURL())) {
+ [referencedFiles addObject:base::SysUTF8ToNSString(
+ pendingItem->GetURL().ExtractFileName())];
}
}
// Do the same for the recently closed tabs.
@@ -748,7 +755,9 @@ - (BOOL)restoreSessionWindow:(SessionWindowIOS*)window
BOOL closedNTPTab = NO;
if (oldCount == 1) {
Tab* tab = [self tabAtIndex:0];
- if (tab.url == GURL(kChromeUINewTabURL)) {
+ BOOL hasPendingLoad =
+ tab.webState->GetNavigationManager()->GetPendingItem() != nullptr;
+ if (!hasPendingLoad && tab.lastCommittedURL == GURL(kChromeUINewTabURL)) {
[self closeTab:tab];
closedNTPTab = YES;
oldCount = 0;
« no previous file with comments | « no previous file | ios/chrome/browser/tabs/tab_model_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698