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 #include "modules/imagecapture/ImageCapture.h" | 5 #include "modules/imagecapture/ImageCapture.h" |
6 | 6 |
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
9 #include "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
10 #include "core/dom/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 if (!m_service) { | 136 if (!m_service) { |
137 resolver->reject(DOMException::create(NotFoundError, kNoServiceError)); | 137 resolver->reject(DOMException::create(NotFoundError, kNoServiceError)); |
138 return promise; | 138 return promise; |
139 } | 139 } |
140 | 140 |
141 m_serviceRequests.add(resolver); | 141 m_serviceRequests.add(resolver); |
142 | 142 |
143 // m_streamTrack->component()->source()->id() is the renderer "name" of the
camera; | 143 // m_streamTrack->component()->source()->id() is the renderer "name" of the
camera; |
144 // TODO(mcasas) consider sending the security origin as well: | 144 // TODO(mcasas) consider sending the security origin as well: |
145 // scriptState->getExecutionContext()->getSecurityOrigin()->toString() | 145 // scriptState->getExecutionContext()->getSecurityOrigin()->toString() |
146 m_service->TakePhoto(m_streamTrack->component()->source()->id(), createBaseC
allback(bind<String, mojo::WTFArray<uint8_t>>(&ImageCapture::onTakePhoto, this,
resolver))); | 146 m_service->TakePhoto(m_streamTrack->component()->source()->id(), createBaseC
allback(bind<const String&, mojo::WTFArray<uint8_t>>(&ImageCapture::onTakePhoto,
this, resolver))); |
147 return promise; | 147 return promise; |
148 } | 148 } |
149 | 149 |
150 ScriptPromise ImageCapture::grabFrame(ScriptState* scriptState, ExceptionState&
exceptionState) | 150 ScriptPromise ImageCapture::grabFrame(ScriptState* scriptState, ExceptionState&
exceptionState) |
151 { | 151 { |
152 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; | 152 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
153 ScriptPromise promise = resolver->promise(); | 153 ScriptPromise promise = resolver->promise(); |
154 | 154 |
155 if (trackIsInactive(*m_streamTrack)) { | 155 if (trackIsInactive(*m_streamTrack)) { |
156 resolver->reject(DOMException::create(InvalidStateError, "The associated
Track is in an invalid state.")); | 156 resolver->reject(DOMException::create(InvalidStateError, "The associated
Track is in an invalid state.")); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 DEFINE_TRACE(ImageCapture) | 241 DEFINE_TRACE(ImageCapture) |
242 { | 242 { |
243 visitor->trace(m_streamTrack); | 243 visitor->trace(m_streamTrack); |
244 visitor->trace(m_serviceRequests); | 244 visitor->trace(m_serviceRequests); |
245 EventTargetWithInlineData::trace(visitor); | 245 EventTargetWithInlineData::trace(visitor); |
246 ContextLifecycleObserver::trace(visitor); | 246 ContextLifecycleObserver::trace(visitor); |
247 } | 247 } |
248 | 248 |
249 } // namespace blink | 249 } // namespace blink |
OLD | NEW |