OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_ | 5 #ifndef MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_ |
6 #define MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_ | 6 #define MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_ |
7 | 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/containers/scoped_ptr_hash_map.h" |
8 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
9 #include "media/base/cdm_factory.h" | 12 #include "media/base/cdm_factory.h" |
10 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
11 #include "third_party/WebKit/public/platform/WebEncryptedMediaClient.h" | 14 #include "third_party/WebKit/public/platform/WebEncryptedMediaClient.h" |
12 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 15 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
13 | 16 |
14 namespace media { | 17 namespace media { |
15 | 18 |
16 class MEDIA_EXPORT WebEncryptedMediaClientImpl | 19 class MEDIA_EXPORT WebEncryptedMediaClientImpl |
17 : public blink::WebEncryptedMediaClient { | 20 : public blink::WebEncryptedMediaClient { |
18 public: | 21 public: |
19 WebEncryptedMediaClientImpl(scoped_ptr<CdmFactory> cdm_factory); | 22 WebEncryptedMediaClientImpl(scoped_ptr<CdmFactory> cdm_factory); |
20 virtual ~WebEncryptedMediaClientImpl(); | 23 virtual ~WebEncryptedMediaClientImpl(); |
21 | 24 |
22 // WebEncryptedMediaClient implementation. | 25 // WebEncryptedMediaClient implementation. |
23 virtual void requestMediaKeySystemAccess( | 26 virtual void requestMediaKeySystemAccess( |
24 blink::WebEncryptedMediaRequest request); | 27 blink::WebEncryptedMediaRequest request); |
25 | 28 |
26 private: | 29 private: |
| 30 // Report usage of key system to UMA. There are 2 different counts logged: |
| 31 // 1. The key system is requested. |
| 32 // 2. The requested key system and options are supported. |
| 33 // Each stat is only reported once per renderer frame per key system. |
| 34 class Reporter; |
| 35 |
| 36 // Gets the Reporter for |key_system|. If it doesn't already exist, |
| 37 // create one. |
| 38 Reporter* GetReporter(const std::string& key_system); |
| 39 |
| 40 // Key system <-> Reporter map. |
| 41 typedef base::ScopedPtrHashMap<std::string, Reporter> Reporters; |
| 42 Reporters reporters_; |
| 43 |
27 scoped_ptr<CdmFactory> cdm_factory_; | 44 scoped_ptr<CdmFactory> cdm_factory_; |
28 }; | 45 }; |
29 | 46 |
30 } // namespace media | 47 } // namespace media |
31 | 48 |
32 #endif // MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_ | 49 #endif // MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_ |
OLD | NEW |