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

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

Issue 2737833002: Don't cancel download when dismissing the notification (Closed)
Patch Set: Created 3 years, 9 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 | « chrome/browser/android/download/download_manager_service.h ('k') | 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/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 content::DownloadManager* manager = GetDownloadManager(is_off_the_record); 236 content::DownloadManager* manager = GetDownloadManager(is_off_the_record);
237 if (!manager) 237 if (!manager)
238 return; 238 return;
239 manager->CheckForHistoryFilesRemoval(); 239 manager->CheckForHistoryFilesRemoval();
240 } 240 }
241 241
242 void DownloadManagerService::CancelDownload( 242 void DownloadManagerService::CancelDownload(
243 JNIEnv* env, 243 JNIEnv* env,
244 jobject obj, 244 jobject obj,
245 const JavaParamRef<jstring>& jdownload_guid, 245 const JavaParamRef<jstring>& jdownload_guid,
246 bool is_off_the_record, 246 bool is_off_the_record) {
247 bool is_notification_dismissed) {
248 std::string download_guid = ConvertJavaStringToUTF8(env, jdownload_guid); 247 std::string download_guid = ConvertJavaStringToUTF8(env, jdownload_guid);
249 DownloadController::RecordDownloadCancelReason( 248 DownloadController::RecordDownloadCancelReason(
250 is_notification_dismissed ? 249 DownloadController::CANCEL_REASON_ACTION_BUTTON);
251 DownloadController::CANCEL_REASON_NOTIFICATION_DISMISSED :
252 DownloadController::CANCEL_REASON_ACTION_BUTTON);
253 if (is_history_query_complete_ || is_off_the_record) 250 if (is_history_query_complete_ || is_off_the_record)
254 CancelDownloadInternal(download_guid, is_off_the_record); 251 CancelDownloadInternal(download_guid, is_off_the_record);
255 else 252 else
256 EnqueueDownloadAction(download_guid, CANCEL); 253 EnqueueDownloadAction(download_guid, CANCEL);
257 } 254 }
258 255
259 void DownloadManagerService::OnHistoryQueryComplete() { 256 void DownloadManagerService::OnHistoryQueryComplete() {
260 is_history_query_complete_ = true; 257 is_history_query_complete_ = true;
261 for (auto iter = pending_actions_.begin(); iter != pending_actions_.end(); 258 for (auto iter = pending_actions_.begin(); iter != pending_actions_.end();
262 ++iter) { 259 ++iter) {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 chrome::android::kDownloadAutoResumptionThrottling, 458 chrome::android::kDownloadAutoResumptionThrottling,
462 kAutoResumptionLimitVariation); 459 kAutoResumptionLimitVariation);
463 int auto_resumption_limit; 460 int auto_resumption_limit;
464 if (!variation.empty() && 461 if (!variation.empty() &&
465 base::StringToInt(variation, &auto_resumption_limit)) { 462 base::StringToInt(variation, &auto_resumption_limit)) {
466 return auto_resumption_limit; 463 return auto_resumption_limit;
467 } 464 }
468 465
469 return kDefaultAutoResumptionLimit; 466 return kDefaultAutoResumptionLimit;
470 } 467 }
OLDNEW
« no previous file with comments | « chrome/browser/android/download/download_manager_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698