Chromium Code Reviews| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 ConvertUTF8ToJavaString(env, item->GetTargetFilePath().value()), | 115 ConvertUTF8ToJavaString(env, item->GetTargetFilePath().value()), |
| 116 ConvertUTF8ToJavaString(env, item->GetTabUrl().spec()), | 116 ConvertUTF8ToJavaString(env, item->GetTabUrl().spec()), |
| 117 ConvertUTF8ToJavaString(env, item->GetMimeType()), | 117 ConvertUTF8ToJavaString(env, item->GetMimeType()), |
| 118 item->GetReceivedBytes(), item->GetBrowserContext()->IsOffTheRecord(), | 118 item->GetReceivedBytes(), item->GetBrowserContext()->IsOffTheRecord(), |
| 119 item->GetState(), item->PercentComplete(), item->IsPaused(), | 119 item->GetState(), item->PercentComplete(), item->IsPaused(), |
| 120 has_user_gesture, item->CanResume(), | 120 has_user_gesture, item->CanResume(), |
| 121 ConvertUTF8ToJavaString(env, original_url), | 121 ConvertUTF8ToJavaString(env, original_url), |
| 122 ConvertUTF8ToJavaString(env, item->GetReferrerUrl().spec()), | 122 ConvertUTF8ToJavaString(env, item->GetReferrerUrl().spec()), |
| 123 time_remaining_known ? time_delta.InMilliseconds() | 123 time_remaining_known ? time_delta.InMilliseconds() |
| 124 : kUnknownRemainingTime, | 124 : kUnknownRemainingTime, |
| 125 item->GetLastAccessTime().ToJavaTime()); | 125 item->GetLastAccessTime().ToJavaTime(), item->IsVisible()); |
|
David Trainor- moved to gerrit
2017/03/06 18:28:39
Should visible items make it past this point? May
shaktisahu
2017/03/08 06:51:30
Removed.
| |
| 126 } | 126 } |
| 127 | 127 |
| 128 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& jobj) { | 128 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& jobj) { |
| 129 Profile* profile = ProfileManager::GetActiveUserProfile(); | 129 Profile* profile = ProfileManager::GetActiveUserProfile(); |
| 130 DownloadManagerService* service = DownloadManagerService::GetInstance(); | 130 DownloadManagerService* service = DownloadManagerService::GetInstance(); |
| 131 service->Init(env, jobj); | 131 service->Init(env, jobj); |
| 132 DownloadService* download_service = | 132 DownloadService* download_service = |
| 133 DownloadServiceFactory::GetForBrowserContext(profile); | 133 DownloadServiceFactory::GetForBrowserContext(profile); |
| 134 DownloadHistory* history = download_service->GetDownloadHistory(); | 134 DownloadHistory* history = download_service->GetDownloadHistory(); |
| 135 if (history) | 135 if (history) |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 477 chrome::android::kDownloadAutoResumptionThrottling, | 477 chrome::android::kDownloadAutoResumptionThrottling, |
| 478 kAutoResumptionLimitVariation); | 478 kAutoResumptionLimitVariation); |
| 479 int auto_resumption_limit; | 479 int auto_resumption_limit; |
| 480 if (!variation.empty() && | 480 if (!variation.empty() && |
| 481 base::StringToInt(variation, &auto_resumption_limit)) { | 481 base::StringToInt(variation, &auto_resumption_limit)) { |
| 482 return auto_resumption_limit; | 482 return auto_resumption_limit; |
| 483 } | 483 } |
| 484 | 484 |
| 485 return kDefaultAutoResumptionLimit; | 485 return kDefaultAutoResumptionLimit; |
| 486 } | 486 } |
| OLD | NEW |