| 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*, const PhotoSettings&); | 59 ScriptPromise setOptions(ScriptState*, |
| 60 const PhotoSettings&, |
| 61 bool trigger_take_photo = false); |
| 60 | 62 |
| 61 ScriptPromise takePhoto(ScriptState*); | 63 ScriptPromise takePhoto(ScriptState*); |
| 64 ScriptPromise takePhoto(ScriptState*, const PhotoSettings&); |
| 62 | 65 |
| 63 ScriptPromise grabFrame(ScriptState*); | 66 ScriptPromise grabFrame(ScriptState*); |
| 64 | 67 |
| 65 MediaTrackCapabilities& GetMediaTrackCapabilities(); | 68 MediaTrackCapabilities& GetMediaTrackCapabilities(); |
| 66 void SetMediaTrackConstraints(ScriptPromiseResolver*, | 69 void SetMediaTrackConstraints(ScriptPromiseResolver*, |
| 67 const HeapVector<MediaTrackConstraintSet>&); | 70 const HeapVector<MediaTrackConstraintSet>&); |
| 68 const MediaTrackConstraintSet& GetMediaTrackConstraints() const; | 71 const MediaTrackConstraintSet& GetMediaTrackConstraints() const; |
| 69 void ClearMediaTrackConstraints(ScriptPromiseResolver*); | 72 void ClearMediaTrackConstraints(ScriptPromiseResolver*); |
| 70 void GetMediaTrackSettings(MediaTrackSettings&) const; | 73 void GetMediaTrackSettings(MediaTrackSettings&) const; |
| 71 | 74 |
| 72 // TODO(mcasas): Remove this service method, https://crbug.com/338503. | 75 // TODO(mcasas): Remove this service method, https://crbug.com/338503. |
| 73 bool HasNonImageCaptureConstraints(const MediaTrackConstraints&) const; | 76 bool HasNonImageCaptureConstraints(const MediaTrackConstraints&) const; |
| 74 | 77 |
| 75 DECLARE_VIRTUAL_TRACE(); | 78 DECLARE_VIRTUAL_TRACE(); |
| 76 | 79 |
| 77 private: | 80 private: |
| 78 ImageCapture(ExecutionContext*, MediaStreamTrack*); | 81 ImageCapture(ExecutionContext*, MediaStreamTrack*); |
| 79 | 82 |
| 80 void OnPhotoCapabilities(ScriptPromiseResolver*, | 83 void OnMojoPhotoCapabilities(ScriptPromiseResolver*, |
| 81 media::mojom::blink::PhotoCapabilitiesPtr); | 84 bool trigger_take_photo, |
| 82 void OnSetOptions(ScriptPromiseResolver*, bool); | 85 media::mojom::blink::PhotoCapabilitiesPtr); |
| 83 void OnTakePhoto(ScriptPromiseResolver*, media::mojom::blink::BlobPtr); | 86 void OnMojoSetOptions(ScriptPromiseResolver*, |
| 84 void OnCapabilitiesUpdate(media::mojom::blink::PhotoCapabilitiesPtr); | 87 bool trigger_take_photo, |
| 88 bool result); |
| 89 void OnMojoTakePhoto(ScriptPromiseResolver*, media::mojom::blink::BlobPtr); |
| 85 | 90 |
| 86 void OnCapabilitiesUpdateInternal( | 91 void UpdateMediaTrackCapabilities(media::mojom::blink::PhotoCapabilitiesPtr); |
| 87 const media::mojom::blink::PhotoCapabilities&); | |
| 88 void OnServiceConnectionError(); | 92 void OnServiceConnectionError(); |
| 89 | 93 |
| 90 Member<MediaStreamTrack> stream_track_; | 94 Member<MediaStreamTrack> stream_track_; |
| 91 std::unique_ptr<WebImageCaptureFrameGrabber> frame_grabber_; | 95 std::unique_ptr<WebImageCaptureFrameGrabber> frame_grabber_; |
| 92 media::mojom::blink::ImageCapturePtr service_; | 96 media::mojom::blink::ImageCapturePtr service_; |
| 93 | 97 |
| 94 MediaTrackCapabilities capabilities_; | 98 MediaTrackCapabilities capabilities_; |
| 95 MediaTrackSettings settings_; | 99 MediaTrackSettings settings_; |
| 96 MediaTrackConstraintSet current_constraints_; | 100 MediaTrackConstraintSet current_constraints_; |
| 97 | 101 |
| 98 HeapHashSet<Member<ScriptPromiseResolver>> service_requests_; | 102 HeapHashSet<Member<ScriptPromiseResolver>> service_requests_; |
| 99 }; | 103 }; |
| 100 | 104 |
| 101 } // namespace blink | 105 } // namespace blink |
| 102 | 106 |
| 103 #endif // ImageCapture_h | 107 #endif // ImageCapture_h |
| OLD | NEW |