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

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

Issue 2061063002: Add UMA for studying download cancellation reasons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
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 // UMA histogram enum for download cancellation reasons. Keep this
29 // in sync with MobileDownloadCancelReason in histograms.xml. This should be
30 // append only.
31 enum DownloadCancelReason {
32 CANCEL_REASON_NOT_CANCELED = 0,
33 CANCEL_REASON_ACTION_BUTTON,
34 CANCEL_REASON_NOTIFICATION_DISMISSED,
35 CANCEL_REASON_OVERWRITE_INFOBAR_DISMISSED,
36 CANCEL_REASON_NO_STORAGE_PERMISSION,
37 CANCEL_REASON_MAX
38 };
39 static void RecordDownloadCancelReason(DownloadCancelReason reason);
40
28 // Starts a new download request with Android. Should be called on the 41 // Starts a new download request with Android. Should be called on the
29 // UI thread. 42 // UI thread.
30 virtual void CreateGETDownload(int render_process_id, int render_view_id, 43 virtual void CreateGETDownload(int render_process_id, int render_view_id,
31 int request_id, bool must_download) = 0; 44 int request_id, bool must_download) = 0;
32 45
33 // Should be called when a download is started. It can be either a GET 46 // 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 47 // request with authentication or a POST request. Notifies the embedding
35 // app about the download. Should be called on the UI thread. 48 // app about the download. Should be called on the UI thread.
36 virtual void OnDownloadStarted(DownloadItem* download_item) = 0; 49 virtual void OnDownloadStarted(DownloadItem* download_item) = 0;
37 50
(...skipping 25 matching lines...) Expand all
63 virtual void SetDefaultDownloadFileName(const std::string& file_name) {} 76 virtual void SetDefaultDownloadFileName(const std::string& file_name) {}
64 77
65 protected: 78 protected:
66 ~DownloadControllerAndroid() override {}; 79 ~DownloadControllerAndroid() override {};
67 static DownloadControllerAndroid* download_controller_; 80 static DownloadControllerAndroid* download_controller_;
68 }; 81 };
69 82
70 } // namespace content 83 } // namespace content
71 84
72 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_ 85 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_
OLDNEW
« no previous file with comments | « content/browser/android/download_controller_android_impl.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698