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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 cancel_callback_ = callback; | 189 cancel_callback_ = callback; |
| 190 return; | 190 return; |
| 191 } | 191 } |
| 192 | 192 |
| 193 int64_t request_id = pending_request_->request_id(); | 193 int64_t request_id = pending_request_->request_id(); |
| 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 |
|
fgorski
2017/04/05 16:50:24
nit: TODO(romax):
romax
2017/04/05 18:41:00
Done.
| |
| 200 // for the background loader offliner. | 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::DocumentLoadedInFrame( |
| 205 content::RenderFrameHost* render_host) { | 205 content::RenderFrameHost* render_host) { |
| 206 // Inform snapshot controller if in main frame. | 206 // Inform snapshot controller if in main frame. |
| 207 if (!render_host->GetParent()) | 207 if (!render_host->GetParent()) |
| 208 snapshot_controller_->DocumentAvailableInMainFrame(); | 208 snapshot_controller_->DocumentAvailableInMainFrame(); |
| 209 } | 209 } |
| 210 | 210 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 419 int64_t offline_id) { | 419 int64_t offline_id) { |
| 420 // If for some reason the request was reset during while waiting for callback | 420 // If for some reason the request was reset during while waiting for callback |
| 421 // ignore the completion callback. | 421 // ignore the completion callback. |
| 422 if (pending_request_ && pending_request_->request_id() != offline_id) | 422 if (pending_request_ && pending_request_->request_id() != offline_id) |
| 423 return; | 423 return; |
| 424 completion_callback_.Run(request, RequestStatus::FOREGROUND_CANCELED); | 424 completion_callback_.Run(request, RequestStatus::FOREGROUND_CANCELED); |
| 425 } | 425 } |
| 426 } // namespace offline_pages | 426 } // namespace offline_pages |
| 427 | 427 |
| 428 DEFINE_WEB_CONTENTS_USER_DATA_KEY(offline_pages::OfflinerData); | 428 DEFINE_WEB_CONTENTS_USER_DATA_KEY(offline_pages::OfflinerData); |
| OLD | NEW |