1// Copyright (c) 2010 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 WEBKIT_GLUE_SITE_ISOLATION_METRICS_H_ 6#define WEBKIT_GLUE_SITE_ISOLATION_METRICS_H_ 7 8#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" 9 10namespace WebKit { 11class WebFrame; 12class WebURL; 13class WebURLResponse; 14} 15 16namespace webkit_glue { 17 18// Metrics to check the feasability of blocking cross-site requests that 19// a renderer shouldn't be making (in case we try to move cross-site frames 20// into their own process someday). We're erring on the side of counting more 21// mime-types then we strictly need (we'd only consider blocking cross-site 22// requests with types similar to HTML, XML, or JSON). 23class SiteIsolationMetrics { 24 public: 25 static void AddRequest(unsigned identifier, 26 WebKit::WebURLRequest::TargetType target_type); 27 static bool AllowedByAccessControlHeader( 28 WebKit::WebFrame* frame, const WebKit::WebURLResponse& response); 29 static void LogMimeTypeForCrossOriginRequest( 30 WebKit::WebFrame* frame, 31 unsigned identifier, 32 const WebKit::WebURLResponse& response); 33 static void SniffCrossOriginHTML(const WebKit::WebURL& response_url, 34 const char* data, 35 int len); 36 static void RemoveCompletedResponse(const WebKit::WebURL& response_url); 37}; 38 39} // namespace webkit_glue 40 41#endif // WEBKIT_GLUE_SITE_ISOLATION_METRICS_H_ 42