Index: Source/core/frame/UseByOriginCounter.h |
diff --git a/Source/platform/network/ContentSecurityPolicyResponseHeaders.h b/Source/core/frame/UseByOriginCounter.h |
similarity index 60% |
copy from Source/platform/network/ContentSecurityPolicyResponseHeaders.h |
copy to Source/core/frame/UseByOriginCounter.h |
index 2ffe7c1a1787d2ebee8d7d1d38d39352a546ccb3..ae959262c2c90f96bab250152a2b8b56364cf439 100644 |
--- a/Source/platform/network/ContentSecurityPolicyResponseHeaders.h |
+++ b/Source/core/frame/UseByOriginCounter.h |
@@ -1,5 +1,5 @@ |
/* |
- * Copyright (C) 2013 Google, Inc. All rights reserved. |
+ * Copyright (C) 2015 Google, Inc. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
@@ -23,29 +23,50 @@ |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#ifndef ContentSecurityPolicyResponseHeaders_h |
-#define ContentSecurityPolicyResponseHeaders_h |
+#ifndef UseByOriginCounter_h |
+#define UseByOriginCounter_h |
-#include "platform/PlatformExport.h" |
+#include "wtf/Vector.h" |
#include "wtf/text/WTFString.h" |
namespace blink { |
-class ResourceResponse; |
+class Document; |
+class ScriptState; |
-class PLATFORM_EXPORT ContentSecurityPolicyResponseHeaders { |
+class UseByOriginCounter { |
public: |
- ContentSecurityPolicyResponseHeaders() { } |
- explicit ContentSecurityPolicyResponseHeaders(const ResourceResponse&); |
+ enum class Feature { |
+ ElementCreateShadowRoot, |
+ DocumentRegisterElement, |
- const String& contentSecurityPolicy() const { return m_contentSecurityPolicy; } |
- const String& contentSecurityPolicyReportOnly() const { return m_contentSecurityPolicyReportOnly; } |
+ NumberOfFeatures |
+ }; |
+ |
+ class Value { |
+ public: |
+ Value(); |
+ |
+ bool isEmpty() const { return !m_countBits; } |
+ void clear() { m_countBits = 0; } |
+ |
+ void count(Feature); |
+ |
+ void aggregate(Value); |
+ |
+ private: |
+ unsigned m_countBits : (unsigned)Feature::NumberOfFeatures; |
+ }; |
+ |
+ static void count(const ScriptState*, Document&, Feature); |
+ |
+ void documentDetached(Document&); |
+ void updateMeasurementsAndClear(); |
private: |
- String m_contentSecurityPolicy; |
- String m_contentSecurityPolicyReportOnly; |
+ Vector<std::pair<String, UseByOriginCounter::Value>, 1> m_originAndValues; |
}; |
-} |
+} // namespace blink |
-#endif |
+#endif // UseByOriginCounter_h |