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

Unified Diff: third_party/WebKit/Source/core/origin_trials/DocumentOriginTrialContext.cpp

Issue 1875593003: Revert of Store the list of trial tokens in OriginTrialContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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: third_party/WebKit/Source/core/origin_trials/DocumentOriginTrialContext.cpp
diff --git a/third_party/WebKit/Source/core/origin_trials/DocumentOriginTrialContext.cpp b/third_party/WebKit/Source/core/origin_trials/DocumentOriginTrialContext.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f43bceb75ad03fd93113aff79c62606a26fa884c
--- /dev/null
+++ b/third_party/WebKit/Source/core/origin_trials/DocumentOriginTrialContext.cpp
@@ -0,0 +1,41 @@
+// Copyright 2015 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.
+
+#include "core/origin_trials/DocumentOriginTrialContext.h"
+
+#include "core/dom/ElementTraversal.h"
+#include "core/html/HTMLHeadElement.h"
+#include "core/html/HTMLMetaElement.h"
+
+namespace blink {
+
+class Document;
+
+DocumentOriginTrialContext::DocumentOriginTrialContext(Document* document)
+ : m_parent(document)
+{
+}
+
+Vector<String> DocumentOriginTrialContext::getTokens()
+{
+ // When in a document, the tokens are provided in a meta tag
+ Vector<String> tokens;
+ HTMLHeadElement* head = m_parent->head();
+ if (head) {
+ for (HTMLMetaElement& metaElement : Traversal<HTMLMetaElement>::childrenOf(*head)) {
+ if (equalIgnoringCase(metaElement.httpEquiv(), kTrialHeaderName)) {
+ tokens.append(metaElement.content());
+ }
+ }
+ }
+ return tokens;
+}
+
+DEFINE_TRACE(DocumentOriginTrialContext)
+{
+ visitor->trace(m_parent);
+ OriginTrialContext::trace(visitor);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698