Update V8 to version 4.7.56.
[chromium-blink-merge.git] / media / base / key_systems_support_uma.h
blob28f334db9955e5555259f3cdbc42fa60dd08a846
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_
8 #include <string>
10 #include "base/containers/scoped_ptr_hash_map.h"
12 namespace media {
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
22 // specified.
23 // Note: All 4 stats are only reported once per renderer process per key system.
24 class KeySystemsSupportUMA {
25 public:
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);
43 private:
44 class Reporter;
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, scoped_ptr<Reporter>> Reporters;
52 Reporters reporters_;
55 } // namespace media
57 #endif // MEDIA_BASE_KEY_SYSTEMS_SUPPORT_UMA_H_