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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::CancelDownload( | 242 void DownloadManagerService::CancelDownload( |
243 JNIEnv* env, | 243 JNIEnv* env, |
244 jobject obj, | 244 jobject obj, |
245 const JavaParamRef<jstring>& jdownload_guid, | 245 const JavaParamRef<jstring>& jdownload_guid, |
246 bool is_off_the_record, | 246 bool is_off_the_record) { |
247 bool is_notification_dismissed) { | |
248 std::string download_guid = ConvertJavaStringToUTF8(env, jdownload_guid); | 247 std::string download_guid = ConvertJavaStringToUTF8(env, jdownload_guid); |
249 DownloadController::RecordDownloadCancelReason( | 248 DownloadController::RecordDownloadCancelReason( |
250 is_notification_dismissed ? | 249 DownloadController::CANCEL_REASON_ACTION_BUTTON); |
251 DownloadController::CANCEL_REASON_NOTIFICATION_DISMISSED : | |
252 DownloadController::CANCEL_REASON_ACTION_BUTTON); | |
253 if (is_history_query_complete_ || is_off_the_record) | 250 if (is_history_query_complete_ || is_off_the_record) |
254 CancelDownloadInternal(download_guid, is_off_the_record); | 251 CancelDownloadInternal(download_guid, is_off_the_record); |
255 else | 252 else |
256 EnqueueDownloadAction(download_guid, CANCEL); | 253 EnqueueDownloadAction(download_guid, CANCEL); |
257 } | 254 } |
258 | 255 |
259 void DownloadManagerService::OnHistoryQueryComplete() { | 256 void DownloadManagerService::OnHistoryQueryComplete() { |
260 is_history_query_complete_ = true; | 257 is_history_query_complete_ = true; |
261 for (auto iter = pending_actions_.begin(); iter != pending_actions_.end(); | 258 for (auto iter = pending_actions_.begin(); iter != pending_actions_.end(); |
262 ++iter) { | 259 ++iter) { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 chrome::android::kDownloadAutoResumptionThrottling, | 458 chrome::android::kDownloadAutoResumptionThrottling, |
462 kAutoResumptionLimitVariation); | 459 kAutoResumptionLimitVariation); |
463 int auto_resumption_limit; | 460 int auto_resumption_limit; |
464 if (!variation.empty() && | 461 if (!variation.empty() && |
465 base::StringToInt(variation, &auto_resumption_limit)) { | 462 base::StringToInt(variation, &auto_resumption_limit)) { |
466 return auto_resumption_limit; | 463 return auto_resumption_limit; |
467 } | 464 } |
468 | 465 |
469 return kDefaultAutoResumptionLimit; | 466 return kDefaultAutoResumptionLimit; |
470 } | 467 } |
OLD | NEW |