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

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

Issue 1841903002: Redirect to offline copy on other possible internet connection failures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« 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: 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 d2fcd26a1f28f2cc0a2c5d46c2ab1d82b06948b2..80a84d40a36822f4f0e6267f462465c6fa2df858 100644
--- a/chrome/browser/android/offline_pages/offline_page_tab_helper.cc
+++ b/chrome/browser/android/offline_pages/offline_page_tab_helper.cc
@@ -76,16 +76,18 @@ void OfflinePageTabHelper::DidFinishNavigation(
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 (navigation_handle->GetNetErrorCode() != net::ERR_INTERNET_DISCONNECTED ||
- !navigation_handle->IsInMainFrame()) {
+ // Skips non-main frame.
+ if (!navigation_handle->IsInMainFrame())
return;
- }
- // Redirecting to offline version will only take effect when there is no
- // network connection.
- if (!net::NetworkChangeNotifier::IsOffline())
+ // Skips load failure other than no network.
+ net::Error error_code = navigation_handle->GetNetErrorCode();
+ if (error_code != net::ERR_INTERNET_DISCONNECTED &&
+ error_code != net::ERR_NAME_NOT_RESOLVED &&
+ error_code != net::ERR_ADDRESS_UNREACHABLE &&
+ error_code != net::ERR_PROXY_CONNECTION_FAILED) {
return;
+ }
// On a forward or back transition, don't affect the order of the nav stack.
if (navigation_handle->GetPageTransition() ==
« 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