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 #include "chrome/browser/android/download/download_manager_service.h" | 5 #include "chrome/browser/android/download/download_manager_service.h" |
6 | 6 |
7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 // requests to check for externally removed downloads. | 232 // requests to check for externally removed downloads. |
233 if (!is_history_query_complete_) | 233 if (!is_history_query_complete_) |
234 return; | 234 return; |
235 | 235 |
236 content::DownloadManager* manager = GetDownloadManager(is_off_the_record); | 236 content::DownloadManager* manager = GetDownloadManager(is_off_the_record); |
237 if (!manager) | 237 if (!manager) |
238 return; | 238 return; |
239 manager->CheckForHistoryFilesRemoval(); | 239 manager->CheckForHistoryFilesRemoval(); |
240 } | 240 } |
241 | 241 |
242 void DownloadManagerService::UpdateLastAccessTime( | |
243 JNIEnv* env, | |
244 const JavaParamRef<jobject>& obj, | |
245 const JavaParamRef<jstring>& jdownload_guid, | |
246 jlong last_access_time, | |
David Trainor- moved to gerrit
2017/02/23 21:21:20
We might not need this from Java, but I like that
shaktisahu
2017/02/23 23:18:07
Done. Removed from Java.
| |
247 bool is_off_the_record) { | |
248 std::string download_guid = ConvertJavaStringToUTF8(env, jdownload_guid); | |
249 content::DownloadManager* manager = GetDownloadManager(is_off_the_record); | |
250 if (!manager) | |
251 return; | |
252 | |
253 content::DownloadItem* item = manager->GetDownloadByGuid(download_guid); | |
254 if (item) | |
255 item->SetLastAccessTime(base::Time::FromJavaTime(last_access_time)); | |
256 } | |
257 | |
242 void DownloadManagerService::CancelDownload( | 258 void DownloadManagerService::CancelDownload( |
243 JNIEnv* env, | 259 JNIEnv* env, |
244 jobject obj, | 260 jobject obj, |
245 const JavaParamRef<jstring>& jdownload_guid, | 261 const JavaParamRef<jstring>& jdownload_guid, |
246 bool is_off_the_record, | 262 bool is_off_the_record, |
247 bool is_notification_dismissed) { | 263 bool is_notification_dismissed) { |
248 std::string download_guid = ConvertJavaStringToUTF8(env, jdownload_guid); | 264 std::string download_guid = ConvertJavaStringToUTF8(env, jdownload_guid); |
249 DownloadController::RecordDownloadCancelReason( | 265 DownloadController::RecordDownloadCancelReason( |
250 is_notification_dismissed ? | 266 is_notification_dismissed ? |
251 DownloadController::CANCEL_REASON_NOTIFICATION_DISMISSED : | 267 DownloadController::CANCEL_REASON_NOTIFICATION_DISMISSED : |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
461 chrome::android::kDownloadAutoResumptionThrottling, | 477 chrome::android::kDownloadAutoResumptionThrottling, |
462 kAutoResumptionLimitVariation); | 478 kAutoResumptionLimitVariation); |
463 int auto_resumption_limit; | 479 int auto_resumption_limit; |
464 if (!variation.empty() && | 480 if (!variation.empty() && |
465 base::StringToInt(variation, &auto_resumption_limit)) { | 481 base::StringToInt(variation, &auto_resumption_limit)) { |
466 return auto_resumption_limit; | 482 return auto_resumption_limit; |
467 } | 483 } |
468 | 484 |
469 return kDefaultAutoResumptionLimit; | 485 return kDefaultAutoResumptionLimit; |
470 } | 486 } |
OLD | NEW |