Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: chrome/browser/android/download/download_manager_service.cc

Issue 2317193002: [Download Home] Don't show canceled downloads (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 231 }
232 pending_actions_.clear(); 232 pending_actions_.clear();
233 233
234 // Monitor all DownloadItems for changes. 234 // Monitor all DownloadItems for changes.
235 updateNotifier(this, GetDownloadManager(false), original_notifier_); 235 updateNotifier(this, GetDownloadManager(false), original_notifier_);
236 updateNotifier(this, GetDownloadManager(true), off_the_record_notifier_); 236 updateNotifier(this, GetDownloadManager(true), off_the_record_notifier_);
237 } 237 }
238 238
239 void DownloadManagerService::OnDownloadUpdated( 239 void DownloadManagerService::OnDownloadUpdated(
240 content::DownloadManager* manager, content::DownloadItem* item) { 240 content::DownloadManager* manager, content::DownloadItem* item) {
241 if (java_ref_.is_null())
242 return;
243
241 // Ignore anything that isn't a completed download notification. 244 // Ignore anything that isn't a completed download notification.
242 if (!item->IsDone() || java_ref_.is_null()) 245 if (item->GetState() != content::DownloadItem::DownloadState::COMPLETE)
243 return; 246 return;
244 247
245 JNIEnv* env = base::android::AttachCurrentThread(); 248 JNIEnv* env = base::android::AttachCurrentThread();
246 Java_DownloadManagerService_onDownloadItemUpdated( 249 Java_DownloadManagerService_onDownloadItemUpdated(
247 env, 250 env,
248 java_ref_.obj(), 251 java_ref_.obj(),
249 ConvertUTF8ToJavaString(env, item->GetGuid()).obj(), 252 ConvertUTF8ToJavaString(env, item->GetGuid()).obj(),
250 ConvertUTF8ToJavaString( 253 ConvertUTF8ToJavaString(
251 env, item->GetFileNameToReportUser().value()).obj(), 254 env, item->GetFileNameToReportUser().value()).obj(),
252 ConvertUTF8ToJavaString( 255 ConvertUTF8ToJavaString(
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 content::DownloadManager* manager = 392 content::DownloadManager* manager =
390 content::BrowserContext::GetDownloadManager(profile); 393 content::BrowserContext::GetDownloadManager(profile);
391 394
392 // Update notifiers to monitor any newly created DownloadManagers. 395 // Update notifiers to monitor any newly created DownloadManagers.
393 updateNotifier( 396 updateNotifier(
394 this, manager, 397 this, manager,
395 is_off_the_record ? off_the_record_notifier_ : original_notifier_); 398 is_off_the_record ? off_the_record_notifier_ : original_notifier_);
396 399
397 return manager; 400 return manager;
398 } 401 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698