Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Unified Diff: Source/core/frame/UseByOriginCounter.h

Issue 986583002: Collect host of Web Component usage to send to RAPPOR (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698