| 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 #ifndef MediaDevices_h | 5 #ifndef MediaDevices_h |
| 6 #define MediaDevices_h | 6 #define MediaDevices_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 "core/dom/ActiveDOMObject.h" | 10 #include "core/dom/SuspendableObject.h" |
| 11 #include "core/events/EventTarget.h" | 11 #include "core/events/EventTarget.h" |
| 12 #include "modules/EventTargetModules.h" | 12 #include "modules/EventTargetModules.h" |
| 13 #include "modules/ModulesExport.h" | 13 #include "modules/ModulesExport.h" |
| 14 #include "platform/AsyncMethodRunner.h" | 14 #include "platform/AsyncMethodRunner.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 class MediaStreamConstraints; | 18 class MediaStreamConstraints; |
| 19 class MediaTrackSupportedConstraints; | 19 class MediaTrackSupportedConstraints; |
| 20 class ScriptState; | 20 class ScriptState; |
| 21 class UserMediaController; | 21 class UserMediaController; |
| 22 | 22 |
| 23 class MODULES_EXPORT MediaDevices final : public EventTargetWithInlineData, | 23 class MODULES_EXPORT MediaDevices final : public EventTargetWithInlineData, |
| 24 public ActiveScriptWrappable, | 24 public ActiveScriptWrappable, |
| 25 public ActiveDOMObject { | 25 public SuspendableObject { |
| 26 USING_GARBAGE_COLLECTED_MIXIN(MediaDevices); | 26 USING_GARBAGE_COLLECTED_MIXIN(MediaDevices); |
| 27 DEFINE_WRAPPERTYPEINFO(); | 27 DEFINE_WRAPPERTYPEINFO(); |
| 28 USING_PRE_FINALIZER(MediaDevices, dispose); | 28 USING_PRE_FINALIZER(MediaDevices, dispose); |
| 29 | 29 |
| 30 public: | 30 public: |
| 31 static MediaDevices* create(ExecutionContext*); | 31 static MediaDevices* create(ExecutionContext*); |
| 32 ~MediaDevices() override; | 32 ~MediaDevices() override; |
| 33 | 33 |
| 34 ScriptPromise enumerateDevices(ScriptState*); | 34 ScriptPromise enumerateDevices(ScriptState*); |
| 35 void getSupportedConstraints(MediaTrackSupportedConstraints& result) {} | 35 void getSupportedConstraints(MediaTrackSupportedConstraints& result) {} |
| 36 ScriptPromise getUserMedia(ScriptState*, | 36 ScriptPromise getUserMedia(ScriptState*, |
| 37 const MediaStreamConstraints&, | 37 const MediaStreamConstraints&, |
| 38 ExceptionState&); | 38 ExceptionState&); |
| 39 void didChangeMediaDevices(); | 39 void didChangeMediaDevices(); |
| 40 | 40 |
| 41 // EventTarget overrides. | 41 // EventTarget overrides. |
| 42 const AtomicString& interfaceName() const override; | 42 const AtomicString& interfaceName() const override; |
| 43 ExecutionContext* getExecutionContext() const override; | 43 ExecutionContext* getExecutionContext() const override; |
| 44 void removeAllEventListeners() override; | 44 void removeAllEventListeners() override; |
| 45 | 45 |
| 46 // ScriptWrappable | 46 // ScriptWrappable |
| 47 bool hasPendingActivity() const override; | 47 bool hasPendingActivity() const override; |
| 48 | 48 |
| 49 // ActiveDOMObject overrides. | 49 // SuspendableObject overrides. |
| 50 void contextDestroyed() override; | 50 void contextDestroyed() override; |
| 51 void suspend() override; | 51 void suspend() override; |
| 52 void resume() override; | 52 void resume() override; |
| 53 | 53 |
| 54 DECLARE_VIRTUAL_TRACE(); | 54 DECLARE_VIRTUAL_TRACE(); |
| 55 | 55 |
| 56 DEFINE_ATTRIBUTE_EVENT_LISTENER(devicechange); | 56 DEFINE_ATTRIBUTE_EVENT_LISTENER(devicechange); |
| 57 | 57 |
| 58 protected: | 58 protected: |
| 59 // EventTarget overrides. | 59 // EventTarget overrides. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 73 | 73 |
| 74 bool m_observing; | 74 bool m_observing; |
| 75 bool m_stopped; | 75 bool m_stopped; |
| 76 Member<AsyncMethodRunner<MediaDevices>> m_dispatchScheduledEventRunner; | 76 Member<AsyncMethodRunner<MediaDevices>> m_dispatchScheduledEventRunner; |
| 77 HeapVector<Member<Event>> m_scheduledEvents; | 77 HeapVector<Member<Event>> m_scheduledEvents; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 } // namespace blink | 80 } // namespace blink |
| 81 | 81 |
| 82 #endif | 82 #endif |
| OLD | NEW |