Chromium Code Reviews| 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 |