| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef RemotePlayback_h | 5 #ifndef RemotePlayback_h |
| 6 #define RemotePlayback_h | 6 #define RemotePlayback_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ActiveScriptWrappable.h" | 8 #include "bindings/core/v8/ActiveScriptWrappable.h" |
| 9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "bindings/core/v8/TraceWrapperMember.h" | 10 #include "bindings/core/v8/TraceWrapperMember.h" |
| 11 #include "core/events/EventTarget.h" | 11 #include "core/events/EventTarget.h" |
| 12 #include "modules/ModulesExport.h" | 12 #include "modules/ModulesExport.h" |
| 13 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
| 14 #include "public/platform/modules/remoteplayback/WebRemotePlaybackAvailability.h
" |
| 14 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" | 15 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" |
| 15 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h" | 16 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h" |
| 16 #include "wtf/Compiler.h" | 17 #include "wtf/Compiler.h" |
| 17 #include "wtf/text/AtomicString.h" | 18 #include "wtf/text/AtomicString.h" |
| 18 #include "wtf/text/WTFString.h" | 19 #include "wtf/text/WTFString.h" |
| 19 | 20 |
| 20 namespace blink { | 21 namespace blink { |
| 21 | 22 |
| 22 class ExecutionContext; | 23 class ExecutionContext; |
| 23 class HTMLMediaElement; | 24 class HTMLMediaElement; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 friend class RemotePlaybackTest; | 78 friend class RemotePlaybackTest; |
| 78 | 79 |
| 79 explicit RemotePlayback(HTMLMediaElement&); | 80 explicit RemotePlayback(HTMLMediaElement&); |
| 80 | 81 |
| 81 // Calls the specified availability callback with the current availability. | 82 // Calls the specified availability callback with the current availability. |
| 82 // Need a void() method to post it as a task. | 83 // Need a void() method to post it as a task. |
| 83 void notifyInitialAvailability(int callbackId); | 84 void notifyInitialAvailability(int callbackId); |
| 84 | 85 |
| 85 // WebRemotePlaybackClient implementation. | 86 // WebRemotePlaybackClient implementation. |
| 86 void stateChanged(WebRemotePlaybackState) override; | 87 void stateChanged(WebRemotePlaybackState) override; |
| 87 void availabilityChanged(bool available) override; | 88 void availabilityChanged(WebRemotePlaybackAvailability) override; |
| 88 void promptCancelled() override; | 89 void promptCancelled() override; |
| 90 bool remotePlaybackAvailable() const override; |
| 89 | 91 |
| 90 // Prevent v8 from garbage collecting the availability callbacks. | 92 // Prevent v8 from garbage collecting the availability callbacks. |
| 91 // TODO(avayvod): remove when crbug.com/468240 is fixed and the references | 93 // TODO(avayvod): remove when crbug.com/468240 is fixed and the references |
| 92 // are maintained automatically. | 94 // are maintained automatically. |
| 93 void setV8ReferencesForCallbacks(v8::Isolate*, | 95 void setV8ReferencesForCallbacks(v8::Isolate*, |
| 94 const v8::Persistent<v8::Object>& wrapper); | 96 const v8::Persistent<v8::Object>& wrapper); |
| 95 | 97 |
| 96 WebRemotePlaybackState m_state; | 98 WebRemotePlaybackState m_state; |
| 97 bool m_availability; | 99 WebRemotePlaybackAvailability m_availability; |
| 98 HeapHashMap<int, TraceWrapperMember<RemotePlaybackAvailabilityCallback>> | 100 HeapHashMap<int, TraceWrapperMember<RemotePlaybackAvailabilityCallback>> |
| 99 m_availabilityCallbacks; | 101 m_availabilityCallbacks; |
| 100 Member<HTMLMediaElement> m_mediaElement; | 102 Member<HTMLMediaElement> m_mediaElement; |
| 101 Member<ScriptPromiseResolver> m_promptPromiseResolver; | 103 Member<ScriptPromiseResolver> m_promptPromiseResolver; |
| 102 }; | 104 }; |
| 103 | 105 |
| 104 } // namespace blink | 106 } // namespace blink |
| 105 | 107 |
| 106 #endif // RemotePlayback_h | 108 #endif // RemotePlayback_h |
| OLD | NEW |