Chromium Code Reviews| 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 |