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

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: reillyg@ comments 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 21
21 // TODO(mcasas): Consideradding a LayoutTest checking that this class is not 22 // TODO(mcasas): Consideradding a LayoutTest checking that this class is not
22 // garbage collected while it has event listeners. 23 // garbage collected while it has event listeners.
23 class MODULES_EXPORT ImageCapture final 24 class MODULES_EXPORT ImageCapture final
24 : public EventTargetWithInlineData 25 : public EventTargetWithInlineData
(...skipping 10 matching lines...) Expand all
35 ExecutionContext* getExecutionContext() const override; 36 ExecutionContext* getExecutionContext() const override;
36 37
37 // ActiveScriptWrappable implementation. 38 // ActiveScriptWrappable implementation.
38 bool hasPendingActivity() const final; 39 bool hasPendingActivity() const final;
39 40
40 // ContextLifecycleObserver 41 // ContextLifecycleObserver
41 void contextDestroyed() override; 42 void contextDestroyed() override;
42 43
43 MediaStreamTrack* videoStreamTrack() const { return m_streamTrack.get(); } 44 MediaStreamTrack* videoStreamTrack() const { return m_streamTrack.get(); }
44 45
46 ScriptPromise takePhoto(ScriptState*, ExceptionState&);
47
45 ScriptPromise grabFrame(ScriptState*, ExceptionState&); 48 ScriptPromise grabFrame(ScriptState*, ExceptionState&);
46 49
47 DECLARE_VIRTUAL_TRACE(); 50 DECLARE_VIRTUAL_TRACE();
48 51
49 private: 52 private:
50 ImageCapture(ExecutionContext*, MediaStreamTrack*); 53 ImageCapture(ExecutionContext*, MediaStreamTrack*);
51 54
55 void onTakePhoto(ScriptPromiseResolver*, const String& mimeType, const Strin g& data);
56 void onServiceConnectionError();
57
52 // EventTarget implementation. 58 // EventTarget implementation.
53 bool addEventListenerInternal(const AtomicString& eventType, EventListener*, const EventListenerOptions&) override; 59 bool addEventListenerInternal(const AtomicString& eventType, EventListener*, const EventListenerOptions&) override;
54 60
55 Member<MediaStreamTrack> m_streamTrack; 61 Member<MediaStreamTrack> m_streamTrack;
62 mojom::blink::ImageCapturePtr m_service;
63
64 HeapHashSet<Member<ScriptPromiseResolver>> m_serviceRequests;
56 }; 65 };
57 66
58 } // namespace blink 67 } // namespace blink
59 68
60 #endif // ImageCapture_h 69 #endif // ImageCapture_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698