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

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

Issue 2835253002: Treat already existing saved pages as success. (Closed)
Patch Set: Created 3 years, 7 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 357
358 if (save_state_ == DELETE_AFTER_SAVE) { 358 if (save_state_ == DELETE_AFTER_SAVE) {
359 save_state_ = NONE; 359 save_state_ = NONE;
360 cancel_callback_.Run(request.request_id()); 360 cancel_callback_.Run(request.request_id());
361 return; 361 return;
362 } 362 }
363 363
364 save_state_ = NONE; 364 save_state_ = NONE;
365 365
366 Offliner::RequestStatus save_status; 366 Offliner::RequestStatus save_status;
367 if (save_result == SavePageResult::SUCCESS) { 367 if (save_result == SavePageResult::SUCCESS ||
368 save_result == SavePageResult::ALREADY_EXISTS) {
fgorski 2017/04/24 19:51:51 Hey, 3 questions: 1. Did you check if we maybe rem
Pete Williamson 2017/04/25 00:09:00 We don't remove it, because we then get the same e
368 if (did_snapshot_on_last_retry) 369 if (did_snapshot_on_last_retry)
369 save_status = RequestStatus::SAVED_ON_LAST_RETRY; 370 save_status = RequestStatus::SAVED_ON_LAST_RETRY;
370 else 371 else
371 save_status = RequestStatus::SAVED; 372 save_status = RequestStatus::SAVED;
372 } else { 373 } else {
373 save_status = RequestStatus::SAVE_FAILED; 374 save_status = RequestStatus::SAVE_FAILED;
374 } 375 }
375 376
376 completion_callback_.Run(request, save_status); 377 completion_callback_.Run(request, save_status);
377 } 378 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 int64_t offline_id) { 416 int64_t offline_id) {
416 // If for some reason the request was reset during while waiting for callback 417 // If for some reason the request was reset during while waiting for callback
417 // ignore the completion callback. 418 // ignore the completion callback.
418 if (pending_request_ && pending_request_->request_id() != offline_id) 419 if (pending_request_ && pending_request_->request_id() != offline_id)
419 return; 420 return;
420 completion_callback_.Run(request, RequestStatus::FOREGROUND_CANCELED); 421 completion_callback_.Run(request, RequestStatus::FOREGROUND_CANCELED);
421 } 422 }
422 } // namespace offline_pages 423 } // namespace offline_pages
423 424
424 DEFINE_WEB_CONTENTS_USER_DATA_KEY(offline_pages::OfflinerData); 425 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