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 #include "components/offline_pages/offline_page_item.h" | |
6 | |
7 namespace offline_pages { | |
8 | |
9 ClientId::ClientId() : name_space(""), id("") {} | |
10 | |
11 ClientId::ClientId(std::string name_space, std::string id) | |
12 : name_space(name_space), id(id) {} | |
13 | |
14 bool ClientId::operator==(const ClientId& client_id) const { | |
15 return name_space == client_id.name_space && id == client_id.id; | |
16 } | |
17 | |
18 bool ClientId::operator<(const ClientId& client_id) const { | |
19 if (name_space == client_id.name_space) | |
20 return (id < client_id.id); | |
21 | |
22 return name_space < client_id.name_space; | |
23 } | |
24 | |
25 OfflinePageItem::OfflinePageItem() | |
26 : file_size(0), access_count(0), flags(NO_FLAG) {} | |
27 | |
28 OfflinePageItem::OfflinePageItem(const GURL& url, | |
29 int64_t offline_id, | |
30 const ClientId& client_id, | |
31 const base::FilePath& file_path, | |
32 int64_t file_size) | |
33 : url(url), | |
34 offline_id(offline_id), | |
35 client_id(client_id), | |
36 file_path(file_path), | |
37 file_size(file_size), | |
38 access_count(0), | |
39 flags(NO_FLAG) {} | |
40 | |
41 OfflinePageItem::OfflinePageItem(const GURL& url, | |
42 int64_t offline_id, | |
43 const ClientId& client_id, | |
44 const base::FilePath& file_path, | |
45 int64_t file_size, | |
46 const base::Time& creation_time) | |
47 : url(url), | |
48 offline_id(offline_id), | |
49 client_id(client_id), | |
50 file_path(file_path), | |
51 file_size(file_size), | |
52 creation_time(creation_time), | |
53 last_access_time(creation_time), | |
54 access_count(0), | |
55 flags(NO_FLAG) {} | |
56 | |
57 OfflinePageItem::OfflinePageItem(const OfflinePageItem& other) = default; | |
58 | |
59 OfflinePageItem::~OfflinePageItem() { | |
60 } | |
61 | |
62 bool OfflinePageItem::operator==(const OfflinePageItem& other) const { | |
63 return url == other.url && | |
64 offline_id == other.offline_id && | |
65 client_id == other.client_id && | |
66 file_path == other.file_path && | |
67 creation_time == other.creation_time && | |
68 last_access_time == other.last_access_time && | |
69 access_count == other.access_count && | |
70 title == other.title && | |
71 flags == other.flags && | |
72 original_url == other.original_url; | |
73 } | |
74 | |
75 } // namespace offline_pages | |
OLD | NEW |