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

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

Issue 2489443002: Move all components/offline_pages/ files into component/offline_pages/core (Closed)
Patch Set: more rebase Created 4 years 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
(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 // Returns whether the offline page is expired.
60 bool IsExpired() const;
61
62 // The URL of the page. This is the last committed URL. In the case that
63 // redirects occur, access |original_url| for the original URL.
64 GURL url;
65 // The primary key/ID for this page in offline pages internal database.
66 int64_t offline_id;
67
68 // The Client ID (external) related to the offline page. This is opaque
69 // to our system, but useful for users of offline pages who want to map
70 // their ids to our saved pages.
71 ClientId client_id;
72
73 // The file path to the archive with a local copy of the page.
74 base::FilePath file_path;
75 // The size of the offline copy.
76 int64_t file_size;
77 // The time when the offline archive was created.
78 base::Time creation_time;
79 // The time when the offline archive was last accessed.
80 base::Time last_access_time;
81 // The time when the offline page was expired.
82 base::Time expiration_time;
83 // Number of times that the offline archive has been accessed.
84 int access_count;
85 // The title of the page at the time it was saved.
86 base::string16 title;
87 // Flags about the state and behavior of the offline page.
88 Flags flags;
89 // The original URL of the page if not empty. Otherwise, this is set to empty
90 // and |url| should be accessed instead.
91 GURL original_url;
92 };
93
94 } // namespace offline_pages
95
96 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698