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/text_detection_impl_mac.h" | 5 #include "services/shape_detection/text_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 13 matching lines...) Expand all Loading... |
24 } | 24 } |
25 | 25 |
26 void RunCallbackWithNoResults( | 26 void RunCallbackWithNoResults( |
27 const mojom::TextDetection::DetectCallback& callback) { | 27 const mojom::TextDetection::DetectCallback& callback) { |
28 callback.Run(std::vector<mojom::TextDetectionResultPtr>()); | 28 callback.Run(std::vector<mojom::TextDetectionResultPtr>()); |
29 } | 29 } |
30 | 30 |
31 } // anonymous namespace | 31 } // anonymous namespace |
32 | 32 |
33 // static | 33 // static |
34 void TextDetectionImpl::Create(mojom::TextDetectionRequest request) { | 34 void TextDetectionImpl::Create( |
| 35 const service_manager::BindSourceInfo& source_info, |
| 36 mojom::TextDetectionRequest request) { |
35 // Text detection needs at least MAC OS X 10.11. | 37 // Text detection needs at least MAC OS X 10.11. |
36 if (!base::mac::IsAtLeastOS10_11()) | 38 if (!base::mac::IsAtLeastOS10_11()) |
37 return; | 39 return; |
38 mojo::MakeStrongBinding(base::MakeUnique<TextDetectionImplMac>(), | 40 mojo::MakeStrongBinding(base::MakeUnique<TextDetectionImplMac>(), |
39 std::move(request)); | 41 std::move(request)); |
40 } | 42 } |
41 | 43 |
42 TextDetectionImplMac::TextDetectionImplMac() { | 44 TextDetectionImplMac::TextDetectionImplMac() { |
43 NSDictionary* const opts = @{CIDetectorAccuracy : CIDetectorAccuracyHigh}; | 45 NSDictionary* const opts = @{CIDetectorAccuracy : CIDetectorAccuracyHigh}; |
44 detector_.reset([[CIDetector detectorOfType:CIDetectorTypeText | 46 detector_.reset([[CIDetector detectorOfType:CIDetectorTypeText |
(...skipping 29 matching lines...) Expand all Loading... |
74 gfx::RectF boundingbox(f.bounds.origin.x, | 76 gfx::RectF boundingbox(f.bounds.origin.x, |
75 height - f.bounds.origin.y - f.bounds.size.height, | 77 height - f.bounds.origin.y - f.bounds.size.height, |
76 f.bounds.size.width, f.bounds.size.height); | 78 f.bounds.size.width, f.bounds.size.height); |
77 result->bounding_box = std::move(boundingbox); | 79 result->bounding_box = std::move(boundingbox); |
78 results.push_back(std::move(result)); | 80 results.push_back(std::move(result)); |
79 } | 81 } |
80 scoped_callback.Run(std::move(results)); | 82 scoped_callback.Run(std::move(results)); |
81 } | 83 } |
82 | 84 |
83 } // namespace shape_detection | 85 } // namespace shape_detection |
OLD | NEW |