| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 ResetState(); | 194 ResetState(); |
| 195 callback.Run(request_id); | 195 callback.Run(request_id); |
| 196 } | 196 } |
| 197 | 197 |
| 198 bool BackgroundLoaderOffliner::HandleTimeout(const SavePageRequest& request) { | 198 bool BackgroundLoaderOffliner::HandleTimeout(const SavePageRequest& request) { |
| 199 // TODO(romax): Decide if we want to also take a snapshot on the last timeout | 199 // TODO(romax): Decide if we want to also take a snapshot on the last timeout |
| 200 // for the background loader offliner. crbug.com/705090 | 200 // for the background loader offliner. crbug.com/705090 |
| 201 return false; | 201 return false; |
| 202 } | 202 } |
| 203 | 203 |
| 204 void BackgroundLoaderOffliner::DocumentLoadedInFrame( | 204 void BackgroundLoaderOffliner::DocumentAvailableInMainFrame() { |
| 205 content::RenderFrameHost* render_host) { | 205 snapshot_controller_->DocumentAvailableInMainFrame(); |
| 206 // Inform snapshot controller if in main frame. | |
| 207 if (!render_host->GetParent()) | |
| 208 snapshot_controller_->DocumentAvailableInMainFrame(); | |
| 209 } | 206 } |
| 210 | 207 |
| 211 void BackgroundLoaderOffliner::DidStopLoading() { | 208 void BackgroundLoaderOffliner::DocumentOnLoadCompletedInMainFrame() { |
| 212 if (!pending_request_.get()) { | 209 if (!pending_request_.get()) { |
| 213 DVLOG(1) << "DidStopLoading called even though no pending request."; | 210 DVLOG(1) << "DidStopLoading called even though no pending request."; |
| 214 return; | 211 return; |
| 215 } | 212 } |
| 216 | 213 |
| 217 snapshot_controller_->DocumentOnLoadCompletedInMainFrame(); | 214 snapshot_controller_->DocumentOnLoadCompletedInMainFrame(); |
| 218 } | 215 } |
| 219 | 216 |
| 220 void BackgroundLoaderOffliner::RenderProcessGone( | 217 void BackgroundLoaderOffliner::RenderProcessGone( |
| 221 base::TerminationStatus status) { | 218 base::TerminationStatus status) { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 int64_t offline_id) { | 416 int64_t offline_id) { |
| 420 // 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 |
| 421 // ignore the completion callback. | 418 // ignore the completion callback. |
| 422 if (pending_request_ && pending_request_->request_id() != offline_id) | 419 if (pending_request_ && pending_request_->request_id() != offline_id) |
| 423 return; | 420 return; |
| 424 completion_callback_.Run(request, RequestStatus::FOREGROUND_CANCELED); | 421 completion_callback_.Run(request, RequestStatus::FOREGROUND_CANCELED); |
| 425 } | 422 } |
| 426 } // namespace offline_pages | 423 } // namespace offline_pages |
| 427 | 424 |
| 428 DEFINE_WEB_CONTENTS_USER_DATA_KEY(offline_pages::OfflinerData); | 425 DEFINE_WEB_CONTENTS_USER_DATA_KEY(offline_pages::OfflinerData); |
| OLD | NEW |