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

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

Issue 2824543002: Remove usage of Tab's |url| property from Tab. (Closed)
Patch Set: visible => lastCommitted for |-webWillAddPendingURL:transition:| Created 3 years, 8 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.mm
diff --git a/ios/chrome/browser/tabs/tab.mm b/ios/chrome/browser/tabs/tab.mm
index 7f18cebaf9fa2814eec777f04b0a49647065d55a..ab0b32acd70506771421f602b3a4f202beba78a0 100644
--- a/ios/chrome/browser/tabs/tab.mm
+++ b/ios/chrome/browser/tabs/tab.mm
@@ -590,7 +590,7 @@ - (void)setParentTabModel:(TabModel*)model {
- (NSString*)description {
return [NSString stringWithFormat:@"%p ... %@ - %s", self, self.title,
- self.url.spec().c_str()];
+ self.visibleURL.spec().c_str()];
}
- (CRWWebController*)webController {
@@ -665,8 +665,8 @@ - (NSString*)originalTitle {
- (NSString*)urlDisplayString {
base::string16 urlText = url_formatter::FormatUrl(
- self.url, url_formatter::kFormatUrlOmitNothing, net::UnescapeRule::SPACES,
- nullptr, nullptr, nullptr);
+ self.visibleURL, url_formatter::kFormatUrlOmitNothing,
+ net::UnescapeRule::SPACES, nullptr, nullptr, nullptr);
return base::SysUTF16ToNSString(urlText);
}
@@ -694,7 +694,7 @@ - (NSString*)tabId {
}
- (void)fetchFavicon {
- const GURL& url = self.url;
+ const GURL& url = self.visibleURL;
if (!url.is_valid())
return;
@@ -893,7 +893,8 @@ - (void)saveTitleToHistoryDB {
ios::HistoryServiceFactory::GetForBrowserState(
browserState_, ServiceAccessType::IMPLICIT_ACCESS);
DCHECK(historyService);
- historyService->SetPageTitle(self.url, base::SysNSStringToUTF16(title));
+ historyService->SetPageTitle(self.lastCommittedURL,
+ base::SysNSStringToUTF16(title));
}
- (void)addCurrentEntryToHistoryDB {
@@ -1178,7 +1179,7 @@ - (BOOL)openExternalURL:(const GURL&)url
// Compose u2f-x-callback URL and update urlToOpen.
finalURL = [U2FController_ XCallbackFromRequestURL:finalURL
originURL:origin
- tabURL:self.url
+ tabURL:self.lastCommittedURL
tabID:self.tabId];
if (!finalURL.is_valid()) {
@@ -1286,19 +1287,21 @@ - (void)handleExportableFile:(net::HttpResponseHeaders*)headers {
headers->GetNormalizedHeader("content-disposition", &contentDisposition);
std::string defaultFilename =
l10n_util::GetStringUTF8(IDS_IOS_OPEN_IN_FILE_DEFAULT_TITLE);
+ const GURL& committedURL = self.lastCommittedURL;
base::string16 filename =
- net::GetSuggestedFilename(self.url, contentDisposition,
+ net::GetSuggestedFilename(committedURL, contentDisposition,
"", // referrer-charset
"", // suggested-name
"application/pdf", // mime-type
defaultFilename);
[[self openInController]
- enableWithDocumentURL:self.url
+ enableWithDocumentURL:committedURL
suggestedFilename:base::SysUTF16ToNSString(filename)];
}
- (void)countMainFrameLoad {
- if ([self isPrerenderTab] || [self url].SchemeIs(kChromeUIScheme)) {
+ if ([self isPrerenderTab] ||
+ self.lastCommittedURL.SchemeIs(kChromeUIScheme)) {
return;
}
base::RecordAction(UserMetricsAction("MobilePageLoaded"));
@@ -1359,7 +1362,7 @@ - (void)loadReaderModeHTML:(NSString*)html forURL:(const GURL&)url {
// not changed since reader mode was requested. This could happen for example
// if the page does a late redirect itself or if the user tapped on a link and
// triggered reader mode before the page load is detected by webState.
- if (url == self.url)
+ if (url == self.visibleURL)
Eugene But (OOO till 7-30) 2017/04/14 21:53:47 This checks that URL did not change, so lastCommit
kkhorimoto 2017/05/31 22:45:46 Done.
[self.webController loadHTMLForCurrentURL:html];
[self.readerModeController exitReaderMode];
@@ -1471,7 +1474,8 @@ - (void)webWillAddPendingURL:(const GURL&)url
// into a NavigationManager observer callback, so it doesn't need to be
// checked in several places.
if (isUserNavigationEvent && !isPrerenderTab_ &&
- ![self navigationManager]->GetPendingItem() && url != self.url) {
+ ![self navigationManager]->GetPendingItem() &&
+ url != self.lastCommitted) {
kkhorimoto 2017/04/14 21:05:16 If this condition passes the !GetPendingItem() che
Eugene But (OOO till 7-30) 2017/04/14 21:53:47 I don't understand this code. Rohit, by any chance
kkhorimoto 2017/05/31 22:45:46 I don't understand super well either, but since th
base::RecordAction(UserMetricsAction("MobileTabClobbered"));
if ([parentTabModel_ tabUsageRecorder])
[parentTabModel_ tabUsageRecorder]->RecordPageLoadStart(self);
« 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