summaryrefslogtreecommitdiff
path: root/chromium/components/offline_pages/core/offline_page_item.cc
blob: 5790e3c3401559d6a2e96f38a794b8d7a9ff6e65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/offline_pages/core/offline_page_item.h"

namespace offline_pages {

OfflinePageItem::OfflinePageItem()
    : offline_id(0),
      file_size(0),
      access_count(0),
      flags(NO_FLAG),
      system_download_id(0),
      upgrade_attempt(0) {}

OfflinePageItem::OfflinePageItem(const GURL& url,
                                 int64_t offline_id,
                                 const ClientId& client_id,
                                 const base::FilePath& file_path,
                                 int64_t file_size)
    : url(url),
      offline_id(offline_id),
      client_id(client_id),
      file_path(file_path),
      file_size(file_size),
      access_count(0),
      flags(NO_FLAG),
      system_download_id(0),
      upgrade_attempt(0) {}

OfflinePageItem::OfflinePageItem(const GURL& url,
                                 int64_t offline_id,
                                 const ClientId& client_id,
                                 const base::FilePath& file_path,
                                 int64_t file_size,
                                 const base::Time& creation_time)
    : url(url),
      offline_id(offline_id),
      client_id(client_id),
      file_path(file_path),
      file_size(file_size),
      creation_time(creation_time),
      last_access_time(creation_time),
      access_count(0),
      flags(NO_FLAG),
      system_download_id(0),
      upgrade_attempt(0) {}

OfflinePageItem::OfflinePageItem(const GURL& url,
                                 int64_t offline_id,
                                 const ClientId& client_id,
                                 const base::FilePath& file_path,
                                 int64_t file_size,
                                 const base::Time& creation_time,
                                 const std::string& request_origin)
    : url(url),
      offline_id(offline_id),
      client_id(client_id),
      file_path(file_path),
      file_size(file_size),
      creation_time(creation_time),
      last_access_time(creation_time),
      access_count(0),
      flags(NO_FLAG),
      request_origin(request_origin),
      system_download_id(0),
      upgrade_attempt(0) {}

OfflinePageItem::OfflinePageItem(const OfflinePageItem& other) = default;

OfflinePageItem::~OfflinePageItem() {}

bool OfflinePageItem::operator==(const OfflinePageItem& other) const {
  return url == other.url && offline_id == other.offline_id &&
         client_id == other.client_id && file_path == other.file_path &&
         creation_time == other.creation_time &&
         last_access_time == other.last_access_time &&
         access_count == other.access_count && title == other.title &&
         flags == other.flags && original_url == other.original_url &&
         request_origin == other.request_origin &&
         system_download_id == other.system_download_id &&
         file_missing_time == other.file_missing_time &&
         upgrade_attempt == other.upgrade_attempt && digest == other.digest;
}

bool OfflinePageItem::operator<(const OfflinePageItem& other) const {
  return offline_id < other.offline_id;
}

}  // namespace offline_pages