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 std::string download_guid = ConvertJavaStringToUTF8(env, jdownload_guid); | |
247 content::DownloadManager* manager = GetDownloadManager(false); | |
David Trainor- moved to gerrit
2017/02/22 05:56:03
Can we assume always not off the record?
shaktisahu
2017/02/23 06:55:47
Oops. I guess I have to pass the is_off_the_record
| |
248 if (!manager) | |
249 return; | |
250 | |
251 content::DownloadItem* item = manager->GetDownloadByGuid(download_guid); | |
252 if (item) | |
253 item->UpdateLastAccessTime(); | |
254 } | |
255 | |
242 void DownloadManagerService::CancelDownload( | 256 void DownloadManagerService::CancelDownload( |
243 JNIEnv* env, | 257 JNIEnv* env, |
244 jobject obj, | 258 jobject obj, |
245 const JavaParamRef<jstring>& jdownload_guid, | 259 const JavaParamRef<jstring>& jdownload_guid, |
246 bool is_off_the_record, | 260 bool is_off_the_record, |
247 bool is_notification_dismissed) { | 261 bool is_notification_dismissed) { |
248 std::string download_guid = ConvertJavaStringToUTF8(env, jdownload_guid); | 262 std::string download_guid = ConvertJavaStringToUTF8(env, jdownload_guid); |
249 DownloadController::RecordDownloadCancelReason( | 263 DownloadController::RecordDownloadCancelReason( |
250 is_notification_dismissed ? | 264 is_notification_dismissed ? |
251 DownloadController::CANCEL_REASON_NOTIFICATION_DISMISSED : | 265 DownloadController::CANCEL_REASON_NOTIFICATION_DISMISSED : |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
461 chrome::android::kDownloadAutoResumptionThrottling, | 475 chrome::android::kDownloadAutoResumptionThrottling, |
462 kAutoResumptionLimitVariation); | 476 kAutoResumptionLimitVariation); |
463 int auto_resumption_limit; | 477 int auto_resumption_limit; |
464 if (!variation.empty() && | 478 if (!variation.empty() && |
465 base::StringToInt(variation, &auto_resumption_limit)) { | 479 base::StringToInt(variation, &auto_resumption_limit)) { |
466 return auto_resumption_limit; | 480 return auto_resumption_limit; |
467 } | 481 } |
468 | 482 |
469 return kDefaultAutoResumptionLimit; | 483 return kDefaultAutoResumptionLimit; |
470 } | 484 } |
OLD | NEW |