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