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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 content::DownloadManager* manager = GetDownloadManager(is_off_the_record); | 176 content::DownloadManager* manager = GetDownloadManager(is_off_the_record); |
177 if (!manager) | 177 |
178 // Once the history query is complete, download_history.cc will check for the | |
179 // removal of history files. If the history query is not yet complete, ignore | |
180 // requests to check for externally removed downloads. | |
181 if (!manager || !is_history_query_complete_) | |
qinmin
2016/08/24 16:30:53
Nit: there is no need to get the manager if is_his
Theresa
2016/08/24 22:52:09
Done.
| |
178 return; | 182 return; |
179 manager->CheckForHistoryFilesRemoval(); | 183 manager->CheckForHistoryFilesRemoval(); |
180 } | 184 } |
181 | 185 |
182 void DownloadManagerService::CancelDownload( | 186 void DownloadManagerService::CancelDownload( |
183 JNIEnv* env, | 187 JNIEnv* env, |
184 jobject obj, | 188 jobject obj, |
185 const JavaParamRef<jstring>& jdownload_guid, | 189 const JavaParamRef<jstring>& jdownload_guid, |
186 bool is_off_the_record, | 190 bool is_off_the_record, |
187 bool is_notification_dismissed) { | 191 bool is_notification_dismissed) { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 content::DownloadManager* manager = | 387 content::DownloadManager* manager = |
384 content::BrowserContext::GetDownloadManager(profile); | 388 content::BrowserContext::GetDownloadManager(profile); |
385 | 389 |
386 // Update notifiers to monitor any newly created DownloadManagers. | 390 // Update notifiers to monitor any newly created DownloadManagers. |
387 updateNotifier( | 391 updateNotifier( |
388 this, manager, | 392 this, manager, |
389 is_off_the_record ? off_the_record_notifier_ : original_notifier_); | 393 is_off_the_record ? off_the_record_notifier_ : original_notifier_); |
390 | 394 |
391 return manager; | 395 return manager; |
392 } | 396 } |
OLD | NEW |