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

Unified Diff: services/shape_detection/shape_detection_service.cc

Issue 2528743002: Shape Detection: Implement FaceDetection on Mac as out-of-process service (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: services/shape_detection/shape_detection_service.cc
diff --git a/services/shape_detection/shape_detection_service.cc b/services/shape_detection/shape_detection_service.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b24ddf4b41bd55f01a2ee8f90da93096ab6e2cf0
--- /dev/null
+++ b/services/shape_detection/shape_detection_service.cc
@@ -0,0 +1,40 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "services/shape_detection/shape_detection_service.h"
+
+#include "base/macros.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/service_context.h"
+#include "services/shape_detection/face_detection_impl.h"
+
+namespace shape_detection {
+
+std::unique_ptr<service_manager::Service> CreateShapeDetectionService() {
+ return base::MakeUnique<ShapeDetectionService>();
+}
+
+ShapeDetectionService::ShapeDetectionService() = default;
+
+ShapeDetectionService::~ShapeDetectionService() = default;
+
+void ShapeDetectionService::OnStart() {
+ ref_factory_.reset(new service_manager::ServiceContextRefFactory(
+ base::Bind(&service_manager::ServiceContext::RequestQuit,
+ base::Unretained(context()))));
+}
+
+bool ShapeDetectionService::OnConnect(
+ const service_manager::ServiceInfo& remote_info,
+ service_manager::InterfaceRegistry* registry) {
+ registry->AddInterface(base::Bind(&FaceDetectionImpl::Create));
+ return true;
+}
+
+bool ShapeDetectionService::OnStop() {
+ return true;
+}
+
+} // namespace shape_detection

Powered by Google App Engine
This is Rietveld 408576698