1 // Copyright 2013 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_KEY_SYSTEMS_SUPPORT_UMA_H_
6 #define MEDIA_BASE_KEY_SYSTEMS_SUPPORT_UMA_H_
10 #include "base/containers/scoped_ptr_hash_map.h"
14 // Key system support UMA statistics for queried key systems.
15 // 1. The key system is queried (with or without a MIME type).
16 // 2. The key system is queried with a MIME type.
17 // 3. The queried key system is supported (with or without a MIME type). This is
18 // reported when the key system is supported when queried, regardless of
19 // whether a MIME type is specified.
20 // 4. The queried key system is supported with a MIME type. This is reported
21 // when the key system is supported when queried without a MIME type
23 // Note: All 4 stats are only reported once per renderer process per key system.
24 class KeySystemsSupportUMA
{
26 KeySystemsSupportUMA();
27 ~KeySystemsSupportUMA();
29 // Adds a |key_system| for which query/support statistics are reported.
30 // If you use this function to add key system to report, make sure to update
31 // AddKeySystemSupportActions() in tools/metrics/actions/extract_actions.py.
32 void AddKeySystemToReport(const std::string
& key_system
);
34 // Reports that the |key_system| is queried. When |has_type|, also reports
35 // that the |key_system| with a MIME type is queried.
36 void ReportKeySystemQuery(const std::string
& key_system
, bool has_type
);
38 // Reports that the queried |key_system| is supported. When |has_type| (a
39 // a MIME type is specified in the query), also reports that the queried
40 // |key_system| is supported with that MIME type.
41 void ReportKeySystemSupport(const std::string
& key_system
, bool has_type
);
46 // Returns the Reporter for |key_system|. Returns NULL if |key_system| was not
47 // added for UMA reporting.
48 Reporter
* GetReporter(const std::string
& key_system
);
50 // Key system <-> Reporter map.
51 typedef base::ScopedPtrHashMap
<std::string
, Reporter
> Reporters
;
57 #endif // MEDIA_BASE_KEY_SYSTEMS_SUPPORT_UMA_H_