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"
19 // Setter for the client. If a customized client is needed, it should be set
20 // early, before the client could possibly be used.
21 MEDIA_EXPORT
void SetMediaClient(MediaClient
* media_client
);
23 // Media's embedder API should only be used by media.
24 #if defined(MEDIA_IMPLEMENTATION)
25 // Getter for the client. Returns NULL if no customized client is needed.
26 MEDIA_EXPORT MediaClient
* GetMediaClient();
29 struct MEDIA_EXPORT KeySystemInfoForUMA
{
30 KeySystemInfoForUMA(const std::string
& key_system
,
31 const std::string
& key_system_name_for_uma
,
32 bool reports_key_system_support_to_uma
);
33 ~KeySystemInfoForUMA();
35 // Concrete key system name;
36 std::string key_system
;
38 // Display name for UMA reporting. For example, the display name for
39 // "org.w3.clearkey" is "ClearKey". When providing this value, make sure to
40 // update tools/metrics/histograms/histograms.xml.
41 std::string key_system_name_for_uma
;
43 // Whether query/support statistics for |key_system| should be reported.
44 // If set to true, make sure to add a new Media.EME.KeySystemSupport.* to
45 // tools/metrics/histograms/histograms.xml. See KeySystemsSupportUMA for
46 // details on how key system query/support UMA is reported.
47 bool reports_key_system_support_to_uma
;
50 // A client interface for embedders (e.g. content/renderer) to provide
51 // customized service.
52 class MEDIA_EXPORT MediaClient
{
55 virtual ~MediaClient();
57 // Provides UMA info for key systems that SHOULD be reported to UMA, no matter
58 // whether a key system is actually supported by this client or not. Only
59 // called once per instance.
60 virtual void AddKeySystemsInfoForUMA(
61 std::vector
<KeySystemInfoForUMA
>* key_systems_info_for_uma
) = 0;
63 // Returns whether client key systems info should be updated.
64 virtual bool IsKeySystemsUpdateNeeded() = 0;
66 // Adds info for supported key systems.
67 virtual void AddSupportedKeySystems(
68 std::vector
<KeySystemInfo
>* key_systems_info
) = 0;
70 // Records a domain and registry of a url to a Rappor privacy-preserving
71 // metric. See: https://www.chromium.org/developers/design-documents/rappor
72 virtual void RecordRapporURL(const std::string
& metric
, const GURL
& url
) = 0;
77 #endif // MEDIA_BASE_MEDIA_CLIENT_H_