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

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

Issue 2579343002: [Offline Pages] Make new archives have random file names. (Closed)
Patch Set: Remove unnecessary includes Created 3 years, 12 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
« no previous file with comments | « components/offline_pages/core/offline_page_model_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 011dfbe2a1670cf224c0f9d3590e227b9ee7c57f..245db22586d8fa368606460bde0dbd865607adc2 100644
--- a/components/offline_pages/core/offline_page_model_impl.cc
+++ b/components/offline_pages/core/offline_page_model_impl.cc
@@ -708,11 +708,12 @@ void OfflinePageModelImpl::OnCreateArchiveDone(
store_->AddOfflinePage(offline_page_item,
base::Bind(&OfflinePageModelImpl::OnAddOfflinePageDone,
weak_ptr_factory_.GetWeakPtr(), archiver,
- callback, offline_page_item));
+ file_path, callback, offline_page_item));
}
void OfflinePageModelImpl::OnAddOfflinePageDone(
OfflinePageArchiver* archiver,
+ const base::FilePath& file_path,
const SavePageCallback& callback,
const OfflinePageItem& offline_page,
ItemActionStatus status) {
@@ -727,6 +728,8 @@ void OfflinePageModelImpl::OnAddOfflinePageDone(
offline_page.client_id.name_space, offline_page.url.spec(),
std::to_string(offline_page.offline_id));
} else if (status == ItemActionStatus::ALREADY_EXISTS) {
+ // Remove the orphaned archive. No callback necessary.
+ archive_manager_->DeleteArchive(file_path, base::Bind([](bool) {}));
result = SavePageResult::ALREADY_EXISTS;
} else {
result = SavePageResult::STORE_FAILURE;
« no previous file with comments | « components/offline_pages/core/offline_page_model_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698