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

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

Issue 2823623002: Remove usage of Tab's |url| property from TabModel. (Closed)
Patch Set: Fix code 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 | no next file » | 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..d6b6abb0dd47217e6383256764b3a44cb84cd1b7 100644
--- a/ios/chrome/browser/tabs/tab_model.mm
+++ b/ios/chrome/browser/tabs/tab_model.mm
@@ -593,9 +593,18 @@ - (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();
+ const GURL& pendingURL =
+ pendingItem ? pendingItem->GetURL() : GURL::EmptyGURL();
+ if (UrlIsExternalFileReference(pendingURL)) {
Eugene But (OOO till 7-30) 2017/06/01 18:32:09 nit: How about |if (pendingItem && UrlIsExternalFi
kkhorimoto 2017/06/01 19:42:29 Done.
+ [referencedFiles
+ addObject:base::SysUTF8ToNSString(pendingURL.ExtractFileName())];
}
}
// Do the same for the recently closed tabs.
@@ -748,7 +757,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 | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698