Index: services/resource_coordinator/public/cpp/resource_coordinator_interface.h |
diff --git a/services/resource_coordinator/public/cpp/resource_coordinator_interface.h b/services/resource_coordinator/public/cpp/resource_coordinator_interface.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..60828a07fea52998c0f180c0183bb21b31242d6d |
--- /dev/null |
+++ b/services/resource_coordinator/public/cpp/resource_coordinator_interface.h |
@@ -0,0 +1,46 @@ |
+// Copyright 2017 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. |
+ |
+#ifndef SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_RESOURCE_COORDINATOR_INTERFACE_H_ |
+#define SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_RESOURCE_COORDINATOR_INTERFACE_H_ |
+ |
+#include <stdint.h> |
+ |
+#include "base/macros.h" |
+#include "base/memory/weak_ptr.h" |
+#include "services/resource_coordinator/public/interfaces/coordination_unit.mojom.h" |
+ |
+namespace service_manager { |
+class Connector; |
+} |
+ |
+namespace resource_coordinator { |
+ |
+class ResourceCoordinatorInterface { |
+ public: |
+ ResourceCoordinatorInterface(service_manager::Connector* connector, |
+ const mojom::IDType& type); |
+ ~ResourceCoordinatorInterface(); |
+ |
+ const mojom::CoordinationUnitPtr& service() const { return service_; } |
+ |
+ void SendEvent(const mojom::EventType& event_type); |
+ void AddChild(const ResourceCoordinatorInterface& child); |
+ |
+ private: |
+ void ConnectToService(service_manager::Connector* connector, |
+ const mojom::IDType& type, |
+ const std::string& id); |
+ void AddChildByID( |
+ resource_coordinator::mojom::CoordinationUnitIDPtr child_id); |
+ |
+ mojom::CoordinationUnitPtr service_; |
+ base::WeakPtrFactory<ResourceCoordinatorInterface> weak_ptr_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ResourceCoordinatorInterface); |
+}; |
+ |
+} // namespace resource_coordinator |
+ |
+#endif // SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_RESOURCE_COORDINATOR_INTERFACE_H_ |