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/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "chrome/browser/android/download/download_controller.h" | 12 #include "chrome/browser/android/download/download_controller.h" |
13 #include "chrome/browser/download/download_service.h" | 13 #include "chrome/browser/download/download_service.h" |
14 #include "chrome/browser/download/download_service_factory.h" | 14 #include "chrome/browser/download/download_service_factory.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
17 #include "content/public/browser/browser_context.h" | 17 #include "content/public/browser/browser_context.h" |
18 #include "content/public/browser/download_item.h" | 18 #include "content/public/browser/download_item.h" |
19 #include "jni/DownloadManagerService_jni.h" | 19 #include "jni/DownloadManagerService_jni.h" |
20 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
21 | 21 |
22 using base::android::JavaParamRef; | 22 using base::android::JavaParamRef; |
23 using base::android::ConvertJavaStringToUTF8; | 23 using base::android::ConvertJavaStringToUTF8; |
24 using base::android::ConvertUTF8ToJavaString; | 24 using base::android::ConvertUTF8ToJavaString; |
| 25 using base::android::ScopedJavaLocalRef; |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
28 bool ShouldShowDownloadItem(content::DownloadItem* item) { | 29 bool ShouldShowDownloadItem(content::DownloadItem* item) { |
29 return !item->IsTemporary() && | 30 return !item->IsTemporary() && |
30 !item->GetFileNameToReportUser().empty() && | 31 !item->GetFileNameToReportUser().empty() && |
31 !item->GetTargetFilePath().empty() && | 32 !item->GetTargetFilePath().empty() && |
32 item->GetState() == content::DownloadItem::COMPLETE; | 33 item->GetState() == content::DownloadItem::COMPLETE; |
33 } | 34 } |
34 | 35 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 resume_callback_for_testing_.Run(false); | 325 resume_callback_for_testing_.Run(false); |
325 } | 326 } |
326 | 327 |
327 content::DownloadManager* DownloadManagerService::GetDownloadManager( | 328 content::DownloadManager* DownloadManagerService::GetDownloadManager( |
328 bool is_off_the_record) { | 329 bool is_off_the_record) { |
329 Profile* profile = ProfileManager::GetActiveUserProfile(); | 330 Profile* profile = ProfileManager::GetActiveUserProfile(); |
330 if (is_off_the_record) | 331 if (is_off_the_record) |
331 profile = profile->GetOffTheRecordProfile(); | 332 profile = profile->GetOffTheRecordProfile(); |
332 return content::BrowserContext::GetDownloadManager(profile); | 333 return content::BrowserContext::GetDownloadManager(profile); |
333 } | 334 } |
OLD | NEW |