OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "services/shape_detection/barcode_detection_impl_mac.h" | 5 #include "services/shape_detection/barcode_detection_impl_mac.h" |
6 | 6 |
7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
8 #include "base/mac/scoped_cftyperef.h" | 8 #include "base/mac/scoped_cftyperef.h" |
9 #include "base/mac/sdk_forward_declarations.h" | 9 #include "base/mac/sdk_forward_declarations.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 void RunCallbackWithNoBarcodes( | 26 void RunCallbackWithNoBarcodes( |
27 const shape_detection::mojom::BarcodeDetection::DetectCallback& callback) { | 27 const shape_detection::mojom::BarcodeDetection::DetectCallback& callback) { |
28 callback.Run( | 28 callback.Run( |
29 std::vector<shape_detection::mojom::BarcodeDetectionResultPtr>()); | 29 std::vector<shape_detection::mojom::BarcodeDetectionResultPtr>()); |
30 } | 30 } |
31 | 31 |
32 } // anonymous namespace | 32 } // anonymous namespace |
33 | 33 |
34 // static | 34 // static |
35 void BarcodeDetectionImpl::Create( | 35 void BarcodeDetectionImpl::Create( |
| 36 const service_manager::BindSourceInfo& source_info, |
36 shape_detection::mojom::BarcodeDetectionRequest request) { | 37 shape_detection::mojom::BarcodeDetectionRequest request) { |
37 // Barcode detection needs at least MAC OS X 10.10. | 38 // Barcode detection needs at least MAC OS X 10.10. |
38 if (!base::mac::IsAtLeastOS10_10()) | 39 if (!base::mac::IsAtLeastOS10_10()) |
39 return; | 40 return; |
40 mojo::MakeStrongBinding(base::MakeUnique<BarcodeDetectionImplMac>(), | 41 mojo::MakeStrongBinding(base::MakeUnique<BarcodeDetectionImplMac>(), |
41 std::move(request)); | 42 std::move(request)); |
42 } | 43 } |
43 | 44 |
44 BarcodeDetectionImplMac::BarcodeDetectionImplMac() { | 45 BarcodeDetectionImplMac::BarcodeDetectionImplMac() { |
45 NSDictionary* const options = @{CIDetectorAccuracy : CIDetectorAccuracyHigh}; | 46 NSDictionary* const options = @{CIDetectorAccuracy : CIDetectorAccuracyHigh}; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 height - f.bottomRight.y); | 86 height - f.bottomRight.y); |
86 result->corner_points.emplace_back(f.bottomLeft.x, height - f.bottomLeft.y); | 87 result->corner_points.emplace_back(f.bottomLeft.x, height - f.bottomLeft.y); |
87 | 88 |
88 result->raw_value = base::SysNSStringToUTF8(f.messageString); | 89 result->raw_value = base::SysNSStringToUTF8(f.messageString); |
89 results.push_back(std::move(result)); | 90 results.push_back(std::move(result)); |
90 } | 91 } |
91 scoped_callback.Run(std::move(results)); | 92 scoped_callback.Run(std::move(results)); |
92 } | 93 } |
93 | 94 |
94 } // namespace shape_detection | 95 } // namespace shape_detection |
OLD | NEW |