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

Unified Diff: chromeos/dbus/media_analytics_client.h

Issue 2791983004: DBus MediaAnalyticsClient and media_perception pb. (Closed)
Patch Set: Fixing compile error. Created 3 years, 7 months 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: 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..9eaa1350c1c7d5e843e728312de4219e2f820863
--- /dev/null
+++ b/chromeos/dbus/media_analytics_client.h
@@ -0,0 +1,64 @@
+// 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"
+#include "chromeos/media_perception/media_perception.pb.h"
+
+namespace chromeos {
+
+// MediaAnalyticsClient is used to communicate with a media analytics process
+// running outside of Chrome.
+class CHROMEOS_EXPORT MediaAnalyticsClient : public DBusClient {
+ public:
+ // Callback type for a State proto message received from the media analytics
+ // process.
+ using StateCallback =
+ base::Callback<void(bool succeeded, const mri::State& state)>;
+ // Handler type for signal received from media analytics process. Contains a
tbarzic 2017/05/05 21:10:42 The "byte array with a serialized MediaPercetion p
Luke Sorenson 2017/05/08 19:06:08 Done.
+ // byte array with a serialized MediaPerception proto.
+ using MediaPerceptionSignalHandler =
+ base::Callback<void(const mri::MediaPerception& media_perception)>;
+ // Callback type for a Diagnostics proto message received from the media
+ // analytics process.
+ using DiagnosticsCallback =
+ base::Callback<void(bool succeeded, const mri::Diagnostics& diagnostics)>;
+
+ ~MediaAnalyticsClient() override;
+
+ // API for getting and setting the state of the media analytics process over
+ // D-Bus using a State proto.
+ virtual void State(const mri::State& state,
tbarzic 2017/05/05 21:10:42 can we have separate methods for getting and setti
Luke Sorenson 2017/05/08 19:06:08 From the perspective of the D-Bus comms, it's simp
tbarzic 2017/05/08 23:04:55 Wouldn't you need only one service that can provid
Luke Sorenson 2017/05/09 17:39:45 Okay, I see what you're saying. Done.
+ 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;
+
+ virtual void UnsetMediaPerceptionSignalHandler() = 0;
tbarzic 2017/05/08 23:04:55 suggestion: Clear/Reset instead of Unset
Luke Sorenson 2017/05/09 17:39:45 Done.
+
+ // API for getting diagnostic information from the media analytics process
+ // over D-Bus as a Diagnostics proto message.
+ virtual void GetDiagnostics(const DiagnosticsCallback& 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_

Powered by Google App Engine
This is Rietveld 408576698