| 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 #include "components/offline_pages/offline_page_item.h" | 5 #include "components/offline_pages/offline_page_item.h" |
| 6 | 6 |
| 7 #include "net/base/filename_util.h" | 7 #include "net/base/filename_util.h" |
| 8 | 8 |
| 9 namespace offline_pages { | 9 namespace offline_pages { |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 const int kCurrentVersion = 1; | 12 const int kCurrentVersion = 1; |
| 13 } | 13 } |
| 14 | 14 |
| 15 ClientId::ClientId() : name_space(""), id("") {} | 15 ClientId::ClientId() : name_space(""), id("") {} |
| 16 | 16 |
| 17 ClientId::ClientId(std::string name_space, std::string id) | 17 ClientId::ClientId(std::string name_space, std::string id) |
| 18 : name_space(name_space), id(id) {} | 18 : name_space(name_space), id(id) {} |
| 19 | 19 |
| 20 bool ClientId::operator==(const ClientId& client_id) const { | 20 bool ClientId::operator==(const ClientId& client_id) const { |
| 21 return name_space == client_id.name_space && id == client_id.id; | 21 return name_space == client_id.name_space && id == client_id.id; |
| 22 } | 22 } |
| 23 | 23 |
| 24 bool ClientId::operator<(const ClientId& client_id) const { |
| 25 if (name_space == client_id.name_space) |
| 26 return (id < client_id.id); |
| 27 |
| 28 return name_space < client_id.name_space; |
| 29 } |
| 30 |
| 24 OfflinePageItem::OfflinePageItem() | 31 OfflinePageItem::OfflinePageItem() |
| 25 : version(kCurrentVersion), | 32 : version(kCurrentVersion), |
| 26 file_size(0), | 33 file_size(0), |
| 27 access_count(0), | 34 access_count(0), |
| 28 flags(NO_FLAG) { | 35 flags(NO_FLAG) { |
| 29 } | 36 } |
| 30 | 37 |
| 31 OfflinePageItem::OfflinePageItem(const GURL& url, | 38 OfflinePageItem::OfflinePageItem(const GURL& url, |
| 32 int64_t offline_id, | 39 int64_t offline_id, |
| 33 const ClientId& client_id, | 40 const ClientId& client_id, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 73 |
| 67 GURL OfflinePageItem::GetOfflineURL() const { | 74 GURL OfflinePageItem::GetOfflineURL() const { |
| 68 return net::FilePathToFileURL(file_path); | 75 return net::FilePathToFileURL(file_path); |
| 69 } | 76 } |
| 70 | 77 |
| 71 bool OfflinePageItem::IsExpired() const { | 78 bool OfflinePageItem::IsExpired() const { |
| 72 return creation_time < expiration_time; | 79 return creation_time < expiration_time; |
| 73 } | 80 } |
| 74 | 81 |
| 75 } // namespace offline_pages | 82 } // namespace offline_pages |
| OLD | NEW |