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

Side by Side Diff: chromeos/dbus/media_analytics_client.h

Issue 2791983004: DBus MediaAnalyticsClient and media_perception pb. (Closed)
Patch Set: Upstart process management 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROMEOS_DBUS_MEDIA_ANALYTICS_CLIENT_H_
6 #define CHROMEOS_DBUS_MEDIA_ANALYTICS_CLIENT_H_
7
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "chromeos/chromeos_export.h"
11 #include "chromeos/dbus/dbus_client.h"
12
13 namespace chromeos {
14
15 // MediaAnalyticsClient is used to communicate with a media analytics process
16 // running outside of Chrome.
17 class CHROMEOS_EXPORT MediaAnalyticsClient : public DBusClient {
18 public:
19 using UpstartCallback = base::Callback<void(bool succeeded)>;
20 // Callback type for a State proto message received from the media analytics
21 // process.
22 using StateCallback =
23 base::Callback<void(bool succeeded, const uint8_t* bytes, size_t length)>;
24 // Handler type for signal received from media analytics process. Contains a
25 // byte array with a serialized MediaPerception proto.
26 using MediaPerceptionSignalHandler =
27 base::Callback<void(const uint8_t* bytes, size_t length)>;
28 // Callback type for a Diagnostics proto message received from the media
29 // analytics process.
30 using DiagnoticsCallback =
31 base::Callback<void(bool succeeded, const uint8_t* bytes, size_t length)>;
32
33 ~MediaAnalyticsClient() override;
34
35 // Start the analytics binary with upstart using D-Bus method call.
36 virtual void StartMediaAnalytics(const UpstartCallback& callback) = 0;
37
38 // Restart the analytics binary with upstart using D-Bus method call.
39 virtual void RestartMediaAnalytics(const UpstartCallback& callback) = 0;
40
41 // API for getting and setting the state of the media analytics process over
42 // D-Bus using a State proto.
43 virtual void State(const uint8_t* bytes,
44 size_t length,
45 const StateCallback& callback) = 0;
46
47 // Register event handler for the MediaPerception protos received as signal
48 // from the media analytics process.
49 virtual void SetMediaPerceptionSignalHandler(
50 const MediaPerceptionSignalHandler& handler) = 0;
51
52 // API for getting diagnostic information from the media analytics process
53 // over D-Bus as a Diagnostics proto message.
54 virtual void GetDiagnostics(const DiagnoticsCallback& callback) = 0;
55
56 // Factory function, creates new instance and returns ownership.
57 // For normal usage, access the singleton via DbusThreadManager::Get().
58 static MediaAnalyticsClient* Create();
59
60 protected:
61 MediaAnalyticsClient();
62
63 private:
64 DISALLOW_COPY_AND_ASSIGN(MediaAnalyticsClient);
65 };
66
67 } // namespace chromeos
68
69 #endif // CHROMEOS_DBUS_MEDIA_ANALYTICS_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698