Index: chromeos/dbus/media_analytics_client.h |
diff --git a/chromeos/dbus/media_analytics_client.h b/chromeos/dbus/media_analytics_client.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..521c826b439b16d95eeb1c25fbb20cb29c307b8c |
--- /dev/null |
+++ b/chromeos/dbus/media_analytics_client.h |
@@ -0,0 +1,69 @@ |
+// 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 CHROMEOS_DBUS_MEDIA_ANALYTICS_CLIENT_H_ |
+#define CHROMEOS_DBUS_MEDIA_ANALYTICS_CLIENT_H_ |
+ |
+#include "base/callback.h" |
+#include "base/macros.h" |
+#include "chromeos/chromeos_export.h" |
+#include "chromeos/dbus/dbus_client.h" |
+ |
+namespace chromeos { |
+ |
+// MediaAnalyticsClient is used to communicate with a media analytics process |
+// running outside of Chrome. |
+class CHROMEOS_EXPORT MediaAnalyticsClient : public DBusClient { |
+ public: |
+ using UpstartCallback = base::Callback<void(bool succeeded)>; |
+ // Callback type for a State proto message received from the media analytics |
+ // process. |
+ using StateCallback = |
+ base::Callback<void(bool succeeded, const uint8_t* bytes, size_t length)>; |
+ // Handler type for signal received from media analytics process. Contains a |
+ // byte array with a serialized MediaPerception proto. |
+ using MediaPerceptionSignalHandler = |
+ base::Callback<void(const uint8_t* bytes, size_t length)>; |
+ // Callback type for a Diagnostics proto message received from the media |
+ // analytics process. |
+ using DiagnoticsCallback = |
+ base::Callback<void(bool succeeded, const uint8_t* bytes, size_t length)>; |
+ |
+ ~MediaAnalyticsClient() override; |
+ |
+ // Start the analytics binary with upstart using D-Bus method call. |
+ virtual void StartMediaAnalytics(const UpstartCallback& callback) = 0; |
+ |
+ // Restart the analytics binary with upstart using D-Bus method call. |
+ virtual void RestartMediaAnalytics(const UpstartCallback& callback) = 0; |
+ |
+ // API for getting and setting the state of the media analytics process over |
+ // D-Bus using a State proto. |
+ virtual void State(const uint8_t* bytes, |
+ size_t length, |
+ const StateCallback& callback) = 0; |
+ |
+ // Register event handler for the MediaPerception protos received as signal |
+ // from the media analytics process. |
+ virtual void SetMediaPerceptionSignalHandler( |
+ const MediaPerceptionSignalHandler& handler) = 0; |
+ |
+ // API for getting diagnostic information from the media analytics process |
+ // over D-Bus as a Diagnostics proto message. |
+ virtual void GetDiagnostics(const DiagnoticsCallback& callback) = 0; |
+ |
+ // Factory function, creates new instance and returns ownership. |
+ // For normal usage, access the singleton via DbusThreadManager::Get(). |
+ static MediaAnalyticsClient* Create(); |
+ |
+ protected: |
+ MediaAnalyticsClient(); |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(MediaAnalyticsClient); |
+}; |
+ |
+} // namespace chromeos |
+ |
+#endif // CHROMEOS_DBUS_MEDIA_ANALYTICS_CLIENT_H_ |