| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Download utilities. | 5 // Download utilities. |
| 6 | 6 |
| 7 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ | 7 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ |
| 8 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ | 8 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ |
| 9 #pragma once | 9 #pragma once |
| 10 | 10 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 bool IsSavableURL(const GURL& url); | 167 bool IsSavableURL(const GURL& url); |
| 168 | 168 |
| 169 // Record the total number of items and the number of in-progress items showing | 169 // Record the total number of items and the number of in-progress items showing |
| 170 // in the shelf when it closes. Set |autoclose| to true when the shelf is | 170 // in the shelf when it closes. Set |autoclose| to true when the shelf is |
| 171 // closing itself, false when the user explicitly closed it. | 171 // closing itself, false when the user explicitly closed it. |
| 172 void RecordShelfClose(int size, int in_progress, bool autoclose); | 172 void RecordShelfClose(int size, int in_progress, bool autoclose); |
| 173 | 173 |
| 174 // Used for counting UMA stats. Similar to content's | 174 // Used for counting UMA stats. Similar to content's |
| 175 // download_stats::DownloadCountTypes but from the chrome layer. | 175 // download_stats::DownloadCountTypes but from the chrome layer. |
| 176 enum ChromeDownloadCountTypes { | 176 enum ChromeDownloadCountTypes { |
| 177 // A download *would* have been initiated, but it was blocked |
| 178 // by the DownloadThrottlingResourceHandler. |
| 179 BLOCKED_BY_THROTTLING = 0, |
| 180 |
| 181 // The "= 2" is to get around a feature of the histogram system |
| 182 // which puts a floor of 1 for the minimum value for enum histograms |
| 183 // to allow there to be a bucket for values outside the expected range. |
| 184 // This isn't ideal since many (possibly most) enum histograms start |
| 185 // at zero, but there isn't any practical negative effect in UMA; |
| 186 // the zero value just uses the underflow bucket. However, if |
| 187 // a histogram only has one entry, it does result in a DCHECK because |
| 188 // the maximum value of the histogram is greater than the minimum value. |
| 189 // We solve this by bumping up the maximum value. This assignment |
| 190 // can be removed if any entries are added to this enum in the |
| 191 // future. |
| 192 CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY = 2 |
| 193 }; |
| 194 |
| 195 // Used for counting UMA stats. Similar to content's |
| 196 // download_stats::DownloadInitiattionSources but from the chrome layer. |
| 197 enum ChromeDownloadSource { |
| 177 // The download was initiated by navigating to a URL (e.g. by user click). | 198 // The download was initiated by navigating to a URL (e.g. by user click). |
| 178 INITIATED_BY_NAVIGATION_COUNT = 0, | 199 INITIATED_BY_NAVIGATION = 0, |
| 179 | 200 |
| 180 // The download was initiated by invoking a context menu within a page. | 201 // The download was initiated by invoking a context menu within a page. |
| 181 INITIATED_BY_CONTEXT_MENU_COUNT, | 202 INITIATED_BY_CONTEXT_MENU, |
| 182 | 203 |
| 183 // The download was initiated by the WebStore installer. | 204 // The download was initiated by the WebStore installer. |
| 184 INITIATED_BY_WEBSTORE_INSTALLER_COUNT, | 205 INITIATED_BY_WEBSTORE_INSTALLER, |
| 185 | 206 |
| 186 // The download was initiated by the ImageBurner (cros). | 207 // The download was initiated by the ImageBurner (cros). |
| 187 INITIATED_BY_IMAGE_BURNER_COUNT, | 208 INITIATED_BY_IMAGE_BURNER, |
| 188 | 209 |
| 189 DOWNLOAD_COUNT_TYPES_LAST_ENTRY, | 210 // The download was initiated by the plugin installer. |
| 211 INITIATED_BY_PLUGIN_INSTALLER, |
| 212 |
| 213 CHROME_DOWNLOAD_SOURCE_LAST_ENTRY, |
| 190 }; | 214 }; |
| 191 | 215 |
| 216 // Increment one of the above counts. |
| 192 void RecordDownloadCount(ChromeDownloadCountTypes type); | 217 void RecordDownloadCount(ChromeDownloadCountTypes type); |
| 193 | 218 |
| 219 // Record initiation of a download from a specific source. |
| 220 void RecordDownloadSource(ChromeDownloadSource source); |
| 221 |
| 194 } // namespace download_util | 222 } // namespace download_util |
| 195 | 223 |
| 196 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ | 224 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ |
| OLD | NEW |