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

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

Issue 2336813002: [Offline pages] OPMStoreSQL: Upgrade to M55, Upgrade refactoring, conversion refactoring (Closed)
Patch Set: Removing the version field Created 4 years, 3 months 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
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 {
12 const int kCurrentVersion = 1;
13 }
14
15 ClientId::ClientId() : name_space(""), id("") {} 11 ClientId::ClientId() : name_space(""), id("") {}
16 12
17 ClientId::ClientId(std::string name_space, std::string id) 13 ClientId::ClientId(std::string name_space, std::string id)
18 : name_space(name_space), id(id) {} 14 : name_space(name_space), id(id) {}
19 15
20 bool ClientId::operator==(const ClientId& client_id) const { 16 bool ClientId::operator==(const ClientId& client_id) const {
21 return name_space == client_id.name_space && id == client_id.id; 17 return name_space == client_id.name_space && id == client_id.id;
22 } 18 }
23 19
24 bool ClientId::operator<(const ClientId& client_id) const { 20 bool ClientId::operator<(const ClientId& client_id) const {
25 if (name_space == client_id.name_space) 21 if (name_space == client_id.name_space)
26 return (id < client_id.id); 22 return (id < client_id.id);
27 23
28 return name_space < client_id.name_space; 24 return name_space < client_id.name_space;
29 } 25 }
30 26
31 OfflinePageItem::OfflinePageItem() 27 OfflinePageItem::OfflinePageItem()
32 : version(kCurrentVersion), 28 : file_size(0),
33 file_size(0),
34 access_count(0), 29 access_count(0),
35 flags(NO_FLAG) { 30 flags(NO_FLAG) {
36 } 31 }
37 32
38 OfflinePageItem::OfflinePageItem(const GURL& url, 33 OfflinePageItem::OfflinePageItem(const GURL& url,
39 int64_t offline_id, 34 int64_t offline_id,
40 const ClientId& client_id, 35 const ClientId& client_id,
41 const base::FilePath& file_path, 36 const base::FilePath& file_path,
42 int64_t file_size) 37 int64_t file_size)
43 : url(url), 38 : url(url),
44 offline_id(offline_id), 39 offline_id(offline_id),
45 client_id(client_id), 40 client_id(client_id),
46 version(kCurrentVersion),
47 file_path(file_path), 41 file_path(file_path),
48 file_size(file_size), 42 file_size(file_size),
49 access_count(0), 43 access_count(0),
50 flags(NO_FLAG) {} 44 flags(NO_FLAG) {}
51 45
52 OfflinePageItem::OfflinePageItem(const GURL& url, 46 OfflinePageItem::OfflinePageItem(const GURL& url,
53 int64_t offline_id, 47 int64_t offline_id,
54 const ClientId& client_id, 48 const ClientId& client_id,
55 const base::FilePath& file_path, 49 const base::FilePath& file_path,
56 int64_t file_size, 50 int64_t file_size,
57 const base::Time& creation_time) 51 const base::Time& creation_time)
58 : url(url), 52 : url(url),
59 offline_id(offline_id), 53 offline_id(offline_id),
60 client_id(client_id), 54 client_id(client_id),
61 version(kCurrentVersion),
62 file_path(file_path), 55 file_path(file_path),
63 file_size(file_size), 56 file_size(file_size),
64 creation_time(creation_time), 57 creation_time(creation_time),
65 last_access_time(creation_time), 58 last_access_time(creation_time),
66 access_count(0), 59 access_count(0),
67 flags(NO_FLAG) {} 60 flags(NO_FLAG) {}
68 61
69 OfflinePageItem::OfflinePageItem(const OfflinePageItem& other) = default; 62 OfflinePageItem::OfflinePageItem(const OfflinePageItem& other) = default;
70 63
71 OfflinePageItem::~OfflinePageItem() { 64 OfflinePageItem::~OfflinePageItem() {
72 } 65 }
73 66
74 GURL OfflinePageItem::GetOfflineURL() const { 67 GURL OfflinePageItem::GetOfflineURL() const {
75 return net::FilePathToFileURL(file_path); 68 return net::FilePathToFileURL(file_path);
76 } 69 }
77 70
78 bool OfflinePageItem::IsExpired() const { 71 bool OfflinePageItem::IsExpired() const {
79 return creation_time < expiration_time; 72 return creation_time < expiration_time;
80 } 73 }
81 74
82 } // namespace offline_pages 75 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698