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

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

Issue 2791983004: DBus MediaAnalyticsClient and media_perception pb. (Closed)
Patch Set: Addressing nits. 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 #include "chromeos/media_perception/media_perception.pb.h"
13
14 namespace chromeos {
15
16 // MediaAnalyticsClient is used to communicate with a media analytics process
17 // running outside of Chrome.
18 class CHROMEOS_EXPORT MediaAnalyticsClient : public DBusClient {
19 public:
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 mri::State& state)>;
24 // Handler type for signal received from media analytics process.
25 using MediaPerceptionSignalHandler =
26 base::Callback<void(const mri::MediaPerception& media_perception)>;
27 // Callback type for a Diagnostics proto message received from the media
28 // analytics process.
29 using DiagnosticsCallback =
30 base::Callback<void(bool succeeded, const mri::Diagnostics& diagnostics)>;
31
32 ~MediaAnalyticsClient() override;
33
34 // Gets the media analytics process state.
35 virtual void GetState(const StateCallback& callback) = 0;
36
37 // Sets the media analytics process state. |state.status| is expected to be
38 // set.
39 virtual void SetState(const mri::State& state,
40 const StateCallback& callback) = 0;
41
42 // Register event handler for the MediaPerception protos received as signal
43 // from the media analytics process.
44 virtual void SetMediaPerceptionSignalHandler(
45 const MediaPerceptionSignalHandler& handler) = 0;
46
47 virtual void ClearMediaPerceptionSignalHandler() = 0;
tbarzic 2017/05/11 18:49:57 nit: add a comment that this resets the signal han
Luke Sorenson 2017/05/11 22:01:56 Done.
48
49 // API for getting diagnostic information from the media analytics process
50 // over D-Bus as a Diagnostics proto message.
51 virtual void GetDiagnostics(const DiagnosticsCallback& callback) = 0;
52
53 // Factory function, creates new instance and returns ownership.
54 // For normal usage, access the singleton via DbusThreadManager::Get().
55 static MediaAnalyticsClient* Create();
56
57 protected:
58 MediaAnalyticsClient();
59
60 private:
61 DISALLOW_COPY_AND_ASSIGN(MediaAnalyticsClient);
62 };
63
64 } // namespace chromeos
65
66 #endif // CHROMEOS_DBUS_MEDIA_ANALYTICS_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698