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

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

Issue 2058593002: Add UMA for studying download cancellation reasons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "chrome/browser/download/download_service.h" 10 #include "chrome/browser/download/download_service.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 if (is_history_query_complete_) 68 if (is_history_query_complete_)
69 PauseDownloadInternal(download_guid); 69 PauseDownloadInternal(download_guid);
70 else 70 else
71 EnqueueDownloadAction(download_guid, PAUSE); 71 EnqueueDownloadAction(download_guid, PAUSE);
72 } 72 }
73 73
74 void DownloadManagerService::CancelDownload( 74 void DownloadManagerService::CancelDownload(
75 JNIEnv* env, 75 JNIEnv* env,
76 jobject obj, 76 jobject obj,
77 const JavaParamRef<jstring>& jdownload_guid, 77 const JavaParamRef<jstring>& jdownload_guid,
78 bool is_off_the_record) { 78 bool is_off_the_record,
79 bool is_notification_dismissed) {
79 std::string download_guid = ConvertJavaStringToUTF8(env, jdownload_guid); 80 std::string download_guid = ConvertJavaStringToUTF8(env, jdownload_guid);
81
82 content::DownloadControllerAndroid::RecordDownloadCancelReason(
83 is_notification_dismissed ?
84 content::DownloadControllerAndroid::kNotificationDismissed :
85 content::DownloadControllerAndroid::kActionButton);
80 // Incognito download can only be cancelled in the same browser session, no 86 // Incognito download can only be cancelled in the same browser session, no
81 // need to wait for download history. 87 // need to wait for download history.
82 if (is_off_the_record) { 88 if (is_off_the_record) {
83 CancelDownloadInternal(download_guid, true); 89 CancelDownloadInternal(download_guid, true);
84 return; 90 return;
85 } 91 }
86 92
87 if (is_history_query_complete_) 93 if (is_history_query_complete_)
88 CancelDownloadInternal(download_guid, false); 94 CancelDownloadInternal(download_guid, false);
89 else 95 else
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 resume_callback_for_testing_.Run(false); 211 resume_callback_for_testing_.Run(false);
206 } 212 }
207 213
208 content::DownloadManager* DownloadManagerService::GetDownloadManager( 214 content::DownloadManager* DownloadManagerService::GetDownloadManager(
209 bool is_off_the_record) { 215 bool is_off_the_record) {
210 Profile* profile = ProfileManager::GetActiveUserProfile(); 216 Profile* profile = ProfileManager::GetActiveUserProfile();
211 if (is_off_the_record) 217 if (is_off_the_record)
212 profile = profile->GetOffTheRecordProfile(); 218 profile = profile->GetOffTheRecordProfile();
213 return content::BrowserContext::GetDownloadManager(profile); 219 return content::BrowserContext::GetDownloadManager(profile);
214 } 220 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698