blob: 417c95157bd57e26cc0802a6cfadeaa7ed8d9702 [file] [log] [blame]
[email protected]e253ab02011-07-07 21:58:391// 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
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_PRERENDER_PRERENDER_UTIL_H_
6#define CHROME_BROWSER_PRERENDER_PRERENDER_UTIL_H_
7
8#include "base/basictypes.h"
9#include "googleurl/src/gurl.h"
10
[email protected]3e9e7a12012-12-14 02:27:4811namespace net {
12class URLRequest;
13}
14
[email protected]e253ab02011-07-07 21:58:3915namespace prerender {
16
17// ID indicating that no experiment is active.
18const uint8 kNoExperiment = 0;
19
20// Extracts a urlencoded URL stored in a url= query parameter from a URL
21// supplied, if available, and stores it in alias_url. Returns whether or not
22// the operation succeeded (i.e. a valid URL was found).
23bool MaybeGetQueryStringBasedAliasURL(const GURL& url, GURL* alias_url);
24
25// Extracts an experiment stored in the query parameter
26// lpe= from the URL supplied, and returns it.
27// Returns kNoExperiment if no experiment ID is found, or if the ID
28// is not an integer in the range 1 to 9.
29uint8 GetQueryStringBasedExperiment(const GURL& url);
30
[email protected]c97f7e662011-10-04 00:50:3631// Indicates whether the URL provided has a Google domain
32bool IsGoogleDomain(const GURL& url);
33
[email protected]2d02bea2011-08-30 23:50:5934// Indicates whether the URL provided could be a Google search result page.
35bool IsGoogleSearchResultURL(const GURL& url);
36
[email protected]66a225c2011-10-07 23:00:1037// Returns true iff the URL provided is Web URL, using the scheme http
38// or https.
39bool IsWebURL(const GURL& url);
40
[email protected]0ce625952012-03-20 22:48:1641// 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
43// iff this is the case for the experiment_id specified.
44bool IsNoSwapInExperiment(uint8 experiment_id);
45
[email protected]4a1c144c2012-06-07 17:43:0446// The prerender contents of some experiments should behave identical to the
47// control group, regardless of the field trial. This function will return true
48// iff this is the case for the experiment_id specified.
49bool IsControlGroupExperiment(uint8 experiment_id);
50
[email protected]3e9e7a12012-12-14 02:27:4851// Static method gathering stats about a URLRequest for which a response has
52// just started.
53void URLRequestResponseStarted(net::URLRequest* request);
54
[email protected]e253ab02011-07-07 21:58:3955} // namespace prerender
56
57#endif // CHROME_BROWSER_PRERENDER_PRERENDER_UTIL_H_