summaryrefslogtreecommitdiff
path: root/chromium/chrome/common/prerender_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/chrome/common/prerender_util.h')
-rw-r--r--chromium/chrome/common/prerender_util.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/chromium/chrome/common/prerender_util.h b/chromium/chrome/common/prerender_util.h
new file mode 100644
index 00000000000..4fa1436ccb6
--- /dev/null
+++ b/chromium/chrome/common/prerender_util.h
@@ -0,0 +1,45 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_COMMON_PRERENDER_UTIL_H_
+#define CHROME_COMMON_PRERENDER_UTIL_H_
+
+#include <string>
+
+#include "chrome/common/prerender_types.h"
+
+class GURL;
+
+namespace prerender {
+extern const char kFollowOnlyWhenPrerenderShown[];
+
+// Returns true iff the scheme of the URL given is valid for prerendering.
+bool DoesURLHaveValidScheme(const GURL& url);
+
+// Returns true iff the scheme of the subresource URL given is valid for
+// prerendering.
+bool DoesSubresourceURLHaveValidScheme(const GURL& url);
+
+// Returns true iff the method given is valid for prerendering.
+bool IsValidHttpMethod(PrerenderMode prerender_mode, const std::string& method);
+
+std::string ComposeHistogramName(const std::string& prefix_type,
+ const std::string& name);
+
+// Called when a NoStatePrefetch request has received a response (including
+// redirects). May be called several times per resource, in case of redirects.
+void RecordPrefetchResponseReceived(const std::string& histogram_prefix,
+ bool is_main_resource,
+ bool is_redirect,
+ bool is_no_store);
+
+// Called when a NoStatePrefetch resource has been loaded. This is called only
+// once per resource, when all redirects have been resolved.
+void RecordPrefetchRedirectCount(const std::string& histogram_prefix,
+ bool is_main_resource,
+ int redirect_count);
+
+} // namespace prerender
+
+#endif // CHROME_COMMON_PRERENDER_UTIL_H_