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

Unified Diff: components/offline_pages/offline_page_item.cc

Issue 1367063004: Support undoing offline page deletion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add the call to removeObserver Created 5 years, 2 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_item.cc
diff --git a/components/offline_pages/offline_page_item.cc b/components/offline_pages/offline_page_item.cc
index a017f7bee26e4bbc041042065da3086b51e79f6c..7c557c0a656cc25cf02ca9479659e4380e85386c 100644
--- a/components/offline_pages/offline_page_item.cc
+++ b/components/offline_pages/offline_page_item.cc
@@ -15,7 +15,8 @@ const int kCurrentVersion = 1;
OfflinePageItem::OfflinePageItem()
: version(kCurrentVersion),
file_size(0),
- access_count(0) {
+ access_count(0),
+ flags(NO_FLAG) {
}
OfflinePageItem::OfflinePageItem(const GURL& url,
@@ -27,7 +28,8 @@ OfflinePageItem::OfflinePageItem(const GURL& url,
version(kCurrentVersion),
file_path(file_path),
file_size(file_size),
- access_count(0) {
+ access_count(0),
+ flags(NO_FLAG) {
}
OfflinePageItem::OfflinePageItem(const GURL& url,
@@ -42,7 +44,8 @@ OfflinePageItem::OfflinePageItem(const GURL& url,
file_size(file_size),
creation_time(creation_time),
last_access_time(creation_time),
- access_count(0) {
+ access_count(0),
+ flags(NO_FLAG) {
}
OfflinePageItem::~OfflinePageItem() {
@@ -52,4 +55,17 @@ GURL OfflinePageItem::GetOfflineURL() const {
return net::FilePathToFileURL(file_path);
}
+bool OfflinePageItem::IsMarkedForDeletion() const {
+ return (static_cast<int>(flags) & MARKED_FOR_DELETION) != 0;
+}
+
+void OfflinePageItem::MarkForDeletion() {
+ flags = static_cast<Flags>(static_cast<int>(flags) | MARKED_FOR_DELETION);
+}
+
+void OfflinePageItem::ClearMarkForDeletion() {
+ flags = static_cast<Flags>(
+ static_cast<int>(flags) & ~(static_cast<int>(MARKED_FOR_DELETION)));
fgorski 2015/10/13 16:48:25 what about here? Is the cast needed here or not?
jianli 2015/10/14 21:37:21 Done.
+}
+
} // namespace offline_pages

Powered by Google App Engine
This is Rietveld 408576698