OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/remoteplayback/HTMLMediaElementRemotePlayback.h" | 5 #include "modules/remoteplayback/HTMLMediaElementRemotePlayback.h" |
6 | 6 |
7 #include "core/dom/DOMException.h" | 7 #include "core/dom/DOMException.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/dom/QualifiedName.h" | 9 #include "core/dom/QualifiedName.h" |
10 #include "core/html/HTMLMediaElement.h" | 10 #include "core/html/HTMLMediaElement.h" |
11 #include "modules/remoteplayback/RemotePlayback.h" | 11 #include "modules/remoteplayback/RemotePlayback.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 // static | 15 // static |
16 bool HTMLMediaElementRemotePlayback::fastHasAttribute( | 16 bool HTMLMediaElementRemotePlayback::fastHasAttribute( |
17 const QualifiedName& name, | 17 const QualifiedName& name, |
18 const HTMLMediaElement& element) { | 18 const HTMLMediaElement& element) { |
19 ASSERT(name == HTMLNames::disableremoteplaybackAttr); | 19 ASSERT(name == HTMLNames::disableremoteplaybackAttr); |
20 return element.fastHasAttribute(name); | 20 return element.fastHasAttribute(name); |
21 } | 21 } |
22 | 22 |
23 // static | 23 // static |
24 void HTMLMediaElementRemotePlayback::setBooleanAttribute( | 24 void HTMLMediaElementRemotePlayback::setBooleanAttribute( |
25 const QualifiedName& name, | 25 const QualifiedName& name, |
26 HTMLMediaElement& element, | 26 HTMLMediaElement& element, |
27 bool value) { | 27 bool value) { |
28 ASSERT(name == HTMLNames::disableremoteplaybackAttr); | 28 ASSERT(name == HTMLNames::disableremoteplaybackAttr); |
29 element.setBooleanAttribute(name, value); | 29 element.setBooleanAttribute(name, value); |
| 30 |
| 31 HTMLMediaElementRemotePlayback& self = |
| 32 HTMLMediaElementRemotePlayback::from(element); |
| 33 if (self.m_remote && value) |
| 34 self.m_remote->remotePlaybackDisabled(); |
30 } | 35 } |
31 | 36 |
32 // static | 37 // static |
33 HTMLMediaElementRemotePlayback& HTMLMediaElementRemotePlayback::from( | 38 HTMLMediaElementRemotePlayback& HTMLMediaElementRemotePlayback::from( |
34 HTMLMediaElement& element) { | 39 HTMLMediaElement& element) { |
35 HTMLMediaElementRemotePlayback* supplement = | 40 HTMLMediaElementRemotePlayback* supplement = |
36 static_cast<HTMLMediaElementRemotePlayback*>( | 41 static_cast<HTMLMediaElementRemotePlayback*>( |
37 Supplement<HTMLMediaElement>::from(element, supplementName())); | 42 Supplement<HTMLMediaElement>::from(element, supplementName())); |
38 if (!supplement) { | 43 if (!supplement) { |
39 supplement = new HTMLMediaElementRemotePlayback(); | 44 supplement = new HTMLMediaElementRemotePlayback(); |
(...skipping 22 matching lines...) Expand all Loading... |
62 const char* HTMLMediaElementRemotePlayback::supplementName() { | 67 const char* HTMLMediaElementRemotePlayback::supplementName() { |
63 return "HTMLMediaElementRemotePlayback"; | 68 return "HTMLMediaElementRemotePlayback"; |
64 } | 69 } |
65 | 70 |
66 DEFINE_TRACE(HTMLMediaElementRemotePlayback) { | 71 DEFINE_TRACE(HTMLMediaElementRemotePlayback) { |
67 visitor->trace(m_remote); | 72 visitor->trace(m_remote); |
68 Supplement<HTMLMediaElement>::trace(visitor); | 73 Supplement<HTMLMediaElement>::trace(visitor); |
69 } | 74 } |
70 | 75 |
71 } // namespace blink | 76 } // namespace blink |
OLD | NEW |