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 package org.chromium.chrome.browser.offlinepages; | 5 package org.chromium.chrome.browser.offlinepages; |
6 | 6 |
7 import org.chromium.base.VisibleForTesting; | 7 import org.chromium.base.VisibleForTesting; |
8 | 8 |
9 /** | 9 /** |
10 * Simple object representing an offline page. | 10 * Simple object representing an offline page. |
11 */ | 11 */ |
12 public class OfflinePageItem { | 12 public class OfflinePageItem { |
13 private final String mUrl; | 13 private final String mUrl; |
14 private final long mOfflineId; | 14 private final long mOfflineId; |
15 private final ClientId mClientId; | 15 private final ClientId mClientId; |
16 private final String mOfflineUrl; | |
17 private final String mFilePath; | 16 private final String mFilePath; |
18 private final long mFileSize; | 17 private final long mFileSize; |
19 private final long mCreationTimeMs; | 18 private final long mCreationTimeMs; |
20 private final int mAccessCount; | 19 private final int mAccessCount; |
21 private final long mLastAccessTimeMs; | 20 private final long mLastAccessTimeMs; |
22 | 21 |
23 public OfflinePageItem(String url, long offlineId, String clientNamespace, S
tring clientId, | 22 public OfflinePageItem(String url, long offlineId, String clientNamespace, S
tring clientId, |
24 String offlineUrl, String filePath, long fileSize, long creationTime
Ms, int accessCount, | 23 String filePath, long fileSize, long creationTimeMs, int accessCount
, |
25 long lastAccessTimeMs) { | 24 long lastAccessTimeMs) { |
26 mUrl = url; | 25 mUrl = url; |
27 mOfflineId = offlineId; | 26 mOfflineId = offlineId; |
28 mClientId = new ClientId(clientNamespace, clientId); | 27 mClientId = new ClientId(clientNamespace, clientId); |
29 mOfflineUrl = offlineUrl; | |
30 mFilePath = filePath; | 28 mFilePath = filePath; |
31 mFileSize = fileSize; | 29 mFileSize = fileSize; |
32 mCreationTimeMs = creationTimeMs; | 30 mCreationTimeMs = creationTimeMs; |
33 mAccessCount = accessCount; | 31 mAccessCount = accessCount; |
34 mLastAccessTimeMs = lastAccessTimeMs; | 32 mLastAccessTimeMs = lastAccessTimeMs; |
35 } | 33 } |
36 | 34 |
37 /** @return URL of the offline page. */ | 35 /** @return URL of the offline page. */ |
38 @VisibleForTesting | 36 @VisibleForTesting |
39 public String getUrl() { | 37 public String getUrl() { |
40 return mUrl; | 38 return mUrl; |
41 } | 39 } |
42 | 40 |
43 /** @return offline id for this offline page. */ | 41 /** @return offline id for this offline page. */ |
44 @VisibleForTesting | 42 @VisibleForTesting |
45 public long getOfflineId() { | 43 public long getOfflineId() { |
46 return mOfflineId; | 44 return mOfflineId; |
47 } | 45 } |
48 | 46 |
49 /** @return Client Id related to the offline page. */ | 47 /** @return Client Id related to the offline page. */ |
50 @VisibleForTesting | 48 @VisibleForTesting |
51 public ClientId getClientId() { | 49 public ClientId getClientId() { |
52 return mClientId; | 50 return mClientId; |
53 } | 51 } |
54 | 52 |
55 /** @return Path to the offline copy of the page. */ | |
56 @VisibleForTesting | |
57 public String getOfflineUrl() { | |
58 return mOfflineUrl; | |
59 } | |
60 | |
61 /** @return File Path to the offline copy of the page. */ | 53 /** @return File Path to the offline copy of the page. */ |
62 @VisibleForTesting | 54 @VisibleForTesting |
63 public String getFilePath() { | 55 public String getFilePath() { |
64 return mFilePath; | 56 return mFilePath; |
65 } | 57 } |
66 | 58 |
67 /** @return Size of the offline copy of the page. */ | 59 /** @return Size of the offline copy of the page. */ |
68 @VisibleForTesting | 60 @VisibleForTesting |
69 public long getFileSize() { | 61 public long getFileSize() { |
70 return mFileSize; | 62 return mFileSize; |
(...skipping 10 matching lines...) Expand all Loading... |
81 public int getAccessCount() { | 73 public int getAccessCount() { |
82 return mAccessCount; | 74 return mAccessCount; |
83 } | 75 } |
84 | 76 |
85 /** @return Last time in milliseconds the offline page has been accessed. */ | 77 /** @return Last time in milliseconds the offline page has been accessed. */ |
86 @VisibleForTesting | 78 @VisibleForTesting |
87 public long getLastAccessTimeMs() { | 79 public long getLastAccessTimeMs() { |
88 return mLastAccessTimeMs; | 80 return mLastAccessTimeMs; |
89 } | 81 } |
90 } | 82 } |
OLD | NEW |