1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ 7 8 #include "content/public/browser/download_danger_type.h" 9 10 // Record the total number of items and the number of in-progress items showing 11 // in the shelf when it closes. Set |autoclose| to true when the shelf is 12 // closing itself, false when the user explicitly closed it. 13 void RecordDownloadShelfClose(int size, int in_progress, bool autoclose); 14 15 // Used for counting UMA stats. Similar to content's 16 // download_stats::DownloadCountTypes but from the chrome layer. 17 enum ChromeDownloadCountTypes { 18 // Stale enum values left around os that values passed to UMA don't 19 // change. 20 CHROME_DOWNLOAD_COUNT_UNUSED_0 = 0, 21 CHROME_DOWNLOAD_COUNT_UNUSED_1, 22 CHROME_DOWNLOAD_COUNT_UNUSED_2, 23 CHROME_DOWNLOAD_COUNT_UNUSED_3, 24 25 // A download *would* have been initiated, but it was blocked 26 // by the DownloadThrottlingResourceHandler. 27 CHROME_DOWNLOAD_COUNT_BLOCKED_BY_THROTTLING, 28 29 CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY 30 }; 31 32 // Used for counting UMA stats. Similar to content's 33 // download_stats::DownloadInitiattionSources but from the chrome layer. 34 enum ChromeDownloadSource { 35 // The download was initiated by navigating to a URL (e.g. by user click). 36 DOWNLOAD_INITIATED_BY_NAVIGATION = 0, 37 38 // The download was initiated by invoking a context menu within a page. 39 DOWNLOAD_INITIATED_BY_CONTEXT_MENU, 40 41 // The download was initiated by the WebStore installer. 42 DOWNLOAD_INITIATED_BY_WEBSTORE_INSTALLER, 43 44 // The download was initiated by the ImageBurner (cros). 45 DOWNLOAD_INITIATED_BY_IMAGE_BURNER, 46 47 // The download was initiated by the plugin installer. 48 DOWNLOAD_INITIATED_BY_PLUGIN_INSTALLER, 49 50 // The download was initiated by the PDF plugin.. 51 DOWNLOAD_INITIATED_BY_PDF_SAVE, 52 53 // The download was initiated by chrome.downloads.download(). 54 DOWNLOAD_INITIATED_BY_EXTENSION, 55 56 CHROME_DOWNLOAD_SOURCE_LAST_ENTRY, 57 }; 58 59 // How a download was opened. Note that a download could be opened multiple 60 // times. 61 enum ChromeDownloadOpenMethod { 62 // The download was opened using the platform handler. There was no special 63 // handling for this download. 64 DOWNLOAD_OPEN_METHOD_DEFAULT_PLATFORM = 0, 65 66 // The download was opened using the browser bypassing the system handler. 67 DOWNLOAD_OPEN_METHOD_DEFAULT_BROWSER, 68 69 // The user chose to open the download using the system handler even though 70 // the preferred method was to open the download using the browser. 71 DOWNLOAD_OPEN_METHOD_USER_PLATFORM, 72 73 DOWNLOAD_OPEN_METHOD_LAST_ENTRY 74 }; 75 76 // Increment one of the above counts. 77 void RecordDownloadCount(ChromeDownloadCountTypes type); 78 79 // Record initiation of a download from a specific source. 80 void RecordDownloadSource(ChromeDownloadSource source); 81 82 // Record that a download warning was shown. 83 void RecordDangerousDownloadWarningShown( 84 content::DownloadDangerType danger_type); 85 86 // Record that the user opened the confirmation dialog for a dangerous download. 87 void RecordOpenedDangerousConfirmDialog( 88 content::DownloadDangerType danger_type); 89 90 // Record how a download was opened. 91 void RecordDownloadOpenMethod(ChromeDownloadOpenMethod open_method); 92 93 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ 94