| 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 <memory> |
| 9 #include "bindings/core/v8/ActiveScriptWrappable.h" | 9 #include "bindings/core/v8/ActiveScriptWrappable.h" |
| 10 #include "bindings/core/v8/ScriptPromise.h" | 10 #include "bindings/core/v8/ScriptPromise.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // ScriptWrappable implementation. | 49 // ScriptWrappable implementation. |
| 50 bool HasPendingActivity() const final; | 50 bool HasPendingActivity() const final; |
| 51 | 51 |
| 52 // ContextLifecycleObserver | 52 // ContextLifecycleObserver |
| 53 void ContextDestroyed(ExecutionContext*) override; | 53 void ContextDestroyed(ExecutionContext*) override; |
| 54 | 54 |
| 55 MediaStreamTrack* videoStreamTrack() const { return stream_track_.Get(); } | 55 MediaStreamTrack* videoStreamTrack() const { return stream_track_.Get(); } |
| 56 | 56 |
| 57 ScriptPromise getPhotoCapabilities(ScriptState*); | 57 ScriptPromise getPhotoCapabilities(ScriptState*); |
| 58 | 58 |
| 59 ScriptPromise setOptions(ScriptState*, | 59 ScriptPromise setOptions(ScriptState*, const PhotoSettings&); |
| 60 const PhotoSettings&, | |
| 61 bool trigger_take_photo = false); | |
| 62 | 60 |
| 63 ScriptPromise takePhoto(ScriptState*); | 61 ScriptPromise takePhoto(ScriptState*); |
| 64 ScriptPromise takePhoto(ScriptState*, const PhotoSettings&); | |
| 65 | 62 |
| 66 ScriptPromise grabFrame(ScriptState*); | 63 ScriptPromise grabFrame(ScriptState*); |
| 67 | 64 |
| 68 MediaTrackCapabilities& GetMediaTrackCapabilities(); | 65 MediaTrackCapabilities& GetMediaTrackCapabilities(); |
| 69 void SetMediaTrackConstraints(ScriptPromiseResolver*, | 66 void SetMediaTrackConstraints(ScriptPromiseResolver*, |
| 70 const HeapVector<MediaTrackConstraintSet>&); | 67 const HeapVector<MediaTrackConstraintSet>&); |
| 71 const MediaTrackConstraintSet& GetMediaTrackConstraints() const; | 68 const MediaTrackConstraintSet& GetMediaTrackConstraints() const; |
| 72 void ClearMediaTrackConstraints(ScriptPromiseResolver*); | 69 void ClearMediaTrackConstraints(ScriptPromiseResolver*); |
| 73 void GetMediaTrackSettings(MediaTrackSettings&) const; | 70 void GetMediaTrackSettings(MediaTrackSettings&) const; |
| 74 | 71 |
| 75 // TODO(mcasas): Remove this service method, https://crbug.com/338503. | 72 // TODO(mcasas): Remove this service method, https://crbug.com/338503. |
| 76 bool HasNonImageCaptureConstraints(const MediaTrackConstraints&) const; | 73 bool HasNonImageCaptureConstraints(const MediaTrackConstraints&) const; |
| 77 | 74 |
| 78 DECLARE_VIRTUAL_TRACE(); | 75 DECLARE_VIRTUAL_TRACE(); |
| 79 | 76 |
| 80 private: | 77 private: |
| 81 ImageCapture(ExecutionContext*, MediaStreamTrack*); | 78 ImageCapture(ExecutionContext*, MediaStreamTrack*); |
| 82 | 79 |
| 83 void OnMojoPhotoCapabilities(ScriptPromiseResolver*, | 80 void OnPhotoCapabilities(ScriptPromiseResolver*, |
| 84 bool trigger_take_photo, | 81 media::mojom::blink::PhotoCapabilitiesPtr); |
| 85 media::mojom::blink::PhotoCapabilitiesPtr); | 82 void OnSetOptions(ScriptPromiseResolver*, bool); |
| 86 void OnMojoSetOptions(ScriptPromiseResolver*, | 83 void OnTakePhoto(ScriptPromiseResolver*, media::mojom::blink::BlobPtr); |
| 87 bool trigger_take_photo, | 84 void OnCapabilitiesUpdate(media::mojom::blink::PhotoCapabilitiesPtr); |
| 88 bool result); | |
| 89 void OnMojoTakePhoto(ScriptPromiseResolver*, media::mojom::blink::BlobPtr); | |
| 90 | 85 |
| 91 void UpdateMediaTrackCapabilities(media::mojom::blink::PhotoCapabilitiesPtr); | 86 void OnCapabilitiesUpdateInternal( |
| 87 const media::mojom::blink::PhotoCapabilities&); |
| 92 void OnServiceConnectionError(); | 88 void OnServiceConnectionError(); |
| 93 | 89 |
| 94 Member<MediaStreamTrack> stream_track_; | 90 Member<MediaStreamTrack> stream_track_; |
| 95 std::unique_ptr<WebImageCaptureFrameGrabber> frame_grabber_; | 91 std::unique_ptr<WebImageCaptureFrameGrabber> frame_grabber_; |
| 96 media::mojom::blink::ImageCapturePtr service_; | 92 media::mojom::blink::ImageCapturePtr service_; |
| 97 | 93 |
| 98 MediaTrackCapabilities capabilities_; | 94 MediaTrackCapabilities capabilities_; |
| 99 MediaTrackSettings settings_; | 95 MediaTrackSettings settings_; |
| 100 MediaTrackConstraintSet current_constraints_; | 96 MediaTrackConstraintSet current_constraints_; |
| 101 | 97 |
| 102 HeapHashSet<Member<ScriptPromiseResolver>> service_requests_; | 98 HeapHashSet<Member<ScriptPromiseResolver>> service_requests_; |
| 103 }; | 99 }; |
| 104 | 100 |
| 105 } // namespace blink | 101 } // namespace blink |
| 106 | 102 |
| 107 #endif // ImageCapture_h | 103 #endif // ImageCapture_h |
| OLD | NEW |