| 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 import android.content.ComponentName; | 7 import android.content.ComponentName; |
| 8 import android.support.annotation.Nullable; | 8 import android.support.annotation.Nullable; |
| 9 | 9 |
| 10 import org.chromium.base.ObserverList; | 10 import org.chromium.base.ObserverList; |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 void downloadItemUpdated(OfflinePageDownloadItem item) { | 249 void downloadItemUpdated(OfflinePageDownloadItem item) { |
| 250 assert item != null; | 250 assert item != null; |
| 251 | 251 |
| 252 for (Observer observer : mObservers) { | 252 for (Observer observer : mObservers) { |
| 253 observer.onItemUpdated(item); | 253 observer.onItemUpdated(item); |
| 254 } | 254 } |
| 255 } | 255 } |
| 256 | 256 |
| 257 @CalledByNative | 257 @CalledByNative |
| 258 static void createDownloadItemAndAddToList(List<OfflinePageDownloadItem> lis
t, String guid, | 258 static void createDownloadItemAndAddToList(List<OfflinePageDownloadItem> lis
t, String guid, |
| 259 String url, String title, String targetPath, long startTimeMs, long
totalBytes) { | 259 String url, int downloadState, long downloadProgressBytes, String ti
tle, |
| 260 list.add(createDownloadItem(guid, url, title, targetPath, startTimeMs, t
otalBytes)); | 260 String targetPath, long startTimeMs, long totalBytes) { |
| 261 list.add(createDownloadItem(guid, url, downloadState, downloadProgressBy
tes, title, |
| 262 targetPath, startTimeMs, totalBytes)); |
| 261 } | 263 } |
| 262 | 264 |
| 263 @CalledByNative | 265 @CalledByNative |
| 264 static OfflinePageDownloadItem createDownloadItem( | 266 static OfflinePageDownloadItem createDownloadItem(String guid, String url, i
nt downloadState, |
| 265 String guid, String url, String title, String targetPath, | 267 long downloadProgressBytes, String title, String targetPath, long st
artTimeMs, |
| 266 long startTimeMs, long totalBytes) { | 268 long totalBytes) { |
| 267 return new OfflinePageDownloadItem(guid, url, title, targetPath, startTi
meMs, totalBytes); | 269 return new OfflinePageDownloadItem(guid, url, downloadState, downloadPro
gressBytes, title, |
| 270 targetPath, startTimeMs, totalBytes); |
| 268 } | 271 } |
| 269 | 272 |
| 270 private native long nativeInit(Profile profile); | 273 private native long nativeInit(Profile profile); |
| 271 private native void nativeDestroy(long nativeOfflinePageDownloadBridge); | 274 private native void nativeDestroy(long nativeOfflinePageDownloadBridge); |
| 272 native void nativeGetAllItems( | 275 native void nativeGetAllItems( |
| 273 long nativeOfflinePageDownloadBridge, List<OfflinePageDownloadItem>
items); | 276 long nativeOfflinePageDownloadBridge, List<OfflinePageDownloadItem>
items); |
| 274 native OfflinePageDownloadItem nativeGetItemByGuid( | 277 native OfflinePageDownloadItem nativeGetItemByGuid( |
| 275 long nativeOfflinePageDownloadBridge, String guid); | 278 long nativeOfflinePageDownloadBridge, String guid); |
| 276 native void nativeCancelDownload(long nativeOfflinePageDownloadBridge, Strin
g guid); | 279 native void nativeCancelDownload(long nativeOfflinePageDownloadBridge, Strin
g guid); |
| 277 native void nativePauseDownload(long nativeOfflinePageDownloadBridge, String
guid); | 280 native void nativePauseDownload(long nativeOfflinePageDownloadBridge, String
guid); |
| 278 native void nativeResumeDownload(long nativeOfflinePageDownloadBridge, Strin
g guid); | 281 native void nativeResumeDownload(long nativeOfflinePageDownloadBridge, Strin
g guid); |
| 279 native void nativeDeleteItemByGuid(long nativeOfflinePageDownloadBridge, Str
ing guid); | 282 native void nativeDeleteItemByGuid(long nativeOfflinePageDownloadBridge, Str
ing guid); |
| 280 native long nativeGetOfflineIdByGuid(long nativeOfflinePageDownloadBridge, S
tring guid); | 283 native long nativeGetOfflineIdByGuid(long nativeOfflinePageDownloadBridge, S
tring guid); |
| 281 native void nativeStartDownload(long nativeOfflinePageDownloadBridge, Tab ta
b); | 284 native void nativeStartDownload(long nativeOfflinePageDownloadBridge, Tab ta
b); |
| 282 } | 285 } |
| OLD | NEW |