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

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

Issue 1743623002: [Experimental Framework] Make the OriginTrialContext a member of ExecutionContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nullptr crash, test that an error message was set Created 4 years, 10 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..141b7ad8757dbef1b03923f5c238fdc2d173a111
--- /dev/null
+++ b/third_party/WebKit/Source/core/origin_trials/DocumentOriginTrialContext.cpp
@@ -0,0 +1,38 @@
+// 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/dom/ExceptionCode.h"
+#include "core/html/HTMLHeadElement.h"
+#include "core/html/HTMLMetaElement.h"
+#include "platform/RuntimeEnabledFeatures.h"
+#include "platform/weborigin/SecurityOrigin.h"
+#include "public/platform/Platform.h"
+#include "wtf/CurrentTime.h"
jbroman 2016/02/29 20:41:53 several unused headers here; please include what y
iclelland 2016/03/01 21:51:41 Done.
+
+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();
+ for (HTMLMetaElement* metaElement = head ? Traversal<HTMLMetaElement>::firstChild(*head) : 0; metaElement; metaElement = Traversal<HTMLMetaElement>::nextSibling(*metaElement)) {
+ if (equalIgnoringCase(metaElement->name(), kTrialMetaTagName)) {
+ tokens.append(metaElement->content());
+ }
+ }
+ return tokens;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698