| 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/shapedetection/ShapeDetector.h" | 5 #include "modules/shapedetection/ShapeDetector.h" |
| 6 | 6 |
| 7 #include "core/dom/DOMException.h" | 7 #include "core/dom/DOMException.h" |
| 8 #include "core/dom/DOMRect.h" | 8 #include "core/dom/DOMRect.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/fetch/ImageResource.h" | 10 #include "core/fetch/ImageResource.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 } | 42 } |
| 43 | 43 |
| 44 } // anonymous namespace | 44 } // anonymous namespace |
| 45 | 45 |
| 46 ShapeDetector::ShapeDetector(LocalFrame& frame) { | 46 ShapeDetector::ShapeDetector(LocalFrame& frame) { |
| 47 DCHECK(!m_service.is_bound()); | 47 DCHECK(!m_service.is_bound()); |
| 48 DCHECK(frame.interfaceProvider()); | 48 DCHECK(frame.interfaceProvider()); |
| 49 frame.interfaceProvider()->getInterface(mojo::GetProxy(&m_service)); | 49 frame.interfaceProvider()->getInterface(mojo::GetProxy(&m_service)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 ShapeDetector::ShapeDetector(LocalFrame& frame, |
| 53 const FaceDetectorOptions& options) |
| 54 : ShapeDetector(frame) { |
| 55 m_options = mojom::blink::FaceDetectorOptions::New(); |
| 56 m_options->max_detected_faces = options.maxDetectedFaces(); |
| 57 m_options->fast_mode = options.fastMode(); |
| 58 } |
| 59 |
| 52 ScriptPromise ShapeDetector::detectShapes( | 60 ScriptPromise ShapeDetector::detectShapes( |
| 53 ScriptState* scriptState, | 61 ScriptState* scriptState, |
| 54 DetectorType detectorType, | 62 DetectorType detectorType, |
| 55 const CanvasImageSourceUnion& imageSource) { | 63 const CanvasImageSourceUnion& imageSource) { |
| 56 CanvasImageSource* imageSourceInternal = toImageSourceInternal(imageSource); | 64 CanvasImageSource* imageSourceInternal = toImageSourceInternal(imageSource); |
| 57 | 65 |
| 58 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); | 66 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); |
| 59 ScriptPromise promise = resolver->promise(); | 67 ScriptPromise promise = resolver->promise(); |
| 60 | 68 |
| 61 if (!imageSourceInternal) { | 69 if (!imageSourceInternal) { |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } | 365 } |
| 358 | 366 |
| 359 resolver->resolve(detectedBarcodes); | 367 resolver->resolve(detectedBarcodes); |
| 360 } | 368 } |
| 361 | 369 |
| 362 DEFINE_TRACE(ShapeDetector) { | 370 DEFINE_TRACE(ShapeDetector) { |
| 363 visitor->trace(m_serviceRequests); | 371 visitor->trace(m_serviceRequests); |
| 364 } | 372 } |
| 365 | 373 |
| 366 } // namespace blink | 374 } // namespace blink |
| OLD | NEW |