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

Side by Side Diff: components/offline_pages/offline_page_model_impl.h

Issue 2275833002: [Offline Pages] Don't remove user-requested pages when deleting cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments. 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 unified diff | Download patch
OLDNEW
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 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_
6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 void RemoveObserver(Observer* observer) override; 68 void RemoveObserver(Observer* observer) override;
69 void SavePage(const GURL& url, 69 void SavePage(const GURL& url,
70 const ClientId& client_id, 70 const ClientId& client_id,
71 int64_t proposed_offline_id, 71 int64_t proposed_offline_id,
72 std::unique_ptr<OfflinePageArchiver> archiver, 72 std::unique_ptr<OfflinePageArchiver> archiver,
73 const SavePageCallback& callback) override; 73 const SavePageCallback& callback) override;
74 void MarkPageAccessed(int64_t offline_id) override; 74 void MarkPageAccessed(int64_t offline_id) override;
75 void ClearAll(const base::Closure& callback) override; 75 void ClearAll(const base::Closure& callback) override;
76 void DeletePagesByOfflineId(const std::vector<int64_t>& offline_ids, 76 void DeletePagesByOfflineId(const std::vector<int64_t>& offline_ids,
77 const DeletePageCallback& callback) override; 77 const DeletePageCallback& callback) override;
78 void DeletePagesByURLPredicate(const UrlPredicate& predicate, 78 void DeleteCachedPagesByURLPredicate(
79 const DeletePageCallback& callback) override; 79 const UrlPredicate& predicate,
80 const DeletePageCallback& callback) override;
80 void HasPages(const std::string& name_space, 81 void HasPages(const std::string& name_space,
81 const HasPagesCallback& callback) override; 82 const HasPagesCallback& callback) override;
82 void CheckPagesExistOffline( 83 void CheckPagesExistOffline(
83 const std::set<GURL>& urls, 84 const std::set<GURL>& urls,
84 const CheckPagesExistOfflineCallback& callback) override; 85 const CheckPagesExistOfflineCallback& callback) override;
85 void GetAllPages(const MultipleOfflinePageItemCallback& callback) override; 86 void GetAllPages(const MultipleOfflinePageItemCallback& callback) override;
86 void GetAllPagesWithExpired( 87 void GetAllPagesWithExpired(
87 const MultipleOfflinePageItemCallback& callback) override; 88 const MultipleOfflinePageItemCallback& callback) override;
88 void GetOfflineIdsForClientId( 89 void GetOfflineIdsForClientId(
89 const ClientId& client_id, 90 const ClientId& client_id,
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 const std::vector<OfflinePageItem>& offline_pages); 236 const std::vector<OfflinePageItem>& offline_pages);
236 237
237 void CacheLoadedData(const std::vector<OfflinePageItem>& offline_pages); 238 void CacheLoadedData(const std::vector<OfflinePageItem>& offline_pages);
238 239
239 // Actually does the work of deleting, requires the model is loaded. 240 // Actually does the work of deleting, requires the model is loaded.
240 void DoDeletePagesByOfflineId(const std::vector<int64_t>& offline_ids, 241 void DoDeletePagesByOfflineId(const std::vector<int64_t>& offline_ids,
241 const DeletePageCallback& callback); 242 const DeletePageCallback& callback);
242 243
243 // Similar to DoDeletePagesByOfflineId, does actual work of deleting, and 244 // Similar to DoDeletePagesByOfflineId, does actual work of deleting, and
244 // requires that the model is loaded. 245 // requires that the model is loaded.
245 void DoDeletePagesByURLPredicate(const UrlPredicate& predicate, 246 void DoDeleteCachedPagesByURLPredicate(const UrlPredicate& predicate,
246 const DeletePageCallback& callback); 247 const DeletePageCallback& callback);
247 248
248 // Callback completing page expiration. 249 // Callback completing page expiration.
249 void OnExpirePageDone(int64_t offline_id, 250 void OnExpirePageDone(int64_t offline_id,
250 const base::Time& expiration_time, 251 const base::Time& expiration_time,
251 bool success); 252 bool success);
252 253
253 // Clears expired pages if there are any. 254 // Clears expired pages if there are any.
254 void ClearStorageIfNeeded( 255 void ClearStorageIfNeeded(
255 const OfflinePageStorageManager::ClearStorageCallback& callback); 256 const OfflinePageStorageManager::ClearStorageCallback& callback);
256 257
257 // Callback completing storage clearing. 258 // Callback completing storage clearing.
258 void OnStorageCleared(size_t expired_page_count, 259 void OnStorageCleared(size_t expired_page_count,
259 OfflinePageStorageManager::ClearStorageResult result); 260 OfflinePageStorageManager::ClearStorageResult result);
260 261
261 // Post task to clear storage. 262 // Post task to clear storage.
262 void PostClearStorageIfNeededTask(); 263 void PostClearStorageIfNeededTask();
263 264
265 // Check if |offline_page| is user-requested.
266 bool IsUserRequestedPage(const OfflinePageItem& offline_page) const;
267
264 void RunWhenLoaded(const base::Closure& job); 268 void RunWhenLoaded(const base::Closure& job);
265 269
266 // Persistent store for offline page metadata. 270 // Persistent store for offline page metadata.
267 std::unique_ptr<OfflinePageMetadataStore> store_; 271 std::unique_ptr<OfflinePageMetadataStore> store_;
268 272
269 // Location where all of the archive files will be stored. 273 // Location where all of the archive files will be stored.
270 base::FilePath archives_dir_; 274 base::FilePath archives_dir_;
271 275
272 // The observers. 276 // The observers.
273 base::ObserverList<Observer> observers_; 277 base::ObserverList<Observer> observers_;
(...skipping 23 matching lines...) Expand all
297 OfflinePageModelEventLogger offline_event_logger_; 301 OfflinePageModelEventLogger offline_event_logger_;
298 302
299 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; 303 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_;
300 304
301 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); 305 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl);
302 }; 306 };
303 307
304 } // namespace offline_pages 308 } // namespace offline_pages
305 309
306 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ 310 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_
OLDNEW
« no previous file with comments | « components/offline_pages/offline_page_model.h ('k') | components/offline_pages/offline_page_model_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698