Home | History | Annotate | Download | only in download
      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 // Record the total number of items and the number of in-progress items showing
      9 // in the shelf when it closes.  Set |autoclose| to true when the shelf is
     10 // closing itself, false when the user explicitly closed it.
     11 void RecordDownloadShelfClose(int size, int in_progress, bool autoclose);
     12 
     13 // Used for counting UMA stats. Similar to content's
     14 // download_stats::DownloadCountTypes but from the chrome layer.
     15 enum ChromeDownloadCountTypes {
     16   // Stale enum values left around os that values passed to UMA don't
     17   // change.
     18   CHROME_DOWNLOAD_COUNT_UNUSED_0 = 0,
     19   CHROME_DOWNLOAD_COUNT_UNUSED_1,
     20   CHROME_DOWNLOAD_COUNT_UNUSED_2,
     21   CHROME_DOWNLOAD_COUNT_UNUSED_3,
     22 
     23   // A download *would* have been initiated, but it was blocked
     24   // by the DownloadThrottlingResourceHandler.
     25   CHROME_DOWNLOAD_COUNT_BLOCKED_BY_THROTTLING,
     26 
     27   CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY
     28 };
     29 
     30 // Used for counting UMA stats. Similar to content's
     31 // download_stats::DownloadInitiattionSources but from the chrome layer.
     32 enum ChromeDownloadSource {
     33   // The download was initiated by navigating to a URL (e.g. by user click).
     34   DOWNLOAD_INITIATED_BY_NAVIGATION = 0,
     35 
     36   // The download was initiated by invoking a context menu within a page.
     37   DOWNLOAD_INITIATED_BY_CONTEXT_MENU,
     38 
     39   // The download was initiated by the WebStore installer.
     40   DOWNLOAD_INITIATED_BY_WEBSTORE_INSTALLER,
     41 
     42   // The download was initiated by the ImageBurner (cros).
     43   DOWNLOAD_INITIATED_BY_IMAGE_BURNER,
     44 
     45   // The download was initiated by the plugin installer.
     46   DOWNLOAD_INITIATED_BY_PLUGIN_INSTALLER,
     47 
     48   // The download was initiated by the PDF plugin..
     49   DOWNLOAD_INITIATED_BY_PDF_SAVE,
     50 
     51   // The download was initiated by chrome.downloads.download().
     52   DOWNLOAD_INITIATED_BY_EXTENSION,
     53 
     54   CHROME_DOWNLOAD_SOURCE_LAST_ENTRY,
     55 };
     56 
     57 // Increment one of the above counts.
     58 void RecordDownloadCount(ChromeDownloadCountTypes type);
     59 
     60 // Record initiation of a download from a specific source.
     61 void RecordDownloadSource(ChromeDownloadSource source);
     62 
     63 #endif  // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_
     64