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

Side by Side Diff: content/public/browser/android/download_controller_android.h

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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_
6 #define CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_ 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 #include "content/public/browser/download_item.h" 10 #include "content/public/browser/download_item.h"
11 #include "content/public/common/context_menu_params.h" 11 #include "content/public/common/context_menu_params.h"
12 12
13 namespace content { 13 namespace content {
14 class DownloadItem; 14 class DownloadItem;
15 class WebContents; 15 class WebContents;
16 16
17 // Interface to request GET downloads and send notifications for POST 17 // Interface to request GET downloads and send notifications for POST
18 // downloads. 18 // downloads.
19 class CONTENT_EXPORT DownloadControllerAndroid : public DownloadItem::Observer { 19 class CONTENT_EXPORT DownloadControllerAndroid : public DownloadItem::Observer {
20 public: 20 public:
21 // Returns the singleton instance of the DownloadControllerAndroid. 21 // Returns the singleton instance of the DownloadControllerAndroid.
22 static DownloadControllerAndroid* Get(); 22 static DownloadControllerAndroid* Get();
23 23
24 // Called to set the DownloadControllerAndroid instance. 24 // Called to set the DownloadControllerAndroid instance.
25 static void SetDownloadControllerAndroid( 25 static void SetDownloadControllerAndroid(
26 DownloadControllerAndroid* download_controller); 26 DownloadControllerAndroid* download_controller);
27 27
28 enum DownloadCancelReason {
Ilya Sherman 2016/06/10 21:20:43 nit: Please document that this enum is used to bac
qinmin 2016/06/11 00:13:00 Done.
29 kActionButton = 0,
30 kNotificationDismissed,
31 kOverwriteInfobarDismissed,
32 kNoStoragePermission, // new enums must be added after this.
33 kCancelReasonMax
Ilya Sherman 2016/06/10 21:20:43 nit: Also, please either define this as an enum cl
Ilya Sherman 2016/06/10 21:20:43 nit: Please use SHOUTY_CASE for enum names, per ht
qinmin 2016/06/11 00:13:00 Done.
qinmin 2016/06/11 00:13:00 Done.
34 };
35 static void RecordDownloadCancelReason(DownloadCancelReason reason);
36
28 // Starts a new download request with Android. Should be called on the 37 // Starts a new download request with Android. Should be called on the
29 // UI thread. 38 // UI thread.
30 virtual void CreateGETDownload(int render_process_id, int render_view_id, 39 virtual void CreateGETDownload(int render_process_id, int render_view_id,
31 int request_id, bool must_download) = 0; 40 int request_id, bool must_download) = 0;
32 41
33 // Should be called when a download is started. It can be either a GET 42 // Should be called when a download is started. It can be either a GET
34 // request with authentication or a POST request. Notifies the embedding 43 // request with authentication or a POST request. Notifies the embedding
35 // app about the download. Should be called on the UI thread. 44 // app about the download. Should be called on the UI thread.
36 virtual void OnDownloadStarted(DownloadItem* download_item) = 0; 45 virtual void OnDownloadStarted(DownloadItem* download_item) = 0;
37 46
(...skipping 25 matching lines...) Expand all
63 virtual void SetDefaultDownloadFileName(const std::string& file_name) {} 72 virtual void SetDefaultDownloadFileName(const std::string& file_name) {}
64 73
65 protected: 74 protected:
66 ~DownloadControllerAndroid() override {}; 75 ~DownloadControllerAndroid() override {};
67 static DownloadControllerAndroid* download_controller_; 76 static DownloadControllerAndroid* download_controller_;
68 }; 77 };
69 78
70 } // namespace content 79 } // namespace content
71 80
72 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_ 81 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698