| 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 ImageCapture_h | 5 #ifndef ImageCapture_h |
| 6 #define ImageCapture_h | 6 #define ImageCapture_h |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include "bindings/core/v8/ActiveScriptWrappable.h" | 9 #include "bindings/core/v8/ActiveScriptWrappable.h" |
| 9 #include "bindings/core/v8/ScriptPromise.h" | 10 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "core/dom/ContextLifecycleObserver.h" | 11 #include "core/dom/ContextLifecycleObserver.h" |
| 11 #include "core/events/EventTarget.h" | 12 #include "core/events/EventTarget.h" |
| 12 #include "media/capture/mojo/image_capture.mojom-blink.h" | 13 #include "media/capture/mojo/image_capture.mojom-blink.h" |
| 13 #include "modules/EventTargetModules.h" | 14 #include "modules/EventTargetModules.h" |
| 14 #include "modules/ModulesExport.h" | 15 #include "modules/ModulesExport.h" |
| 16 #include "modules/mediastream/MediaTrackCapabilities.h" |
| 15 #include "platform/AsyncMethodRunner.h" | 17 #include "platform/AsyncMethodRunner.h" |
| 16 #include <memory> | |
| 17 | 18 |
| 18 namespace blink { | 19 namespace blink { |
| 19 | 20 |
| 20 class ExceptionState; | 21 class ExceptionState; |
| 21 class MediaStreamTrack; | 22 class MediaStreamTrack; |
| 22 class PhotoSettings; | 23 class PhotoSettings; |
| 23 class ScriptPromiseResolver; | 24 class ScriptPromiseResolver; |
| 24 class WebImageCaptureFrameGrabber; | 25 class WebImageCaptureFrameGrabber; |
| 25 | 26 |
| 26 // TODO(mcasas): Consideradding a LayoutTest checking that this class is not | 27 // TODO(mcasas): Consideradding a LayoutTest checking that this class is not |
| (...skipping 24 matching lines...) Expand all Loading... |
| 51 MediaStreamTrack* videoStreamTrack() const { return m_streamTrack.get(); } | 52 MediaStreamTrack* videoStreamTrack() const { return m_streamTrack.get(); } |
| 52 | 53 |
| 53 ScriptPromise getPhotoCapabilities(ScriptState*, ExceptionState&); | 54 ScriptPromise getPhotoCapabilities(ScriptState*, ExceptionState&); |
| 54 | 55 |
| 55 ScriptPromise setOptions(ScriptState*, const PhotoSettings&, ExceptionState&); | 56 ScriptPromise setOptions(ScriptState*, const PhotoSettings&, ExceptionState&); |
| 56 | 57 |
| 57 ScriptPromise takePhoto(ScriptState*, ExceptionState&); | 58 ScriptPromise takePhoto(ScriptState*, ExceptionState&); |
| 58 | 59 |
| 59 ScriptPromise grabFrame(ScriptState*, ExceptionState&); | 60 ScriptPromise grabFrame(ScriptState*, ExceptionState&); |
| 60 | 61 |
| 62 MediaTrackCapabilities& getMediaTrackCapabilities(); |
| 63 |
| 61 DECLARE_VIRTUAL_TRACE(); | 64 DECLARE_VIRTUAL_TRACE(); |
| 62 | 65 |
| 63 private: | 66 private: |
| 64 ImageCapture(ExecutionContext*, MediaStreamTrack*); | 67 ImageCapture(ExecutionContext*, MediaStreamTrack*); |
| 65 | 68 |
| 66 void onCapabilities(ScriptPromiseResolver*, | 69 void onCapabilities(ScriptPromiseResolver*, |
| 67 media::mojom::blink::PhotoCapabilitiesPtr); | 70 media::mojom::blink::PhotoCapabilitiesPtr); |
| 68 void onSetOptions(ScriptPromiseResolver*, bool); | 71 void onSetOptions(ScriptPromiseResolver*, bool); |
| 69 void onTakePhoto(ScriptPromiseResolver*, media::mojom::blink::BlobPtr); | 72 void onTakePhoto(ScriptPromiseResolver*, media::mojom::blink::BlobPtr); |
| 73 void onCapabilitiesBootstrap(media::mojom::blink::PhotoCapabilitiesPtr); |
| 70 void onServiceConnectionError(); | 74 void onServiceConnectionError(); |
| 71 | 75 |
| 72 Member<MediaStreamTrack> m_streamTrack; | 76 Member<MediaStreamTrack> m_streamTrack; |
| 73 std::unique_ptr<WebImageCaptureFrameGrabber> m_frameGrabber; | 77 std::unique_ptr<WebImageCaptureFrameGrabber> m_frameGrabber; |
| 74 media::mojom::blink::ImageCapturePtr m_service; | 78 media::mojom::blink::ImageCapturePtr m_service; |
| 79 MediaTrackCapabilities m_capabilities; |
| 75 | 80 |
| 76 HeapHashSet<Member<ScriptPromiseResolver>> m_serviceRequests; | 81 HeapHashSet<Member<ScriptPromiseResolver>> m_serviceRequests; |
| 77 }; | 82 }; |
| 78 | 83 |
| 79 } // namespace blink | 84 } // namespace blink |
| 80 | 85 |
| 81 #endif // ImageCapture_h | 86 #endif // ImageCapture_h |
| OLD | NEW |