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

Unified Diff: third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp

Issue 2819653003: Image Capture: Reject applyConstraints() if passed an unsupported constraint (Closed)
Patch Set: reillyg@s comments Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/imagecapture/MediaStreamTrack-getCapabilities.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp
diff --git a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp
index 3473914b5ccdff6c4fbefd2446612565d5ad22c8..ca93ddcc4e328f35a9444acc7adc1d5b65b32c80 100644
--- a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp
+++ b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp
@@ -261,6 +261,26 @@ void ImageCapture::SetMediaTrackConstraints(
// TODO(mcasas): add support more than one single advanced constraint.
const auto constraints = constraints_vector[0];
+ if ((constraints.hasWhiteBalanceMode() &&
+ !capabilities_.hasWhiteBalanceMode()) ||
+ (constraints.hasExposureMode() && !capabilities_.hasExposureMode()) ||
+ (constraints.hasFocusMode() && !capabilities_.hasFocusMode()) ||
+ (constraints.hasExposureCompensation() &&
+ !capabilities_.hasExposureCompensation()) ||
+ (constraints.hasColorTemperature() &&
+ !capabilities_.hasColorTemperature()) ||
+ (constraints.hasIso() && !capabilities_.hasIso()) ||
+ (constraints.hasBrightness() && !capabilities_.hasBrightness()) ||
+ (constraints.hasContrast() && !capabilities_.hasContrast()) ||
+ (constraints.hasSaturation() && !capabilities_.hasSaturation()) ||
+ (constraints.hasSharpness() && !capabilities_.hasSharpness()) ||
+ (constraints.hasZoom() && !capabilities_.hasZoom()) ||
+ (constraints.hasTorch() && !capabilities_.hasTorch())) {
+ resolver->Reject(
+ DOMException::Create(kNotSupportedError, "Unsupported constraint(s)"));
+ return;
+ }
+
auto settings = media::mojom::blink::PhotoSettings::New();
// TODO(mcasas): support other Mode types beyond simple string i.e. the
« no previous file with comments | « third_party/WebKit/LayoutTests/imagecapture/MediaStreamTrack-getCapabilities.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698