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

Unified Diff: third_party/WebKit/Source/core/html/HTMLMediaElementControlsList.cpp

Issue 2657723002: [Blink, Media] Added controlsList to HTMLMediaElement (Closed)
Patch Set: Rebased and readded the tests Created 3 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/html/HTMLMediaElementControlsList.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElementControlsList.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElementControlsList.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c456fbe006d785922032f71be46ec2c285cc8c76
--- /dev/null
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElementControlsList.cpp
@@ -0,0 +1,48 @@
+// Copyright 2016 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/html/HTMLMediaElementControlsList.h"
+
+#include "core/html/HTMLMediaElement.h"
+
+namespace blink {
+
+namespace {
+
+const char* kSupportedTokens[] = {"nodownload", "nofullscreen",
+ "noremoteplayback"};
+
+bool isTokenSupported(const AtomicString& token) {
mlamouri (slow - plz ping) 2017/03/03 17:32:44 Why is this an anonymous method if it's used in on
whywhat 2017/03/07 12:59:45 Done.
+ for (const char* supportedToken : kSupportedTokens) {
+ if (token == supportedToken)
+ return true;
+ }
+ return false;
+}
+
+} // namespace
+
+HTMLMediaElementControlsList::HTMLMediaElementControlsList(
+ HTMLMediaElement* element)
+ : DOMTokenList(this), m_element(element) {}
+
+HTMLMediaElementControlsList::~HTMLMediaElementControlsList() {}
mlamouri (slow - plz ping) 2017/03/03 17:32:44 = default;
whywhat 2017/03/07 12:59:46 Done.
+
+DEFINE_TRACE(HTMLMediaElementControlsList) {
+ visitor->trace(m_element);
+ DOMTokenList::trace(visitor);
+ DOMTokenListObserver::trace(visitor);
+}
+
+bool HTMLMediaElementControlsList::validateTokenValue(
+ const AtomicString& tokenValue,
+ ExceptionState&) const {
+ return isTokenSupported(tokenValue);
+}
+
+void HTMLMediaElementControlsList::valueWasSet() {
+ m_element->controlsListValueWasSet();
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698