Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 return; | 116 return; |
| 117 | 117 |
| 118 if (save_state_ != NONE) { | 118 if (save_state_ != NONE) { |
| 119 save_state_ = DELETE_AFTER_SAVE; | 119 save_state_ = DELETE_AFTER_SAVE; |
| 120 return; | 120 return; |
| 121 } | 121 } |
| 122 | 122 |
| 123 ResetState(); | 123 ResetState(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 bool BackgroundLoaderOffliner::HandleTimeout(const SavePageRequest& request) { | |
| 127 // TODO(romax) device if we want to also take a snapshot on the last timeout | |
|
Pete Williamson
2017/02/24 22:29:03
Nit: Device -> Decide
| |
| 128 // for the background loader offliner. | |
| 129 return false; | |
| 130 } | |
| 131 | |
| 126 void BackgroundLoaderOffliner::DidStopLoading() { | 132 void BackgroundLoaderOffliner::DidStopLoading() { |
| 127 if (!pending_request_.get()) { | 133 if (!pending_request_.get()) { |
| 128 DVLOG(1) << "DidStopLoading called even though no pending request."; | 134 DVLOG(1) << "DidStopLoading called even though no pending request."; |
| 129 return; | 135 return; |
| 130 } | 136 } |
| 131 | 137 |
| 132 SavePageRequest request(*pending_request_.get()); | 138 SavePageRequest request(*pending_request_.get()); |
| 133 // If there was an error navigating to page, return loading failed. | 139 // If there was an error navigating to page, return loading failed. |
| 134 if (page_load_state_ != SUCCESS) { | 140 if (page_load_state_ != SUCCESS) { |
| 135 Offliner::RequestStatus status = | 141 Offliner::RequestStatus status = |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 application_state == | 281 application_state == |
| 276 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES) { | 282 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES) { |
| 277 DVLOG(1) << "App became active, canceling current offlining request"; | 283 DVLOG(1) << "App became active, canceling current offlining request"; |
| 278 SavePageRequest* request = pending_request_.get(); | 284 SavePageRequest* request = pending_request_.get(); |
| 279 Cancel(); | 285 Cancel(); |
| 280 completion_callback_.Run(*request, RequestStatus::FOREGROUND_CANCELED); | 286 completion_callback_.Run(*request, RequestStatus::FOREGROUND_CANCELED); |
| 281 } | 287 } |
| 282 } | 288 } |
| 283 | 289 |
| 284 } // namespace offline_pages | 290 } // namespace offline_pages |
| OLD | NEW |