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

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

Issue 2729623007: Don't cancel download when dismissing the notification (Closed)
Patch Set: rebase 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 252
253 content::DownloadItem* item = manager->GetDownloadByGuid(download_guid); 253 content::DownloadItem* item = manager->GetDownloadByGuid(download_guid);
254 if (item) 254 if (item)
255 item->SetLastAccessTime(base::Time::Now()); 255 item->SetLastAccessTime(base::Time::Now());
256 } 256 }
257 257
258 void DownloadManagerService::CancelDownload( 258 void DownloadManagerService::CancelDownload(
259 JNIEnv* env, 259 JNIEnv* env,
260 jobject obj, 260 jobject obj,
261 const JavaParamRef<jstring>& jdownload_guid, 261 const JavaParamRef<jstring>& jdownload_guid,
262 bool is_off_the_record, 262 bool is_off_the_record) {
263 bool is_notification_dismissed) {
264 std::string download_guid = ConvertJavaStringToUTF8(env, jdownload_guid); 263 std::string download_guid = ConvertJavaStringToUTF8(env, jdownload_guid);
265 DownloadController::RecordDownloadCancelReason( 264 DownloadController::RecordDownloadCancelReason(
266 is_notification_dismissed ? 265 DownloadController::CANCEL_REASON_ACTION_BUTTON);
267 DownloadController::CANCEL_REASON_NOTIFICATION_DISMISSED :
268 DownloadController::CANCEL_REASON_ACTION_BUTTON);
269 if (is_history_query_complete_ || is_off_the_record) 266 if (is_history_query_complete_ || is_off_the_record)
270 CancelDownloadInternal(download_guid, is_off_the_record); 267 CancelDownloadInternal(download_guid, is_off_the_record);
271 else 268 else
272 EnqueueDownloadAction(download_guid, CANCEL); 269 EnqueueDownloadAction(download_guid, CANCEL);
273 } 270 }
274 271
275 void DownloadManagerService::OnHistoryQueryComplete() { 272 void DownloadManagerService::OnHistoryQueryComplete() {
276 is_history_query_complete_ = true; 273 is_history_query_complete_ = true;
277 for (auto iter = pending_actions_.begin(); iter != pending_actions_.end(); 274 for (auto iter = pending_actions_.begin(); iter != pending_actions_.end();
278 ++iter) { 275 ++iter) {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 chrome::android::kDownloadAutoResumptionThrottling, 474 chrome::android::kDownloadAutoResumptionThrottling,
478 kAutoResumptionLimitVariation); 475 kAutoResumptionLimitVariation);
479 int auto_resumption_limit; 476 int auto_resumption_limit;
480 if (!variation.empty() && 477 if (!variation.empty() &&
481 base::StringToInt(variation, &auto_resumption_limit)) { 478 base::StringToInt(variation, &auto_resumption_limit)) {
482 return auto_resumption_limit; 479 return auto_resumption_limit;
483 } 480 }
484 481
485 return kDefaultAutoResumptionLimit; 482 return kDefaultAutoResumptionLimit;
486 } 483 }
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