| 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 import org.chromium.components.bookmarks.BookmarkId; | |
| 9 import org.chromium.components.bookmarks.BookmarkType; | |
| 10 | 8 |
| 11 /** | 9 /** |
| 12 * Simple object representing an offline page. | 10 * Simple object representing an offline page. |
| 13 */ | 11 */ |
| 14 public class OfflinePageItem { | 12 public class OfflinePageItem { |
| 15 private final String mUrl; | 13 private final String mUrl; |
| 16 private final BookmarkId mBookmarId; | 14 private final long mOfflineId; |
| 15 private final ClientId mClientId; |
| 17 private final String mOfflineUrl; | 16 private final String mOfflineUrl; |
| 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 bookmarkId, String offlineUrl, long
fileSize, | 22 public OfflinePageItem(String url, long offlineId, String clientNamespace, S
tring clientId, |
| 24 long creationTimeMs, int accessCount, long lastAccessTimeMs) { | 23 String offlineUrl, long fileSize, long creationTimeMs, int accessCou
nt, |
| 24 long lastAccessTimeMs) { |
| 25 mUrl = url; | 25 mUrl = url; |
| 26 mBookmarId = new BookmarkId(bookmarkId, BookmarkType.NORMAL); | 26 mOfflineId = offlineId; |
| 27 mClientId = new ClientId(clientNamespace, clientId); |
| 27 mOfflineUrl = offlineUrl; | 28 mOfflineUrl = offlineUrl; |
| 28 mFileSize = fileSize; | 29 mFileSize = fileSize; |
| 29 mCreationTimeMs = creationTimeMs; | 30 mCreationTimeMs = creationTimeMs; |
| 30 mAccessCount = accessCount; | 31 mAccessCount = accessCount; |
| 31 mLastAccessTimeMs = lastAccessTimeMs; | 32 mLastAccessTimeMs = lastAccessTimeMs; |
| 32 } | 33 } |
| 33 | 34 |
| 34 /** @return URL of the offline page. */ | 35 /** @return URL of the offline page. */ |
| 35 @VisibleForTesting | 36 @VisibleForTesting |
| 36 public String getUrl() { | 37 public String getUrl() { |
| 37 return mUrl; | 38 return mUrl; |
| 38 } | 39 } |
| 39 | 40 |
| 40 /** @return Bookmark Id related to the offline page. */ | 41 /** @return offline id for this offline page. */ |
| 41 @VisibleForTesting | 42 @VisibleForTesting |
| 42 public BookmarkId getBookmarkId() { | 43 public long getOfflineId() { |
| 43 return mBookmarId; | 44 return mOfflineId; |
| 45 } |
| 46 |
| 47 /** @return Client Id related to the offline page. */ |
| 48 @VisibleForTesting |
| 49 public ClientId getClientId() { |
| 50 return mClientId; |
| 44 } | 51 } |
| 45 | 52 |
| 46 /** @return Path to the offline copy of the page. */ | 53 /** @return Path to the offline copy of the page. */ |
| 47 @VisibleForTesting | 54 @VisibleForTesting |
| 48 public String getOfflineUrl() { | 55 public String getOfflineUrl() { |
| 49 return mOfflineUrl; | 56 return mOfflineUrl; |
| 50 } | 57 } |
| 51 | 58 |
| 52 /** @return Size of the offline copy of the page. */ | 59 /** @return Size of the offline copy of the page. */ |
| 53 @VisibleForTesting | |
| 54 public long getFileSize() { | 60 public long getFileSize() { |
| 55 return mFileSize; | 61 return mFileSize; |
| 56 } | 62 } |
| 57 | 63 |
| 58 /** @return Time in milliseconds the offline page was created. */ | 64 /** @return Time in milliseconds the offline page was created. */ |
| 59 public long getCreationTimeMs() { | 65 public long getCreationTimeMs() { |
| 60 return mCreationTimeMs; | 66 return mCreationTimeMs; |
| 61 } | 67 } |
| 62 | 68 |
| 63 /** @return Number of times that the offline page has been accessed. */ | 69 /** @return Number of times that the offline page has been accessed. */ |
| 64 @VisibleForTesting | 70 @VisibleForTesting |
| 65 public int getAccessCount() { | 71 public int getAccessCount() { |
| 66 return mAccessCount; | 72 return mAccessCount; |
| 67 } | 73 } |
| 68 | 74 |
| 69 /** @return Last time in milliseconds the offline page has been accessed. */ | 75 /** @return Last time in milliseconds the offline page has been accessed. */ |
| 70 public long getLastAccessTimeMs() { | 76 public long getLastAccessTimeMs() { |
| 71 return mLastAccessTimeMs; | 77 return mLastAccessTimeMs; |
| 72 } | 78 } |
| 73 } | 79 } |
| OLD | NEW |