| 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 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_UTIL_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_UTIL_H_ |
| 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_UTIL_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_UTIL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "content/public/common/resource_type.h" | |
| 10 #include "url/gurl.h" | 9 #include "url/gurl.h" |
| 11 | 10 |
| 12 namespace net { | |
| 13 class HttpResponseHeaders; | |
| 14 class URLRequest; | |
| 15 } | |
| 16 | |
| 17 namespace prerender { | 11 namespace prerender { |
| 18 | 12 |
| 19 extern const char kChromeNavigateExtraDataKey[]; | 13 extern const char kChromeNavigateExtraDataKey[]; |
| 20 | 14 |
| 21 // ID indicating that no experiment is active. | 15 // ID indicating that no experiment is active. |
| 22 const uint8 kNoExperiment = 0; | 16 const uint8 kNoExperiment = 0; |
| 23 | 17 |
| 24 // Extracts a urlencoded URL stored in a url= query parameter from a URL | 18 // Extracts a urlencoded URL stored in a url= query parameter from a URL |
| 25 // supplied, if available, and stores it in alias_url. Returns whether or not | 19 // supplied, if available, and stores it in alias_url. Returns whether or not |
| 26 // the operation succeeded (i.e. a valid URL was found). | 20 // the operation succeeded (i.e. a valid URL was found). |
| (...skipping 14 matching lines...) Expand all Loading... |
| 41 // The prerender contents of some experiments should never be swapped in | 35 // The prerender contents of some experiments should never be swapped in |
| 42 // by pretending to never match on the URL. This function will return true | 36 // by pretending to never match on the URL. This function will return true |
| 43 // iff this is the case for the experiment_id specified. | 37 // iff this is the case for the experiment_id specified. |
| 44 bool IsNoSwapInExperiment(uint8 experiment_id); | 38 bool IsNoSwapInExperiment(uint8 experiment_id); |
| 45 | 39 |
| 46 // The prerender contents of some experiments should behave identical to the | 40 // The prerender contents of some experiments should behave identical to the |
| 47 // control group, regardless of the field trial. This function will return true | 41 // control group, regardless of the field trial. This function will return true |
| 48 // iff this is the case for the experiment_id specified. | 42 // iff this is the case for the experiment_id specified. |
| 49 bool IsControlGroupExperiment(uint8 experiment_id); | 43 bool IsControlGroupExperiment(uint8 experiment_id); |
| 50 | 44 |
| 51 // Called by URLRequestResponseStarted to gather data about Pagespeed headers | |
| 52 // into the Prerender.PagespeedHeader histogram. Public so it can be accessed | |
| 53 // by the unit test. | |
| 54 void GatherPagespeedData(const content::ResourceType resource_type, | |
| 55 const GURL& request_url, | |
| 56 const net::HttpResponseHeaders* response_headers); | |
| 57 | |
| 58 // Static method gathering stats about a URLRequest for which a response has | |
| 59 // just started. | |
| 60 void URLRequestResponseStarted(net::URLRequest* request); | |
| 61 | |
| 62 // Report a URL was canceled due to trying to handle an external URL. | 45 // Report a URL was canceled due to trying to handle an external URL. |
| 63 void ReportPrerenderExternalURL(); | 46 void ReportPrerenderExternalURL(); |
| 64 | 47 |
| 65 // Report a URL was canceled due to unsupported prerender scheme. | 48 // Report a URL was canceled due to unsupported prerender scheme. |
| 66 void ReportUnsupportedPrerenderScheme(const GURL& url); | 49 void ReportUnsupportedPrerenderScheme(const GURL& url); |
| 67 | 50 |
| 68 } // namespace prerender | 51 } // namespace prerender |
| 69 | 52 |
| 70 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_UTIL_H_ | 53 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_UTIL_H_ |
| OLD | NEW |