| 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/FaceDetector.h" | 5 #include "modules/shapedetection/FaceDetector.h" |
| 6 | 6 |
| 7 #include "core/dom/DOMException.h" | 7 #include "core/dom/DOMException.h" |
| 8 #include "core/frame/LocalDOMWindow.h" | 8 #include "core/frame/LocalDOMWindow.h" |
| 9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "core/html/canvas/CanvasImageSource.h" | 10 #include "core/html/canvas/CanvasImageSource.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 FaceDetector* FaceDetector::create(ScriptState* scriptState, | 14 FaceDetector* FaceDetector::create(Document& document, |
| 15 const FaceDetectorOptions& options) { | 15 const FaceDetectorOptions& options) { |
| 16 return new FaceDetector(*scriptState->domWindow()->frame(), options); | 16 return new FaceDetector(*document.frame(), options); |
| 17 } | 17 } |
| 18 | 18 |
| 19 FaceDetector::FaceDetector(LocalFrame& frame, | 19 FaceDetector::FaceDetector(LocalFrame& frame, |
| 20 const FaceDetectorOptions& options) | 20 const FaceDetectorOptions& options) |
| 21 : ShapeDetector(frame, options) {} | 21 : ShapeDetector(frame, options) {} |
| 22 | 22 |
| 23 ScriptPromise FaceDetector::detect(ScriptState* scriptState, | 23 ScriptPromise FaceDetector::detect(ScriptState* scriptState, |
| 24 const CanvasImageSourceUnion& imageSource) { | 24 const CanvasImageSourceUnion& imageSource) { |
| 25 return detectShapes(scriptState, ShapeDetector::DetectorType::Face, | 25 return detectShapes(scriptState, ShapeDetector::DetectorType::Face, |
| 26 imageSource); | 26 imageSource); |
| 27 } | 27 } |
| 28 | 28 |
| 29 DEFINE_TRACE(FaceDetector) { | 29 DEFINE_TRACE(FaceDetector) { |
| 30 ShapeDetector::trace(visitor); | 30 ShapeDetector::trace(visitor); |
| 31 } | 31 } |
| 32 | 32 |
| 33 } // namespace blink | 33 } // namespace blink |
| OLD | NEW |