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

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

Issue 1367063004: Support undoing offline page deletion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: One more change 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_ITEM_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_ITEM_H_
6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_ITEM_H_ 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_ITEM_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "url/gurl.h" 14 #include "url/gurl.h"
15 15
16 namespace offline_pages { 16 namespace offline_pages {
17 17
18 // Metadata of the offline page. 18 // Metadata of the offline page.
19 struct OfflinePageItem { 19 struct OfflinePageItem {
20 public: 20 public:
21 // Note that this should match with Flags enum in offline_pages.proto.
22 enum Flags {
23 NO_FLAG = 0,
24 MARKED_FOR_DELETION = 0x1,
25 };
26
21 OfflinePageItem(); 27 OfflinePageItem();
22 OfflinePageItem(const GURL& url, 28 OfflinePageItem(const GURL& url,
23 int64 bookmark_id, 29 int64 bookmark_id,
24 const base::FilePath& file_path, 30 const base::FilePath& file_path,
25 int64 file_size); 31 int64 file_size);
26 OfflinePageItem(const GURL& url, 32 OfflinePageItem(const GURL& url,
27 int64 bookmark_id, 33 int64 bookmark_id,
28 const base::FilePath& file_path, 34 const base::FilePath& file_path,
29 int64 file_size, 35 int64 file_size,
30 const base::Time& creation_time); 36 const base::Time& creation_time);
31 ~OfflinePageItem(); 37 ~OfflinePageItem();
32 38
33 // Gets a URL of the file under |file_path|. 39 // Gets a URL of the file under |file_path|.
34 GURL GetOfflineURL() const; 40 GURL GetOfflineURL() const;
35 41
42 // Returns true if the page has been marked for deletion. This allows an undo
43 // in a short time period. After that, the marked page will be deleted.
44 bool IsMarkedForDeletion() const;
45
46 // Sets/clears the mark for deletion.
47 void MarkForDeletion();
48 void ClearMarkForDeletion();
49
36 // The URL of the page. 50 // The URL of the page.
37 GURL url; 51 GURL url;
38 // The Bookmark ID related to the offline page. 52 // The Bookmark ID related to the offline page.
39 int64 bookmark_id; 53 int64 bookmark_id;
40 // Version of the offline page item. 54 // Version of the offline page item.
41 int version; 55 int version;
42 // The file path to the archive with a local copy of the page. 56 // The file path to the archive with a local copy of the page.
43 base::FilePath file_path; 57 base::FilePath file_path;
44 // The size of the offline copy. 58 // The size of the offline copy.
45 int64 file_size; 59 int64 file_size;
46 // The time when the offline archive was created. 60 // The time when the offline archive was created.
47 base::Time creation_time; 61 base::Time creation_time;
48 // The time when the offline archive was last accessed. 62 // The time when the offline archive was last accessed.
49 base::Time last_access_time; 63 base::Time last_access_time;
50 // Number of times that the offline archive has been accessed. 64 // Number of times that the offline archive has been accessed.
51 int access_count; 65 int access_count;
66 // Flags about the state and behavior of the offline page.
67 Flags flags;
52 }; 68 };
53 69
54 } // namespace offline_pages 70 } // namespace offline_pages
55 71
56 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_ITEM_H_ 72 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698