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

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

Issue 2034003002: Revert of ImageCapture: move mojom from WebKit/public to media/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 #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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if (!m_service) { 85 if (!m_service) {
86 resolver->reject(DOMException::create(NotFoundError, kNoServiceError)); 86 resolver->reject(DOMException::create(NotFoundError, kNoServiceError));
87 return promise; 87 return promise;
88 } 88 }
89 89
90 m_serviceRequests.add(resolver); 90 m_serviceRequests.add(resolver);
91 91
92 // m_streamTrack->component()->source()->id() is the renderer "name" of the camera; 92 // m_streamTrack->component()->source()->id() is the renderer "name" of the camera;
93 // TODO(mcasas) consider sending the security origin as well: 93 // TODO(mcasas) consider sending the security origin as well:
94 // scriptState->getExecutionContext()->getSecurityOrigin()->toString() 94 // scriptState->getExecutionContext()->getSecurityOrigin()->toString()
95 m_service->GetCapabilities(m_streamTrack->component()->source()->id(), creat eBaseCallback(bind<media::mojom::blink::PhotoCapabilitiesPtr>(&ImageCapture::onC apabilities, this, resolver))); 95 m_service->GetCapabilities(m_streamTrack->component()->source()->id(), creat eBaseCallback(bind<mojom::blink::PhotoCapabilitiesPtr>(&ImageCapture::onCapabili ties, this, resolver)));
96 return promise; 96 return promise;
97 } 97 }
98 98
99 ScriptPromise ImageCapture::takePhoto(ScriptState* scriptState, ExceptionState& exceptionState) 99 ScriptPromise ImageCapture::takePhoto(ScriptState* scriptState, ExceptionState& exceptionState)
100 { 100 {
101 101
102 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 102 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
103 ScriptPromise promise = resolver->promise(); 103 ScriptPromise promise = resolver->promise();
104 104
105 if (trackIsInactive(*m_streamTrack)) { 105 if (trackIsInactive(*m_streamTrack)) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 { 154 {
155 DCHECK(m_streamTrack); 155 DCHECK(m_streamTrack);
156 DCHECK(!m_service.is_bound()); 156 DCHECK(!m_service.is_bound());
157 157
158 Platform::current()->serviceRegistry()->connectToRemoteService(mojo::GetProx y(&m_service)); 158 Platform::current()->serviceRegistry()->connectToRemoteService(mojo::GetProx y(&m_service));
159 159
160 m_service.set_connection_error_handler(createBaseCallback(bind(&ImageCapture ::onServiceConnectionError, WeakPersistentThisPointer<ImageCapture>(this)))); 160 m_service.set_connection_error_handler(createBaseCallback(bind(&ImageCapture ::onServiceConnectionError, WeakPersistentThisPointer<ImageCapture>(this))));
161 161
162 } 162 }
163 163
164 void ImageCapture::onCapabilities(ScriptPromiseResolver* resolver, media::mojom: :blink::PhotoCapabilitiesPtr capabilities) 164 void ImageCapture::onCapabilities(ScriptPromiseResolver* resolver, mojom::blink: :PhotoCapabilitiesPtr capabilities)
165 { 165 {
166 DVLOG(1) << __FUNCTION__; 166 DVLOG(1) << __FUNCTION__;
167 if (!m_serviceRequests.contains(resolver)) 167 if (!m_serviceRequests.contains(resolver))
168 return; 168 return;
169 if (capabilities.is_null()) { 169 if (capabilities.is_null()) {
170 resolver->reject(DOMException::create(UnknownError, "platform error")); 170 resolver->reject(DOMException::create(UnknownError, "platform error"));
171 } else { 171 } else {
172 // Should be using a capabilities.To<PhotoCapabilities>() 172 // Should be using a capabilities.To<PhotoCapabilities>()
173 MediaSettingsRange* zoom = MediaSettingsRange::create(capabilities->zoom ->max, capabilities->zoom->min, capabilities->zoom->current); 173 MediaSettingsRange* zoom = MediaSettingsRange::create(capabilities->zoom ->max, capabilities->zoom->min, capabilities->zoom->current);
174 PhotoCapabilities* caps = PhotoCapabilities::create(); 174 PhotoCapabilities* caps = PhotoCapabilities::create();
(...skipping 27 matching lines...) Expand all
202 202
203 DEFINE_TRACE(ImageCapture) 203 DEFINE_TRACE(ImageCapture)
204 { 204 {
205 visitor->trace(m_streamTrack); 205 visitor->trace(m_streamTrack);
206 visitor->trace(m_serviceRequests); 206 visitor->trace(m_serviceRequests);
207 EventTargetWithInlineData::trace(visitor); 207 EventTargetWithInlineData::trace(visitor);
208 ContextLifecycleObserver::trace(visitor); 208 ContextLifecycleObserver::trace(visitor);
209 } 209 }
210 210
211 } // namespace blink 211 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/imagecapture/ImageCapture.h ('k') | third_party/WebKit/Source/modules/modules.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698