1 // Copyright 2014 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.
5 #ifndef MEDIA_BASE_MEDIA_CLIENT_H_
6 #define MEDIA_BASE_MEDIA_CLIENT_H_
11 #include "media/base/key_system_info.h"
12 #include "media/base/media_export.h"
18 // Setter for the client. If a customized client is needed, it should be set
19 // early, before the client could possibly be used.
20 MEDIA_EXPORT
void SetMediaClient(MediaClient
* media_client
);
22 // Media's embedder API should only be used by media.
23 #if defined(MEDIA_IMPLEMENTATION)
24 // Getter for the client. Returns NULL if no customized client is needed.
25 MediaClient
* GetMediaClient();
28 struct MEDIA_EXPORT KeySystemInfoForUMA
{
29 KeySystemInfoForUMA(const std::string
& key_system
,
30 const std::string
& key_system_name_for_uma
,
31 bool reports_key_system_support_to_uma
);
32 ~KeySystemInfoForUMA();
34 // Concrete key system name;
35 std::string key_system
;
37 // Display name for UMA reporting. For example, the display name for
38 // "org.w3.clearkey" is "ClearKey". When providing this value, make sure to
39 // update tools/metrics/histograms/histograms.xml.
40 std::string key_system_name_for_uma
;
42 // Whether query/support statistics for |key_system| should be reported.
43 // If set to true, make sure to add a new Media.EME.KeySystemSupport.* to
44 // tools/metrics/histograms/histograms.xml. See KeySystemsSupportUMA for
45 // details on how key system query/support UMA is reported.
46 bool reports_key_system_support_to_uma
;
49 // A client interface for embedders (e.g. content/renderer) to provide
50 // customized service.
51 class MEDIA_EXPORT MediaClient
{
54 virtual ~MediaClient();
56 // Provides UMA info for key systems that SHOULD be reported to UMA, no matter
57 // whether a key system is actually supported by this client or not. Only
58 // called once per instance.
59 virtual void AddKeySystemsInfoForUMA(
60 std::vector
<KeySystemInfoForUMA
>* key_systems_info_for_uma
) = 0;
62 // Returns whether client key systems info should be updated.
63 virtual bool IsKeySystemsUpdateNeeded() = 0;
65 // Adds info for supported key systems.
66 virtual void AddSupportedKeySystems(
67 std::vector
<KeySystemInfo
>* key_systems_info
) = 0;
72 #endif // MEDIA_BASE_MEDIA_CLIENT_H_