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

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

Issue 2887913005: Image Capture: reject applyConstraints() if there isn't any recognized member (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/LayoutTests/imagecapture/MediaStreamTrack-applyConstraints-reject.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 settings.setTorch(settings_.torch()); 559 settings.setTorch(settings_.torch());
560 } 560 }
561 561
562 bool ImageCapture::HasNonImageCaptureConstraints( 562 bool ImageCapture::HasNonImageCaptureConstraints(
563 const MediaTrackConstraints& constraints) const { 563 const MediaTrackConstraints& constraints) const {
564 if (!constraints.hasAdvanced()) 564 if (!constraints.hasAdvanced())
565 return false; 565 return false;
566 566
567 const auto& advanced_constraints = constraints.advanced(); 567 const auto& advanced_constraints = constraints.advanced();
568 for (const auto& constraint : advanced_constraints) { 568 for (const auto& constraint : advanced_constraints) {
569 if (constraint.hasWidth() || constraint.hasHeight() || 569 if (!constraint.hasWhiteBalanceMode() && !constraint.hasExposureMode() &&
570 constraint.hasAspectRatio() || constraint.hasFrameRate() || 570 !constraint.hasFocusMode() && !constraint.hasPointsOfInterest() &&
571 constraint.hasFacingMode() || constraint.hasVolume() || 571 !constraint.hasExposureCompensation() &&
572 constraint.hasSampleRate() || constraint.hasSampleSize() || 572 !constraint.hasColorTemperature() && !constraint.hasIso() &&
573 constraint.hasEchoCancellation() || constraint.hasLatency() || 573 !constraint.hasBrightness() && !constraint.hasContrast() &&
574 constraint.hasChannelCount() || constraint.hasDeviceId() || 574 !constraint.hasSaturation() && !constraint.hasSharpness() &&
575 constraint.hasGroupId() || constraint.hasVideoKind() || 575 !constraint.hasZoom() && !constraint.hasTorch()) {
576 constraint.hasDepthNear() || constraint.hasDepthFar() ||
577 constraint.hasFocalLengthX() || constraint.hasFocalLengthY() ||
578 constraint.hasMandatory() || constraint.hasOptional()) {
579 return true; 576 return true;
580 } 577 }
581 } 578 }
582 return false; 579 return false;
583 } 580 }
584 581
585 ImageCapture::ImageCapture(ExecutionContext* context, MediaStreamTrack* track) 582 ImageCapture::ImageCapture(ExecutionContext* context, MediaStreamTrack* track)
586 : ContextLifecycleObserver(context), stream_track_(track) { 583 : ContextLifecycleObserver(context), stream_track_(track) {
587 DCHECK(stream_track_); 584 DCHECK(stream_track_);
588 DCHECK(!service_.is_bound()); 585 DCHECK(!service_.is_bound());
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 visitor->Trace(capabilities_); 789 visitor->Trace(capabilities_);
793 visitor->Trace(settings_); 790 visitor->Trace(settings_);
794 visitor->Trace(current_constraints_); 791 visitor->Trace(current_constraints_);
795 visitor->Trace(photo_capabilities_); 792 visitor->Trace(photo_capabilities_);
796 visitor->Trace(service_requests_); 793 visitor->Trace(service_requests_);
797 EventTargetWithInlineData::Trace(visitor); 794 EventTargetWithInlineData::Trace(visitor);
798 ContextLifecycleObserver::Trace(visitor); 795 ContextLifecycleObserver::Trace(visitor);
799 } 796 }
800 797
801 } // namespace blink 798 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/imagecapture/MediaStreamTrack-applyConstraints-reject.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698