| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_ITEM_H_ | |
| 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_ITEM_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <string> | |
| 11 | |
| 12 #include "base/files/file_path.h" | |
| 13 #include "base/strings/string16.h" | |
| 14 #include "base/time/time.h" | |
| 15 #include "url/gurl.h" | |
| 16 | |
| 17 namespace offline_pages { | |
| 18 | |
| 19 struct ClientId { | |
| 20 // The namespace for the id (of course 'namespace' is a reserved word, so...) | |
| 21 std::string name_space; | |
| 22 // The id in the client's namespace. Opaque to us. | |
| 23 std::string id; | |
| 24 | |
| 25 ClientId(); | |
| 26 ClientId(std::string name_space, std::string id); | |
| 27 | |
| 28 bool operator==(const ClientId& client_id) const; | |
| 29 | |
| 30 bool operator<(const ClientId& client_id) const; | |
| 31 }; | |
| 32 | |
| 33 // Metadata of the offline page. | |
| 34 struct OfflinePageItem { | |
| 35 public: | |
| 36 // Note that this should match with Flags enum in offline_pages.proto. | |
| 37 enum Flags { | |
| 38 NO_FLAG = 0, | |
| 39 MARKED_FOR_DELETION = 0x1, | |
| 40 }; | |
| 41 | |
| 42 OfflinePageItem(); | |
| 43 OfflinePageItem(const GURL& url, | |
| 44 int64_t offline_id, | |
| 45 const ClientId& client_id, | |
| 46 const base::FilePath& file_path, | |
| 47 int64_t file_size); | |
| 48 OfflinePageItem(const GURL& url, | |
| 49 int64_t offline_id, | |
| 50 const ClientId& client_id, | |
| 51 const base::FilePath& file_path, | |
| 52 int64_t file_size, | |
| 53 const base::Time& creation_time); | |
| 54 OfflinePageItem(const OfflinePageItem& other); | |
| 55 ~OfflinePageItem(); | |
| 56 | |
| 57 bool operator==(const OfflinePageItem& other) const; | |
| 58 | |
| 59 // The URL of the page. This is the last committed URL. In the case that | |
| 60 // redirects occur, access |original_url| for the original URL. | |
| 61 GURL url; | |
| 62 // The primary key/ID for this page in offline pages internal database. | |
| 63 int64_t offline_id; | |
| 64 | |
| 65 // The Client ID (external) related to the offline page. This is opaque | |
| 66 // to our system, but useful for users of offline pages who want to map | |
| 67 // their ids to our saved pages. | |
| 68 ClientId client_id; | |
| 69 | |
| 70 // The file path to the archive with a local copy of the page. | |
| 71 base::FilePath file_path; | |
| 72 // The size of the offline copy. | |
| 73 int64_t file_size; | |
| 74 // The time when the offline archive was created. | |
| 75 base::Time creation_time; | |
| 76 // The time when the offline archive was last accessed. | |
| 77 base::Time last_access_time; | |
| 78 // Number of times that the offline archive has been accessed. | |
| 79 int access_count; | |
| 80 // The title of the page at the time it was saved. | |
| 81 base::string16 title; | |
| 82 // Flags about the state and behavior of the offline page. | |
| 83 Flags flags; | |
| 84 // The original URL of the page if not empty. Otherwise, this is set to empty | |
| 85 // and |url| should be accessed instead. | |
| 86 GURL original_url; | |
| 87 }; | |
| 88 | |
| 89 } // namespace offline_pages | |
| 90 | |
| 91 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_ITEM_H_ | |
| OLD | NEW |