| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 media::mojom::blink::PhotoSettingsPtr settings = media::mojom::blink::PhotoS
ettings::New(); | 117 media::mojom::blink::PhotoSettingsPtr settings = media::mojom::blink::PhotoS
ettings::New(); |
| 118 settings->has_zoom = photoSettings.hasZoom(); | 118 settings->has_zoom = photoSettings.hasZoom(); |
| 119 if (settings->has_zoom) | 119 if (settings->has_zoom) |
| 120 settings->zoom = photoSettings.zoom(); | 120 settings->zoom = photoSettings.zoom(); |
| 121 settings->has_height = photoSettings.hasImageHeight(); | 121 settings->has_height = photoSettings.hasImageHeight(); |
| 122 if (settings->has_height) | 122 if (settings->has_height) |
| 123 settings->height = photoSettings.imageHeight(); | 123 settings->height = photoSettings.imageHeight(); |
| 124 settings->has_width = photoSettings.hasImageWidth(); | 124 settings->has_width = photoSettings.hasImageWidth(); |
| 125 if (settings->has_width) | 125 if (settings->has_width) |
| 126 settings->width = photoSettings.imageWidth(); | 126 settings->width = photoSettings.imageWidth(); |
| 127 settings->has_focus_mode = photoSettings.hasFocusMode(); |
| 128 if (settings->has_focus_mode) { |
| 129 if (photoSettings.focusMode() == "manual") |
| 130 settings->focus_mode = media::mojom::blink::FocusMode::MANUAL; |
| 131 else if (photoSettings.focusMode() == "single-shot") |
| 132 settings->focus_mode = media::mojom::blink::FocusMode::SINGLE_SHOT; |
| 133 else if (photoSettings.focusMode() == "continuous") |
| 134 settings->focus_mode = media::mojom::blink::FocusMode::CONTINUOUS; |
| 135 else |
| 136 settings->has_focus_mode = false; |
| 137 } |
| 127 | 138 |
| 128 m_service->SetOptions(m_streamTrack->component()->source()->id(), std::move(
settings), convertToBaseCallback(WTF::bind(&ImageCapture::onSetOptions, wrapPers
istent(this), wrapPersistent(resolver)))); | 139 m_service->SetOptions(m_streamTrack->component()->source()->id(), std::move(
settings), convertToBaseCallback(WTF::bind(&ImageCapture::onSetOptions, wrapPers
istent(this), wrapPersistent(resolver)))); |
| 129 return promise; | 140 return promise; |
| 130 } | 141 } |
| 131 | 142 |
| 132 | 143 |
| 133 ScriptPromise ImageCapture::takePhoto(ScriptState* scriptState, ExceptionState&
exceptionState) | 144 ScriptPromise ImageCapture::takePhoto(ScriptState* scriptState, ExceptionState&
exceptionState) |
| 134 { | 145 { |
| 135 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; | 146 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
| 136 ScriptPromise promise = resolver->promise(); | 147 ScriptPromise promise = resolver->promise(); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 264 |
| 254 DEFINE_TRACE(ImageCapture) | 265 DEFINE_TRACE(ImageCapture) |
| 255 { | 266 { |
| 256 visitor->trace(m_streamTrack); | 267 visitor->trace(m_streamTrack); |
| 257 visitor->trace(m_serviceRequests); | 268 visitor->trace(m_serviceRequests); |
| 258 EventTargetWithInlineData::trace(visitor); | 269 EventTargetWithInlineData::trace(visitor); |
| 259 ContextLifecycleObserver::trace(visitor); | 270 ContextLifecycleObserver::trace(visitor); |
| 260 } | 271 } |
| 261 | 272 |
| 262 } // namespace blink | 273 } // namespace blink |
| OLD | NEW |