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

Unified Diff: components/offline_pages/core/offline_page_model_impl.cc

Issue 2683493002: Get signals working in the EXTRA_DATA section of MHTML (Closed)
Patch Set: Approach for writing to the file afterwards instead. Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: components/offline_pages/core/offline_page_model_impl.cc
diff --git a/components/offline_pages/core/offline_page_model_impl.cc b/components/offline_pages/core/offline_page_model_impl.cc
index 2e87035d1f69577f80997550ca96de221c845d67..394115f1ca09ee63955fbf25d24bc20d37bd7554 100644
--- a/components/offline_pages/core/offline_page_model_impl.cc
+++ b/components/offline_pages/core/offline_page_model_impl.cc
@@ -340,19 +340,22 @@ void OfflinePageModelImpl::SavePage(
std::unique_ptr<OfflinePageArchiver> archiver,
const SavePageCallback& callback) {
DCHECK(is_loaded_);
+ base::FilePath empty_file_path;
// Skip saving the page that is not intended to be saved, like local file
// page.
if (!OfflinePageModel::CanSaveURL(save_page_params.url)) {
InformSavePageDone(callback, SavePageResult::SKIPPED,
- save_page_params.client_id, kInvalidOfflineId);
+ save_page_params.client_id, kInvalidOfflineId,
+ empty_file_path);
return;
}
// The web contents is not available if archiver is not created and passed.
if (!archiver.get()) {
InformSavePageDone(callback, SavePageResult::CONTENT_UNAVAILABLE,
- save_page_params.client_id, kInvalidOfflineId);
+ save_page_params.client_id, kInvalidOfflineId,
+ empty_file_path);
return;
}
@@ -693,15 +696,15 @@ void OfflinePageModelImpl::OnCreateArchiveDone(
// TODO(fgorski): We have created an archive for a wrong URL. It should be
// deleted from here, once archiver has the right functionality.
InformSavePageDone(callback, SavePageResult::ARCHIVE_CREATION_FAILED,
- save_page_params.client_id, offline_id);
+ save_page_params.client_id, offline_id, file_path);
DeletePendingArchiver(archiver);
return;
}
if (archiver_result != ArchiverResult::SUCCESSFULLY_CREATED) {
SavePageResult result = ToSavePageResult(archiver_result);
- InformSavePageDone(
- callback, result, save_page_params.client_id, offline_id);
+ InformSavePageDone(callback, result, save_page_params.client_id, offline_id,
+ file_path);
DeletePendingArchiver(archiver);
return;
}
@@ -739,7 +742,7 @@ void OfflinePageModelImpl::OnAddOfflinePageDone(
result = SavePageResult::STORE_FAILURE;
}
InformSavePageDone(callback, result, offline_page.client_id,
- offline_page.offline_id);
+ offline_page.offline_id, file_path);
if (result == SavePageResult::SUCCESS) {
DeleteExistingPagesWithSameURL(offline_page);
} else {
@@ -854,11 +857,12 @@ void OfflinePageModelImpl::FinalizeModelLoad() {
void OfflinePageModelImpl::InformSavePageDone(const SavePageCallback& callback,
SavePageResult result,
const ClientId& client_id,
- int64_t offline_id) {
+ int64_t offline_id,
+ const base::FilePath& file_path) {
ReportSavePageResultHistogramAfterSave(client_id, result);
archive_manager_->GetStorageStats(
base::Bind(&ReportStorageHistogramsAfterSave));
- callback.Run(result, offline_id);
+ callback.Run(result, offline_id, file_path);
}
void OfflinePageModelImpl::DeleteExistingPagesWithSameURL(

Powered by Google App Engine
This is Rietveld 408576698