OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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.components.offline_items_collection; | 5 package org.chromium.components.offline_items_collection; |
6 | 6 |
7 import org.chromium.base.annotations.SuppressFBWarnings; | 7 import org.chromium.base.annotations.SuppressFBWarnings; |
8 | 8 |
9 /** | 9 /** |
10 * This class is the Java counterpart to the C++ OfflineItem | 10 * This class is the Java counterpart to the C++ OfflineItem |
11 * (components/offline_items_collection/core/offline_item.h) class. | 11 * (components/offline_items_collection/core/offline_item.h) class. |
12 * | 12 * |
13 * For all member variable descriptions see the C++ class. | 13 * For all member variable descriptions see the C++ class. |
14 * TODO(dtrainor): Investigate making all class members for this and the C++ cou nterpart const. | 14 * TODO(dtrainor): Investigate making all class members for this and the C++ cou nterpart const. |
15 */ | 15 */ |
16 @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") | 16 @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
17 public class OfflineItem { | 17 public class OfflineItem { |
18 /** | |
19 * Contains relevant pieces of information to determine the download progres s percentage for | |
David Trainor- moved to gerrit
2017/05/03 22:06:31
Make this comment a bit more like the one above so
shaktisahu
2017/05/05 02:09:37
Done.
| |
20 * displaying in the UI. | |
21 */ | |
22 public static class Progress { | |
23 public long value; | |
24 public long max; | |
25 @OfflineItemProgressUnit | |
26 public int unit; | |
27 | |
28 public Progress(long value, long max, int unit) { | |
29 this.value = value; | |
30 this.max = max; | |
31 this.unit = unit; | |
32 } | |
33 } | |
34 | |
18 public ContentId id; | 35 public ContentId id; |
19 | 36 |
20 // Display metadata. | 37 // Display metadata. |
21 public String title; | 38 public String title; |
22 public String description; | 39 public String description; |
23 @OfflineItemFilter | 40 @OfflineItemFilter |
24 public int filter; | 41 public int filter; |
25 public boolean isTransient; | 42 public boolean isTransient; |
26 | 43 |
27 // Content Metadata. | 44 // Content Metadata. |
28 public long totalSizeBytes; | 45 public long totalSizeBytes; |
29 public boolean externallyRemoved; | 46 public boolean externallyRemoved; |
30 public long creationTimeMs; | 47 public long creationTimeMs; |
31 public long lastAccessedTimeMs; | 48 public long lastAccessedTimeMs; |
32 public boolean isOpenable; | 49 public boolean isOpenable; |
33 | 50 |
34 // Request Metadata. | 51 // Request Metadata. |
35 public String pageUrl; | 52 public String pageUrl; |
36 public String originalUrl; | 53 public String originalUrl; |
37 public boolean isOffTheRecord; | 54 public boolean isOffTheRecord; |
38 | 55 |
39 // In Progress Metadata. | 56 // In Progress Metadata. |
40 @OfflineItemState | 57 @OfflineItemState |
41 public int state; | 58 public int state; |
42 public boolean isResumable; | 59 public boolean isResumable; |
43 public boolean allowMetered; | 60 public boolean allowMetered; |
44 public long receivedBytes; | 61 public long receivedBytes; |
45 public int percentCompleted; | 62 public Progress progress; |
46 public long timeRemainingMs; | 63 public long timeRemainingMs; |
47 | 64 |
48 public OfflineItem() { | 65 public OfflineItem() { |
49 id = new ContentId(); | 66 id = new ContentId(); |
50 filter = OfflineItemFilter.FILTER_OTHER; | 67 filter = OfflineItemFilter.FILTER_OTHER; |
51 state = OfflineItemState.COMPLETE; | 68 state = OfflineItemState.COMPLETE; |
52 } | 69 } |
53 } | 70 } |
OLD | NEW |