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

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

Issue 2823623002: Remove usage of Tab's |url| property from TabModel. (Closed)
Patch Set: check pending URLs 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..6256932e24718f4af85a42743779b796c75330b9 100644
--- a/ios/chrome/browser/tabs/tab_model.mm
+++ b/ios/chrome/browser/tabs/tab_model.mm
@@ -593,8 +593,14 @@ - (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());
+ const GURL& lastCommittedURL = tab.lastCommittedURL;
+ web::NavigationItem* pendingItem =
+ tab.webState->GetNavigationManager()->GetPendingItem();
+ const GURL& pendingURL =
+ pendingItem ? pendingItem->GetURL() : GURL::EmptyGURL();
+ if (UrlIsExternalFileReference(lastCommittedURL) ||
+ UrlIsExternalFileReference(pendingURL)) {
+ NSString* fileName = base::SysUTF8ToNSString(URL.ExtractFileName());
Eugene But (OOO till 7-30) 2017/05/31 22:43:11 Does it compile? I can't fine |URL| variable.
kkhorimoto 2017/06/01 17:55:33 Whoop, I think I accidentally reverted or somethin
[referencedFiles addObject:fileName];
}
}
@@ -748,7 +754,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