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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 252 |
253 content::DownloadItem* item = manager->GetDownloadByGuid(download_guid); | 253 content::DownloadItem* item = manager->GetDownloadByGuid(download_guid); |
254 if (item) | 254 if (item) |
255 item->SetLastAccessTime(base::Time::Now()); | 255 item->SetLastAccessTime(base::Time::Now()); |
256 } | 256 } |
257 | 257 |
258 void DownloadManagerService::CancelDownload( | 258 void DownloadManagerService::CancelDownload( |
259 JNIEnv* env, | 259 JNIEnv* env, |
260 jobject obj, | 260 jobject obj, |
261 const JavaParamRef<jstring>& jdownload_guid, | 261 const JavaParamRef<jstring>& jdownload_guid, |
262 bool is_off_the_record, | 262 bool is_off_the_record) { |
263 bool is_notification_dismissed) { | |
264 std::string download_guid = ConvertJavaStringToUTF8(env, jdownload_guid); | 263 std::string download_guid = ConvertJavaStringToUTF8(env, jdownload_guid); |
265 DownloadController::RecordDownloadCancelReason( | 264 DownloadController::RecordDownloadCancelReason( |
266 is_notification_dismissed ? | 265 DownloadController::CANCEL_REASON_ACTION_BUTTON); |
267 DownloadController::CANCEL_REASON_NOTIFICATION_DISMISSED : | |
268 DownloadController::CANCEL_REASON_ACTION_BUTTON); | |
269 if (is_history_query_complete_ || is_off_the_record) | 266 if (is_history_query_complete_ || is_off_the_record) |
270 CancelDownloadInternal(download_guid, is_off_the_record); | 267 CancelDownloadInternal(download_guid, is_off_the_record); |
271 else | 268 else |
272 EnqueueDownloadAction(download_guid, CANCEL); | 269 EnqueueDownloadAction(download_guid, CANCEL); |
273 } | 270 } |
274 | 271 |
275 void DownloadManagerService::OnHistoryQueryComplete() { | 272 void DownloadManagerService::OnHistoryQueryComplete() { |
276 is_history_query_complete_ = true; | 273 is_history_query_complete_ = true; |
277 for (auto iter = pending_actions_.begin(); iter != pending_actions_.end(); | 274 for (auto iter = pending_actions_.begin(); iter != pending_actions_.end(); |
278 ++iter) { | 275 ++iter) { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 chrome::android::kDownloadAutoResumptionThrottling, | 474 chrome::android::kDownloadAutoResumptionThrottling, |
478 kAutoResumptionLimitVariation); | 475 kAutoResumptionLimitVariation); |
479 int auto_resumption_limit; | 476 int auto_resumption_limit; |
480 if (!variation.empty() && | 477 if (!variation.empty() && |
481 base::StringToInt(variation, &auto_resumption_limit)) { | 478 base::StringToInt(variation, &auto_resumption_limit)) { |
482 return auto_resumption_limit; | 479 return auto_resumption_limit; |
483 } | 480 } |
484 | 481 |
485 return kDefaultAutoResumptionLimit; | 482 return kDefaultAutoResumptionLimit; |
486 } | 483 } |
OLD | NEW |