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

Side by Side Diff: third_party/WebKit/Source/modules/shapedetection/BarcodeDetector.cpp

Issue 2928413002: Add RectF and PointF typemaps in blink. (Closed)
Patch Set: address comment Created 3 years, 6 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 | « no previous file | third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp » ('j') | 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/shapedetection/BarcodeDetector.h" 5 #include "modules/shapedetection/BarcodeDetector.h"
6 6
7 #include "core/dom/DOMException.h" 7 #include "core/dom/DOMException.h"
8 #include "core/geometry/DOMRect.h" 8 #include "core/geometry/DOMRect.h"
9 #include "core/html/canvas/CanvasImageSource.h" 9 #include "core/html/canvas/CanvasImageSource.h"
10 #include "modules/imagecapture/Point2D.h" 10 #include "modules/imagecapture/Point2D.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 Vector<shape_detection::mojom::blink::BarcodeDetectionResultPtr> 47 Vector<shape_detection::mojom::blink::BarcodeDetectionResultPtr>
48 barcode_detection_results) { 48 barcode_detection_results) {
49 DCHECK(barcode_service_requests_.Contains(resolver)); 49 DCHECK(barcode_service_requests_.Contains(resolver));
50 barcode_service_requests_.erase(resolver); 50 barcode_service_requests_.erase(resolver);
51 51
52 HeapVector<Member<DetectedBarcode>> detected_barcodes; 52 HeapVector<Member<DetectedBarcode>> detected_barcodes;
53 for (const auto& barcode : barcode_detection_results) { 53 for (const auto& barcode : barcode_detection_results) {
54 HeapVector<Point2D> corner_points; 54 HeapVector<Point2D> corner_points;
55 for (const auto& corner_point : barcode->corner_points) { 55 for (const auto& corner_point : barcode->corner_points) {
56 Point2D point; 56 Point2D point;
57 point.setX(corner_point->x); 57 point.setX(corner_point.x);
58 point.setY(corner_point->y); 58 point.setY(corner_point.y);
59 corner_points.push_back(point); 59 corner_points.push_back(point);
60 } 60 }
61 detected_barcodes.push_back(DetectedBarcode::Create( 61 detected_barcodes.push_back(DetectedBarcode::Create(
62 barcode->raw_value, 62 barcode->raw_value,
63 DOMRect::Create(barcode->bounding_box->x, barcode->bounding_box->y, 63 DOMRect::Create(barcode->bounding_box.x, barcode->bounding_box.y,
64 barcode->bounding_box->width, 64 barcode->bounding_box.width,
65 barcode->bounding_box->height), 65 barcode->bounding_box.height),
66 corner_points)); 66 corner_points));
67 } 67 }
68 68
69 resolver->Resolve(detected_barcodes); 69 resolver->Resolve(detected_barcodes);
70 } 70 }
71 71
72 void BarcodeDetector::OnBarcodeServiceConnectionError() { 72 void BarcodeDetector::OnBarcodeServiceConnectionError() {
73 for (const auto& request : barcode_service_requests_) { 73 for (const auto& request : barcode_service_requests_) {
74 request->Reject(DOMException::Create(kNotSupportedError, 74 request->Reject(DOMException::Create(kNotSupportedError,
75 "Barcode Detection not implemented.")); 75 "Barcode Detection not implemented."));
76 } 76 }
77 barcode_service_requests_.clear(); 77 barcode_service_requests_.clear();
78 barcode_service_.reset(); 78 barcode_service_.reset();
79 } 79 }
80 80
81 DEFINE_TRACE(BarcodeDetector) { 81 DEFINE_TRACE(BarcodeDetector) {
82 ShapeDetector::Trace(visitor); 82 ShapeDetector::Trace(visitor);
83 visitor->Trace(barcode_service_requests_); 83 visitor->Trace(barcode_service_requests_);
84 } 84 }
85 85
86 } // namespace blink 86 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698