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..ed29b9be4cfa7366a2274be747b614a3a1415b98 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) & static_cast<int>(MARKED_FOR_DELETION)) != 0; |
| +} |
| + |
| +void OfflinePageItem::MarkForDeletion() { |
| + flags = static_cast<Flags>(static_cast<int>(flags) | MARKED_FOR_DELETION); |
|
fgorski
2015/10/12 20:59:52
I am not sure what is different about this line an
jianli
2015/10/12 23:33:34
Remove unneeded static_cast at line 59.
|
| +} |
| + |
| +void OfflinePageItem::ClearMarkForDeletion() { |
| + flags = static_cast<Flags>( |
| + static_cast<int>(flags) & ~(static_cast<int>(MARKED_FOR_DELETION))); |
| +} |
| + |
| } // namespace offline_pages |