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

Unified Diff: components/offline_pages/offline_page_model_impl.cc

Issue 2331423004: Offline Pages - Removes the "ClearAllPages" API. (Closed)
Patch Set: Rebase Created 4 years, 3 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/offline_page_model_impl.cc
diff --git a/components/offline_pages/offline_page_model_impl.cc b/components/offline_pages/offline_page_model_impl.cc
index 9b142c55a4846fa368b13fcc5c07be4f572c5407..72002de707fdb688214883476a158deeae30aa28 100644
--- a/components/offline_pages/offline_page_model_impl.cc
+++ b/components/offline_pages/offline_page_model_impl.cc
@@ -41,17 +41,6 @@ namespace {
const base::TimeDelta kStorageManagerStartingDelay =
base::TimeDelta::FromSeconds(20);
-// This enum is used in an UMA histogram. Hence the entries here shouldn't
-// be deleted or re-ordered and new ones should be added to the end.
-enum ClearAllStatus {
- CLEAR_ALL_SUCCEEDED,
- STORE_RESET_FAILED,
- STORE_RELOAD_FAILED,
-
- // NOTE: always keep this entry at the end.
- CLEAR_ALL_STATUS_COUNT
-};
-
int64_t GenerateOfflineId() {
return base::RandGenerator(std::numeric_limits<int64_t>::max()) + 1;
}
@@ -439,18 +428,6 @@ void OfflinePageModelImpl::DoDeletePagesByOfflineId(
weak_ptr_factory_.GetWeakPtr(), offline_ids, callback));
}
-void OfflinePageModelImpl::ClearAll(const base::Closure& callback) {
- DCHECK(is_loaded_);
-
- std::vector<int64_t> offline_ids;
- for (const auto& id_page_pair : offline_pages_)
- offline_ids.push_back(id_page_pair.first);
- DeletePagesByOfflineId(
- offline_ids,
- base::Bind(&OfflinePageModelImpl::OnRemoveAllFilesDoneForClearAll,
- weak_ptr_factory_.GetWeakPtr(), callback));
-}
-
void OfflinePageModelImpl::DeleteCachedPagesByURLPredicate(
const UrlPredicate& predicate,
const DeletePageCallback& callback) {
@@ -1055,51 +1032,6 @@ void OfflinePageModelImpl::OnDeleteOrphanedArchivesDone(
success);
}
-void OfflinePageModelImpl::OnRemoveAllFilesDoneForClearAll(
- const base::Closure& callback,
- DeletePageResult result) {
- store_->Reset(base::Bind(&OfflinePageModelImpl::OnResetStoreDoneForClearAll,
- weak_ptr_factory_.GetWeakPtr(), callback));
-}
-
-void OfflinePageModelImpl::OnResetStoreDoneForClearAll(
- const base::Closure& callback,
- bool success) {
- DCHECK(success);
- if (!success) {
- offline_event_logger_.RecordStoreClearError();
- UMA_HISTOGRAM_ENUMERATION("OfflinePages.ClearAllStatus2",
- STORE_RESET_FAILED, CLEAR_ALL_STATUS_COUNT);
- }
-
- offline_pages_.clear();
- store_->GetOfflinePages(
- base::Bind(&OfflinePageModelImpl::OnReloadStoreDoneForClearAll,
- weak_ptr_factory_.GetWeakPtr(), callback));
-}
-
-void OfflinePageModelImpl::OnReloadStoreDoneForClearAll(
- const base::Closure& callback,
- OfflinePageMetadataStore::LoadStatus load_status,
- const std::vector<OfflinePageItem>& offline_pages) {
- DCHECK_EQ(OfflinePageMetadataStore::LOAD_SUCCEEDED, load_status);
- UMA_HISTOGRAM_ENUMERATION(
- "OfflinePages.ClearAllStatus2",
- load_status == OfflinePageMetadataStore::LOAD_SUCCEEDED
- ? CLEAR_ALL_SUCCEEDED
- : STORE_RELOAD_FAILED,
- CLEAR_ALL_STATUS_COUNT);
-
- if (load_status == OfflinePageMetadataStore::LOAD_SUCCEEDED) {
- offline_event_logger_.RecordStoreCleared();
- } else {
- offline_event_logger_.RecordStoreReloadError();
- }
-
- CacheLoadedData(offline_pages);
- callback.Run();
-}
-
void OfflinePageModelImpl::CacheLoadedData(
const std::vector<OfflinePageItem>& offline_pages) {
offline_pages_.clear();
« no previous file with comments | « components/offline_pages/offline_page_model_impl.h ('k') | components/offline_pages/offline_page_model_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698