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