Chromium Code Reviews| 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> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/containers/scoped_ptr_hash_map.h" | 10 #include "base/containers/scoped_ptr_hash_map.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | |
| 12 #include "media/base/cdm_factory.h" | 13 #include "media/base/cdm_factory.h" |
| 13 #include "media/base/media_export.h" | 14 #include "media/base/media_export.h" |
| 15 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" | |
| 14 #include "third_party/WebKit/public/platform/WebEncryptedMediaClient.h" | 16 #include "third_party/WebKit/public/platform/WebEncryptedMediaClient.h" |
| 15 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 17 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
| 16 | 18 |
| 17 namespace media { | 19 namespace media { |
| 18 | 20 |
| 19 class MediaPermission; | 21 class MediaPermission; |
| 20 | 22 |
| 21 class MEDIA_EXPORT WebEncryptedMediaClientImpl | 23 class MEDIA_EXPORT WebEncryptedMediaClientImpl |
| 22 : public blink::WebEncryptedMediaClient { | 24 : public blink::WebEncryptedMediaClient { |
| 23 public: | 25 public: |
| 24 WebEncryptedMediaClientImpl(scoped_ptr<CdmFactory> cdm_factory, | 26 WebEncryptedMediaClientImpl(scoped_ptr<CdmFactory> cdm_factory, |
| 25 MediaPermission* media_permission); | 27 MediaPermission* media_permission); |
| 26 virtual ~WebEncryptedMediaClientImpl(); | 28 virtual ~WebEncryptedMediaClientImpl(); |
| 27 | 29 |
| 28 // WebEncryptedMediaClient implementation. | 30 // WebEncryptedMediaClient implementation. |
| 29 virtual void requestMediaKeySystemAccess( | 31 virtual void requestMediaKeySystemAccess( |
| 30 blink::WebEncryptedMediaRequest request); | 32 blink::WebEncryptedMediaRequest request); |
| 31 | 33 |
| 34 // Create the CDM for |key_system| and |security_origin|. The caller owns | |
| 35 // the created cdm (passed back using |result|). | |
| 36 void CreateCdm(blink::WebSecurityOrigin security_origin, | |
| 37 blink::WebString key_system, | |
|
xhwang
2015/02/03 18:45:49
nit: We usually have key system before the securit
jrummell
2015/02/03 20:01:14
Done.
| |
| 38 blink::WebContentDecryptionModuleResult result); | |
| 39 | |
| 32 private: | 40 private: |
| 33 // Report usage of key system to UMA. There are 2 different counts logged: | 41 // Report usage of key system to UMA. There are 2 different counts logged: |
| 34 // 1. The key system is requested. | 42 // 1. The key system is requested. |
| 35 // 2. The requested key system and options are supported. | 43 // 2. The requested key system and options are supported. |
| 36 // Each stat is only reported once per renderer frame per key system. | 44 // Each stat is only reported once per renderer frame per key system. |
| 37 class Reporter; | 45 class Reporter; |
| 38 | 46 |
| 39 // Gets the Reporter for |key_system|. If it doesn't already exist, | 47 // Gets the Reporter for |key_system|. If it doesn't already exist, |
| 40 // create one. | 48 // create one. |
| 41 Reporter* GetReporter(const std::string& key_system); | 49 Reporter* GetReporter(const std::string& key_system); |
| 42 | 50 |
| 43 // Key system <-> Reporter map. | 51 // Key system <-> Reporter map. |
| 44 typedef base::ScopedPtrHashMap<std::string, Reporter> Reporters; | 52 typedef base::ScopedPtrHashMap<std::string, Reporter> Reporters; |
| 45 Reporters reporters_; | 53 Reporters reporters_; |
| 46 | 54 |
| 47 scoped_ptr<CdmFactory> cdm_factory_; | 55 scoped_ptr<CdmFactory> cdm_factory_; |
| 56 | |
| 57 base::WeakPtrFactory<WebEncryptedMediaClientImpl> weak_factory_; | |
| 48 }; | 58 }; |
| 49 | 59 |
| 50 } // namespace media | 60 } // namespace media |
| 51 | 61 |
| 52 #endif // MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_ | 62 #endif // MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_ |
| OLD | NEW |