Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: third_party/WebKit/Source/modules/imagecapture/ImageCapture.h

Issue 1926873002: MediaStream Image Capture (3): Adding mojo and browser impl for dummy takePhoto(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: const auto& Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "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/ContextLifecycleObserver.h" 10 #include "core/dom/ContextLifecycleObserver.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 #include "public/platform/modules/imagecapture/image_capture.mojom-blink.h"
15 16
16 namespace blink { 17 namespace blink {
17 18
18 class ExceptionState; 19 class ExceptionState;
19 class MediaStreamTrack; 20 class MediaStreamTrack;
20 class WebImageCaptureFrameGrabber; 21 class WebImageCaptureFrameGrabber;
21 22
22 // TODO(mcasas): Consideradding a LayoutTest checking that this class is not 23 // TODO(mcasas): Consideradding a LayoutTest checking that this class is not
23 // garbage collected while it has event listeners. 24 // garbage collected while it has event listeners.
24 class MODULES_EXPORT ImageCapture final 25 class MODULES_EXPORT ImageCapture final
(...skipping 11 matching lines...) Expand all
36 ExecutionContext* getExecutionContext() const override; 37 ExecutionContext* getExecutionContext() const override;
37 38
38 // ActiveScriptWrappable implementation. 39 // ActiveScriptWrappable implementation.
39 bool hasPendingActivity() const final; 40 bool hasPendingActivity() const final;
40 41
41 // ContextLifecycleObserver 42 // ContextLifecycleObserver
42 void contextDestroyed() override; 43 void contextDestroyed() override;
43 44
44 MediaStreamTrack* videoStreamTrack() const { return m_streamTrack.get(); } 45 MediaStreamTrack* videoStreamTrack() const { return m_streamTrack.get(); }
45 46
47 ScriptPromise takePhoto(ScriptState*, ExceptionState&);
48
46 ScriptPromise grabFrame(ScriptState*, ExceptionState&); 49 ScriptPromise grabFrame(ScriptState*, ExceptionState&);
47 50
48 DECLARE_VIRTUAL_TRACE(); 51 DECLARE_VIRTUAL_TRACE();
49 52
50 private: 53 private:
51 ImageCapture(ExecutionContext*, MediaStreamTrack*); 54 ImageCapture(ExecutionContext*, MediaStreamTrack*);
52 55
56 void onTakePhoto(ScriptPromiseResolver*, const String& mimeType, mojo::WTFAr ray<uint8_t> data);
57 void onServiceConnectionError();
58
53 // EventTarget implementation. 59 // EventTarget implementation.
54 bool addEventListenerInternal(const AtomicString& eventType, EventListener*, const EventListenerOptions&) override; 60 bool addEventListenerInternal(const AtomicString& eventType, EventListener*, const EventListenerOptions&) override;
55 61
56 Member<MediaStreamTrack> m_streamTrack; 62 Member<MediaStreamTrack> m_streamTrack;
57 OwnPtr<WebImageCaptureFrameGrabber> m_frameGrabber; 63 OwnPtr<WebImageCaptureFrameGrabber> m_frameGrabber;
64 mojom::blink::ImageCapturePtr m_service;
65
66 HeapHashSet<Member<ScriptPromiseResolver>> m_serviceRequests;
58 }; 67 };
59 68
60 } // namespace blink 69 } // namespace blink
61 70
62 #endif // ImageCapture_h 71 #endif // ImageCapture_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698