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

Side by Side Diff: chrome/browser/android/offline_pages/background_loader_offliner.cc

Issue 2808313002: [Offline pages] Make all net error codes retriable. (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/android/offline_pages/background_loader_offliner.h" 5 #include "chrome/browser/android/offline_pages/background_loader_offliner.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/sys_info.h" 8 #include "base/sys_info.h"
9 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h" 9 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h"
10 #include "chrome/browser/android/offline_pages/offliner_helper.h" 10 #include "chrome/browser/android/offline_pages/offliner_helper.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 void BackgroundLoaderOffliner::DidFinishNavigation( 248 void BackgroundLoaderOffliner::DidFinishNavigation(
249 content::NavigationHandle* navigation_handle) { 249 content::NavigationHandle* navigation_handle) {
250 if (!navigation_handle->IsInMainFrame()) 250 if (!navigation_handle->IsInMainFrame())
251 return; 251 return;
252 // If there was an error of any kind (certificate, client, DNS, etc), 252 // If there was an error of any kind (certificate, client, DNS, etc),
253 // Mark as error page. Resetting here causes RecordNavigationMetrics to crash. 253 // Mark as error page. Resetting here causes RecordNavigationMetrics to crash.
254 if (navigation_handle->IsErrorPage()) { 254 if (navigation_handle->IsErrorPage()) {
255 RecordErrorCauseUMA(pending_request_->client_id(), 255 RecordErrorCauseUMA(pending_request_->client_id(),
256 navigation_handle->GetNetErrorCode()); 256 navigation_handle->GetNetErrorCode());
257 switch (navigation_handle->GetNetErrorCode()) { 257 switch (navigation_handle->GetNetErrorCode()) {
258 case net::ERR_ACCESS_DENIED:
259 case net::ERR_ADDRESS_INVALID:
260 case net::ERR_ADDRESS_UNREACHABLE:
261 case net::ERR_CERT_COMMON_NAME_INVALID:
262 case net::ERR_CERT_AUTHORITY_INVALID:
263 case net::ERR_CERT_CONTAINS_ERRORS:
264 case net::ERR_CERT_INVALID:
265 case net::ERR_CONNECTION_FAILED:
266 case net::ERR_DISALLOWED_URL_SCHEME:
267 case net::ERR_DNS_SERVER_FAILED:
268 case net::ERR_FILE_NOT_FOUND:
269 case net::ERR_FILE_PATH_TOO_LONG:
270 case net::ERR_FILE_TOO_BIG:
271 case net::ERR_FILE_VIRUS_INFECTED:
272 case net::ERR_INVALID_HANDLE:
273 case net::ERR_INVALID_RESPONSE:
274 case net::ERR_INVALID_URL:
275 case net::ERR_MSG_TOO_BIG:
276 case net::ERR_NAME_NOT_RESOLVED:
277 case net::ERR_NAME_RESOLUTION_FAILED:
278 case net::ERR_SSL_PROTOCOL_ERROR:
279 case net::ERR_SSL_CLIENT_AUTH_SIGNATURE_FAILED:
280 case net::ERR_SSL_SERVER_CERT_BAD_FORMAT:
281 case net::ERR_UNKNOWN_URL_SCHEME:
282 page_load_state_ = NONRETRIABLE;
283 break;
284 case net::ERR_INTERNET_DISCONNECTED: 258 case net::ERR_INTERNET_DISCONNECTED:
285 page_load_state_ = DELAY_RETRY; 259 page_load_state_ = DELAY_RETRY;
286 break; 260 break;
287 default: 261 default:
288 page_load_state_ = RETRIABLE; 262 page_load_state_ = RETRIABLE;
289 } 263 }
290 } 264 }
291 } 265 }
292 266
293 void BackgroundLoaderOffliner::SetPageDelayForTest(long delay_ms) { 267 void BackgroundLoaderOffliner::SetPageDelayForTest(long delay_ms) {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 int64_t offline_id) { 393 int64_t offline_id) {
420 // If for some reason the request was reset during while waiting for callback 394 // If for some reason the request was reset during while waiting for callback
421 // ignore the completion callback. 395 // ignore the completion callback.
422 if (pending_request_ && pending_request_->request_id() != offline_id) 396 if (pending_request_ && pending_request_->request_id() != offline_id)
423 return; 397 return;
424 completion_callback_.Run(request, RequestStatus::FOREGROUND_CANCELED); 398 completion_callback_.Run(request, RequestStatus::FOREGROUND_CANCELED);
425 } 399 }
426 } // namespace offline_pages 400 } // namespace offline_pages
427 401
428 DEFINE_WEB_CONTENTS_USER_DATA_KEY(offline_pages::OfflinerData); 402 DEFINE_WEB_CONTENTS_USER_DATA_KEY(offline_pages::OfflinerData);
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698