Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.downloads; | 5 package org.chromium.chrome.browser.offlinepages.downloads; |
| 6 | 6 |
| 7 /** Class representing offline page or save page request to downloads UI. */ | 7 /** Class representing offline page or save page request to downloads UI. */ |
| 8 public class OfflinePageDownloadItem { | 8 public class OfflinePageDownloadItem { |
| 9 /** Download State, in sync with DownloadUIItem::DownloadState */ | |
|
fgorski
2017/01/20 17:03:01
There is a way to enforce that using compiler. For
gone
2017/01/20 18:40:01
Alternatively, can you just use org.chromium.conte
Dmitry Titov
2017/01/27 04:26:24
Can not include content/public/browser stuff in al
| |
| 10 private static final int PENDING = 0; | |
| 11 private static final int DOWNLOADING = 1; | |
| 12 private static final int PAUSED = 2; | |
| 13 private static final int COMPLETED = 3; | |
| 14 | |
| 9 private final String mUrl; | 15 private final String mUrl; |
| 16 private final int mDownloadState; | |
| 17 private final long mDownloadProgress; | |
| 18 private final long mDownloadProgressMax; | |
| 10 private final String mTitle; | 19 private final String mTitle; |
| 11 private final String mGuid; | 20 private final String mGuid; |
| 12 private final String mTargetPath; | 21 private final String mTargetPath; |
| 13 private final long mStartTimeMs; | 22 private final long mStartTimeMs; |
| 14 private final long mTotalBytes; | 23 private final long mTotalBytes; |
| 15 | 24 |
| 16 public OfflinePageDownloadItem( | 25 public OfflinePageDownloadItem( |
| 17 String guid, String url, String title, String targetPath, | 26 String guid, String url, int downloadState, long downloadProgress, |
| 27 long downloadProgressMax, String title, String targetPath, | |
| 18 long startTimeMs, long totalBytes) { | 28 long startTimeMs, long totalBytes) { |
| 19 mGuid = guid; | 29 mGuid = guid; |
| 20 mUrl = url; | 30 mUrl = url; |
| 31 mDownloadState = downloadState; | |
| 32 mDownloadProgress = downloadProgress; | |
| 33 mDownloadProgressMax = downloadProgressMax; | |
| 21 mTitle = title; | 34 mTitle = title; |
| 22 mTargetPath = targetPath; | 35 mTargetPath = targetPath; |
| 23 mStartTimeMs = startTimeMs; | 36 mStartTimeMs = startTimeMs; |
| 24 mTotalBytes = totalBytes; | 37 mTotalBytes = totalBytes; |
| 25 } | 38 } |
| 26 | 39 |
| 27 /** @return GUID identifying the item. */ | 40 /** @return GUID identifying the item. */ |
| 28 public String getGuid() { | 41 public String getGuid() { |
| 29 return mGuid; | 42 return mGuid; |
| 30 } | 43 } |
| 31 | 44 |
| 32 /** @return URL related to the item. */ | 45 /** @return URL related to the item. */ |
| 33 public String getUrl() { | 46 public String getUrl() { |
| 34 return mUrl; | 47 return mUrl; |
| 35 } | 48 } |
| 36 | 49 |
| 50 /** @return DownloadState value. */ | |
| 51 public int downloadState() { | |
| 52 return mDownloadState; | |
| 53 } | |
| 54 | |
| 55 /** @return current download progress */ | |
| 56 public long downloadPreogress() { | |
|
dewittj
2017/01/18 19:24:07
s/Preogress/Progress/ also in next function
Dmitry Titov
2017/01/27 04:26:24
Done.
| |
| 57 return mDownloadProgress; | |
| 58 } | |
| 59 | |
| 60 /** @return current download progress */ | |
| 61 public long downloadPreogressMax() { | |
| 62 return mDownloadProgressMax; | |
| 63 } | |
| 64 | |
| 37 /** @return Title of the page. */ | 65 /** @return Title of the page. */ |
| 38 public String getTitle() { | 66 public String getTitle() { |
| 39 return mTitle; | 67 return mTitle; |
| 40 } | 68 } |
| 41 | 69 |
| 42 /** @return Path to the offline item on the disk. */ | 70 /** @return Path to the offline item on the disk. */ |
| 43 // TODO(fgorski): Title would be more meaningful to show in the Download UI, where the local | 71 // TODO(fgorski): Title would be more meaningful to show in the Download UI, where the local |
| 44 // path is shown right now. | 72 // path is shown right now. |
| 45 public String getTargetPath() { | 73 public String getTargetPath() { |
| 46 return mTargetPath; | 74 return mTargetPath; |
| 47 } | 75 } |
| 48 | 76 |
| 49 /** @return Start time of the item, corresponding to when the offline page w as saved. */ | 77 /** @return Start time of the item, corresponding to when the offline page w as saved. */ |
| 50 public long getStartTimeMs() { | 78 public long getStartTimeMs() { |
| 51 return mStartTimeMs; | 79 return mStartTimeMs; |
| 52 } | 80 } |
| 53 | 81 |
| 54 /** @return Size of the offline archive in bytes. */ | 82 /** @return Size of the offline archive in bytes. */ |
| 55 public long getTotalBytes() { | 83 public long getTotalBytes() { |
| 56 return mTotalBytes; | 84 return mTotalBytes; |
| 57 } | 85 } |
| 58 } | 86 } |
| OLD | NEW |