Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / download / download_stats.h
blobcec8776a63595cb2d6f45db2d1796709b8bb33a9
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.
5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_
8 #include "content/public/browser/download_danger_type.h"
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);
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,
25 // A download *would* have been initiated, but it was blocked
26 // by the DownloadThrottlingResourceHandler.
27 CHROME_DOWNLOAD_COUNT_BLOCKED_BY_THROTTLING,
29 CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY
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,
38 // The download was initiated by invoking a context menu within a page.
39 DOWNLOAD_INITIATED_BY_CONTEXT_MENU,
41 // The download was initiated by the WebStore installer.
42 DOWNLOAD_INITIATED_BY_WEBSTORE_INSTALLER,
44 // The download was initiated by the ImageBurner (cros).
45 DOWNLOAD_INITIATED_BY_IMAGE_BURNER,
47 // The download was initiated by the plugin installer.
48 DOWNLOAD_INITIATED_BY_PLUGIN_INSTALLER,
50 // The download was initiated by the PDF plugin..
51 DOWNLOAD_INITIATED_BY_PDF_SAVE,
53 // The download was initiated by chrome.downloads.download().
54 DOWNLOAD_INITIATED_BY_EXTENSION,
56 CHROME_DOWNLOAD_SOURCE_LAST_ENTRY,
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,
66 // The download was opened using the browser bypassing the system handler.
67 DOWNLOAD_OPEN_METHOD_DEFAULT_BROWSER,
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,
73 DOWNLOAD_OPEN_METHOD_LAST_ENTRY
76 // Increment one of the above counts.
77 void RecordDownloadCount(ChromeDownloadCountTypes type);
79 // Record initiation of a download from a specific source.
80 void RecordDownloadSource(ChromeDownloadSource source);
82 // Record that a download warning was shown.
83 void RecordDangerousDownloadWarningShown(
84 content::DownloadDangerType danger_type);
86 // Record that the user opened the confirmation dialog for a dangerous download.
87 void RecordOpenedDangerousConfirmDialog(
88 content::DownloadDangerType danger_type);
90 // Record how a download was opened.
91 void RecordDownloadOpenMethod(ChromeDownloadOpenMethod open_method);
93 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_