| 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 void ImageCapture::ClearMediaTrackConstraints(ScriptPromiseResolver* resolver) { | 396 void ImageCapture::ClearMediaTrackConstraints(ScriptPromiseResolver* resolver) { |
| 397 current_constraints_ = MediaTrackConstraintSet(); | 397 current_constraints_ = MediaTrackConstraintSet(); |
| 398 resolver->Resolve(); | 398 resolver->Resolve(); |
| 399 | 399 |
| 400 // TODO(mcasas): Clear also any PhotoSettings that the device might have got | 400 // TODO(mcasas): Clear also any PhotoSettings that the device might have got |
| 401 // configured, for that we need to know a "default" state of the device; take | 401 // configured, for that we need to know a "default" state of the device; take |
| 402 // a snapshot upon first opening. https://crbug.com/700607. | 402 // a snapshot upon first opening. https://crbug.com/700607. |
| 403 } | 403 } |
| 404 | 404 |
| 405 void ImageCapture::GetMediaTrackSettings(MediaTrackSettings& settings) const { | 405 void ImageCapture::GetMediaTrackSettings(MediaTrackSettings& settings) const { |
| 406 // Merge any present |m_settings| members into |settings|. | 406 // Merge any present |settings_| members into |settings|. |
| 407 | 407 |
| 408 if (settings_.hasWhiteBalanceMode()) | 408 if (settings_.hasWhiteBalanceMode()) |
| 409 settings.setWhiteBalanceMode(settings_.whiteBalanceMode()); | 409 settings.setWhiteBalanceMode(settings_.whiteBalanceMode()); |
| 410 if (settings_.hasExposureMode()) | 410 if (settings_.hasExposureMode()) |
| 411 settings.setExposureMode(settings_.exposureMode()); | 411 settings.setExposureMode(settings_.exposureMode()); |
| 412 if (settings_.hasFocusMode()) | 412 if (settings_.hasFocusMode()) |
| 413 settings.setFocusMode(settings_.focusMode()); | 413 settings.setFocusMode(settings_.focusMode()); |
| 414 | 414 |
| 415 if (settings_.hasPointsOfInterest()) | 415 if (settings_.hasPointsOfInterest() && |
| 416 !settings_.pointsOfInterest().IsEmpty()) { |
| 416 settings.setPointsOfInterest(settings_.pointsOfInterest()); | 417 settings.setPointsOfInterest(settings_.pointsOfInterest()); |
| 418 } |
| 417 | 419 |
| 418 if (settings_.hasExposureCompensation()) | 420 if (settings_.hasExposureCompensation()) |
| 419 settings.setExposureCompensation(settings_.exposureCompensation()); | 421 settings.setExposureCompensation(settings_.exposureCompensation()); |
| 420 if (settings_.hasColorTemperature()) | 422 if (settings_.hasColorTemperature()) |
| 421 settings.setColorTemperature(settings_.colorTemperature()); | 423 settings.setColorTemperature(settings_.colorTemperature()); |
| 422 if (settings_.hasIso()) | 424 if (settings_.hasIso()) |
| 423 settings.setIso(settings_.iso()); | 425 settings.setIso(settings_.iso()); |
| 424 | 426 |
| 425 if (settings_.hasBrightness()) | 427 if (settings_.hasBrightness()) |
| 426 settings.setBrightness(settings_.brightness()); | 428 settings.setBrightness(settings_.brightness()); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 // mojo::StructTraits supports garbage-collected mappings, | 499 // mojo::StructTraits supports garbage-collected mappings, |
| 498 // https://crbug.com/700180. | 500 // https://crbug.com/700180. |
| 499 if (capabilities->height->min != 0 || capabilities->height->max != 0) { | 501 if (capabilities->height->min != 0 || capabilities->height->max != 0) { |
| 500 caps->SetImageHeight( | 502 caps->SetImageHeight( |
| 501 MediaSettingsRange::Create(std::move(capabilities->height))); | 503 MediaSettingsRange::Create(std::move(capabilities->height))); |
| 502 } | 504 } |
| 503 if (capabilities->width->min != 0 || capabilities->width->max != 0) { | 505 if (capabilities->width->min != 0 || capabilities->width->max != 0) { |
| 504 caps->SetImageWidth( | 506 caps->SetImageWidth( |
| 505 MediaSettingsRange::Create(std::move(capabilities->width))); | 507 MediaSettingsRange::Create(std::move(capabilities->width))); |
| 506 } | 508 } |
| 507 caps->SetFillLightMode(capabilities->fill_light_mode); | 509 |
| 510 if (!capabilities->fill_light_mode.IsEmpty()) |
| 511 caps->SetFillLightMode(capabilities->fill_light_mode); |
| 508 | 512 |
| 509 resolver->Resolve(caps); | 513 resolver->Resolve(caps); |
| 510 } | 514 } |
| 511 service_requests_.erase(resolver); | 515 service_requests_.erase(resolver); |
| 512 } | 516 } |
| 513 | 517 |
| 514 void ImageCapture::OnSetOptions(ScriptPromiseResolver* resolver, bool result) { | 518 void ImageCapture::OnSetOptions(ScriptPromiseResolver* resolver, bool result) { |
| 515 if (!service_requests_.Contains(resolver)) | 519 if (!service_requests_.Contains(resolver)) |
| 516 return; | 520 return; |
| 517 | 521 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 visitor->Trace(stream_track_); | 661 visitor->Trace(stream_track_); |
| 658 visitor->Trace(capabilities_); | 662 visitor->Trace(capabilities_); |
| 659 visitor->Trace(settings_); | 663 visitor->Trace(settings_); |
| 660 visitor->Trace(current_constraints_); | 664 visitor->Trace(current_constraints_); |
| 661 visitor->Trace(service_requests_); | 665 visitor->Trace(service_requests_); |
| 662 EventTargetWithInlineData::Trace(visitor); | 666 EventTargetWithInlineData::Trace(visitor); |
| 663 ContextLifecycleObserver::Trace(visitor); | 667 ContextLifecycleObserver::Trace(visitor); |
| 664 } | 668 } |
| 665 | 669 |
| 666 } // namespace blink | 670 } // namespace blink |
| OLD | NEW |