summaryrefslogtreecommitdiffstats
path: root/webkit/glue/site_isolation_metrics.h
blob: c2bd275d69dcae555920e921ba833d03a8a7baf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (c) 2010 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 WEBKIT_GLUE_SITE_ISOLATION_METRICS_H_
#define WEBKIT_GLUE_SITE_ISOLATION_METRICS_H_

#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h"

namespace WebKit {
class WebFrame;
class WebURL;
class WebURLResponse;
}

namespace webkit_glue {

// Metrics to check the feasability of blocking cross-site requests that
// a renderer shouldn't be making (in case we try to move cross-site frames
// into their own process someday). We're erring on the side of counting more
// mime-types then we strictly need (we'd only consider blocking cross-site
// requests with types similar to HTML, XML, or JSON).
class SiteIsolationMetrics {
 public:
  static void AddRequest(unsigned identifier,
                         WebKit::WebURLRequest::TargetType target_type);
  static bool AllowedByAccessControlHeader(
      WebKit::WebFrame* frame, const WebKit::WebURLResponse& response);
  static void LogMimeTypeForCrossOriginRequest(
      WebKit::WebFrame* frame,
      unsigned identifier,
      const WebKit::WebURLResponse& response);
  static void SniffCrossOriginHTML(const WebKit::WebURL& response_url,
                                   const char* data,
                                   int len);
  static void RemoveCompletedResponse(const WebKit::WebURL& response_url);
};

}  // namespace webkit_glue

#endif  // WEBKIT_GLUE_SITE_ISOLATION_METRICS_H_