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" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 166 } |
167 | 167 |
168 Java_DownloadManagerService_onAllDownloadsRetrieved( | 168 Java_DownloadManagerService_onAllDownloadsRetrieved( |
169 env, java_ref_, j_download_item_list, is_off_the_record); | 169 env, java_ref_, j_download_item_list, is_off_the_record); |
170 } | 170 } |
171 | 171 |
172 void DownloadManagerService::CheckForExternallyRemovedDownloads( | 172 void DownloadManagerService::CheckForExternallyRemovedDownloads( |
173 JNIEnv* env, | 173 JNIEnv* env, |
174 const JavaParamRef<jobject>& obj, | 174 const JavaParamRef<jobject>& obj, |
175 bool is_off_the_record) { | 175 bool is_off_the_record) { |
| 176 // Once the history query is complete, download_history.cc will check for the |
| 177 // removal of history files. If the history query is not yet complete, ignore |
| 178 // requests to check for externally removed downloads. |
| 179 if (!is_history_query_complete_) |
| 180 return; |
| 181 |
176 content::DownloadManager* manager = GetDownloadManager(is_off_the_record); | 182 content::DownloadManager* manager = GetDownloadManager(is_off_the_record); |
177 if (!manager) | 183 if (!manager) |
178 return; | 184 return; |
179 manager->CheckForHistoryFilesRemoval(); | 185 manager->CheckForHistoryFilesRemoval(); |
180 } | 186 } |
181 | 187 |
182 void DownloadManagerService::CancelDownload( | 188 void DownloadManagerService::CancelDownload( |
183 JNIEnv* env, | 189 JNIEnv* env, |
184 jobject obj, | 190 jobject obj, |
185 const JavaParamRef<jstring>& jdownload_guid, | 191 const JavaParamRef<jstring>& jdownload_guid, |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 content::DownloadManager* manager = | 389 content::DownloadManager* manager = |
384 content::BrowserContext::GetDownloadManager(profile); | 390 content::BrowserContext::GetDownloadManager(profile); |
385 | 391 |
386 // Update notifiers to monitor any newly created DownloadManagers. | 392 // Update notifiers to monitor any newly created DownloadManagers. |
387 updateNotifier( | 393 updateNotifier( |
388 this, manager, | 394 this, manager, |
389 is_off_the_record ? off_the_record_notifier_ : original_notifier_); | 395 is_off_the_record ? off_the_record_notifier_ : original_notifier_); |
390 | 396 |
391 return manager; | 397 return manager; |
392 } | 398 } |
OLD | NEW |