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

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

Issue 1754333002: Switch to use Navigation events instead of provisional load events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Get DidFinishNavigation test working Created 4 years, 9 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
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 c0e6e3b61bf23996c5b7b7dde1d7299434591780..713d2411699481469b0b79cd4624d8c6efaf461b 100644
--- a/chrome/browser/android/offline_pages/offline_page_tab_helper.cc
+++ b/chrome/browser/android/offline_pages/offline_page_tab_helper.cc
@@ -61,18 +61,14 @@ void OfflinePageTabHelper::DidStartNavigation(
online_url));
}
-void OfflinePageTabHelper::DidFailProvisionalLoad(
- content::RenderFrameHost* render_frame_host,
- const GURL& validated_url,
- int error_code,
- const base::string16& error_description,
- bool was_ignored_by_handler) {
+void OfflinePageTabHelper::DidFinishNavigation(
+ content::NavigationHandle* navigation_handle) {
GURL last_redirect_from_url_copy = last_redirect_from_url_;
last_redirect_from_url_ = GURL();
// Skips non-main frame or load failure other than no network.
- if (error_code != net::ERR_INTERNET_DISCONNECTED ||
- render_frame_host->GetParent() != nullptr) {
+ if (navigation_handle->GetNetErrorCode() != net::ERR_INTERNET_DISCONNECTED ||
+ !navigation_handle->IsInMainFrame()) {
return;
}
@@ -83,14 +79,14 @@ void OfflinePageTabHelper::DidFailProvisionalLoad(
// Skips if not loading an online version of saved page.
GURL offline_url = offline_pages::OfflinePageUtils::GetOfflineURLForOnlineURL(
- web_contents()->GetBrowserContext(), validated_url);
+ web_contents()->GetBrowserContext(), navigation_handle->GetURL());
if (!offline_url.is_valid())
return;
// Avoids looping between online and offline redirections.
if (last_redirect_from_url_copy == offline_url)
return;
- last_redirect_from_url_ = validated_url;
+ last_redirect_from_url_ = navigation_handle->GetURL();
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,

Powered by Google App Engine
This is Rietveld 408576698