OLD | NEW |
| (Empty) |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "core/html/HTMLMediaElementControlsList.h" | |
6 | |
7 #include "core/html/HTMLMediaElement.h" | |
8 | |
9 namespace blink { | |
10 | |
11 namespace { | |
12 | |
13 const char kNoDownload[] = "nodownload"; | |
14 const char kNoFullscreen[] = "nofullscreen"; | |
15 const char kNoRemotePlayback[] = "noremoteplayback"; | |
16 | |
17 const char* kSupportedTokens[] = {kNoDownload, kNoFullscreen, | |
18 kNoRemotePlayback}; | |
19 | |
20 } // namespace | |
21 | |
22 HTMLMediaElementControlsList::HTMLMediaElementControlsList( | |
23 HTMLMediaElement* element) | |
24 : DOMTokenList(this), m_element(element) {} | |
25 | |
26 HTMLMediaElementControlsList::~HTMLMediaElementControlsList() = default; | |
27 | |
28 DEFINE_TRACE(HTMLMediaElementControlsList) { | |
29 visitor->trace(m_element); | |
30 DOMTokenList::trace(visitor); | |
31 DOMTokenListObserver::trace(visitor); | |
32 } | |
33 | |
34 bool HTMLMediaElementControlsList::validateTokenValue( | |
35 const AtomicString& tokenValue, | |
36 ExceptionState&) const { | |
37 for (const char* supportedToken : kSupportedTokens) { | |
38 if (tokenValue == supportedToken) | |
39 return true; | |
40 } | |
41 return false; | |
42 } | |
43 | |
44 void HTMLMediaElementControlsList::valueWasSet() { | |
45 m_element->controlsListValueWasSet(); | |
46 } | |
47 | |
48 bool HTMLMediaElementControlsList::shouldHideDownload() const { | |
49 return tokens().contains(kNoDownload); | |
50 } | |
51 | |
52 bool HTMLMediaElementControlsList::shouldHideFullscreen() const { | |
53 return tokens().contains(kNoFullscreen); | |
54 } | |
55 | |
56 bool HTMLMediaElementControlsList::shouldHideRemotePlayback() const { | |
57 return tokens().contains(kNoRemotePlayback); | |
58 } | |
59 | |
60 } // namespace blink | |
OLD | NEW |