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

Unified Diff: chrome/browser/android/offline_pages/offline_page_tab_helper.cc

Issue 2347723002: Fix the disappearance of "Offline" chip from the LocationBar when navigating to a fragment. (Closed)
Patch Set: Created 4 years, 3 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 | « chrome/browser/android/offline_pages/offline_page_tab_helper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/offline_pages/offline_page_tab_helper.cc
diff --git a/chrome/browser/android/offline_pages/offline_page_tab_helper.cc b/chrome/browser/android/offline_pages/offline_page_tab_helper.cc
index 79cb4183475e93bb07135bb1cc56dc2d9b364a88..0cbafdaf4bdfcfee0b873b243d92723cf1e8a1c4 100644
--- a/chrome/browser/android/offline_pages/offline_page_tab_helper.cc
+++ b/chrome/browser/android/offline_pages/offline_page_tab_helper.cc
@@ -41,10 +41,10 @@ void OfflinePageTabHelper::DidStartNavigation(
// operations.
weak_ptr_factory_.InvalidateWeakPtrs();
+ new_offline_page_ = nullptr;
dewittj 2016/09/15 23:17:40 s/new/provisional?
Dmitry Titov 2016/09/16 02:01:25 Done.
+
// Since this is a new navigation, we will reset the cached offline page,
- offline_page_ = nullptr;
is_offline_preview_ = false;
-
reloading_url_on_net_error_ = false;
}
@@ -54,6 +54,15 @@ void OfflinePageTabHelper::DidFinishNavigation(
if (!navigation_handle->IsInMainFrame())
return;
+ if (!navigation_handle->HasCommitted())
+ return;
+
+ if (navigation_handle->IsSamePage()) {
+ return;
+ }
+
+ offline_page_ = std::move(new_offline_page_);
dewittj 2016/09/15 23:17:39 new_offline_page_ could be in indeterminate state?
Dmitry Titov 2016/09/16 02:01:25 Done. Explicitly assigned nullptr. Not sure this i
+
// We might be reloading the URL in order to fetch the offline page.
// * If successful, nothing to do.
// * Otherwise, we're hitting error again. Bail out to avoid loop.
@@ -121,9 +130,11 @@ void OfflinePageTabHelper::SelectPageForOnlineURLDone(
web_contents()->GetController().LoadURLWithParams(load_params);
}
+// This is a callback from network request interceptor. It happens between
+// DidStartNavigation and DidFinishNavigation calls on this tab helper.
void OfflinePageTabHelper::SetOfflinePage(const OfflinePageItem& offline_page,
bool is_offline_preview) {
- offline_page_ = base::MakeUnique<OfflinePageItem>(offline_page);
+ new_offline_page_ = base::MakeUnique<OfflinePageItem>(offline_page);
is_offline_preview_ = is_offline_preview;
}
« no previous file with comments | « chrome/browser/android/offline_pages/offline_page_tab_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698