| 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/callback.h" |
| 10 #include "base/containers/scoped_ptr_hash_map.h" | 11 #include "base/containers/scoped_ptr_hash_map.h" |
| 11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "build/build_config.h" |
| 13 #include "media/base/media_export.h" | 15 #include "media/base/media_export.h" |
| 14 #include "media/blink/key_system_config_selector.h" | 16 #include "media/blink/key_system_config_selector.h" |
| 15 #include "third_party/WebKit/public/platform/WebEncryptedMediaClient.h" | 17 #include "third_party/WebKit/public/platform/WebEncryptedMediaClient.h" |
| 16 | 18 |
| 17 namespace blink { | 19 namespace blink { |
| 18 | 20 |
| 19 class WebContentDecryptionModuleResult; | 21 class WebContentDecryptionModuleResult; |
| 20 struct WebMediaKeySystemConfiguration; | 22 struct WebMediaKeySystemConfiguration; |
| 21 class WebSecurityOrigin; | 23 class WebSecurityOrigin; |
| 22 | 24 |
| 23 } // namespace blink | 25 } // namespace blink |
| 24 | 26 |
| 25 namespace media { | 27 namespace media { |
| 26 | 28 |
| 27 class CdmFactory; | 29 class CdmFactory; |
| 28 class KeySystems; | 30 class KeySystems; |
| 29 class MediaPermission; | 31 class MediaPermission; |
| 30 | 32 |
| 31 class MEDIA_EXPORT WebEncryptedMediaClientImpl | 33 class MEDIA_EXPORT WebEncryptedMediaClientImpl |
| 32 : public blink::WebEncryptedMediaClient { | 34 : public blink::WebEncryptedMediaClient { |
| 33 public: | 35 public: |
| 34 WebEncryptedMediaClientImpl(CdmFactory* cdm_factory, | 36 WebEncryptedMediaClientImpl( |
| 35 MediaPermission* media_permission); | 37 #if defined(OS_ANDROID) |
| 38 base::Callback<bool(void)> allow_secure_surfaces_cb, |
| 39 #endif // defined(OS_ANDROID) |
| 40 CdmFactory* cdm_factory, |
| 41 MediaPermission* media_permission); |
| 36 virtual ~WebEncryptedMediaClientImpl(); | 42 virtual ~WebEncryptedMediaClientImpl(); |
| 37 | 43 |
| 38 // WebEncryptedMediaClient implementation. | 44 // WebEncryptedMediaClient implementation. |
| 39 virtual void requestMediaKeySystemAccess( | 45 virtual void requestMediaKeySystemAccess( |
| 40 blink::WebEncryptedMediaRequest request); | 46 blink::WebEncryptedMediaRequest request); |
| 41 | 47 |
| 42 // Create the CDM for |key_system| and |security_origin|. The caller owns | 48 // Create the CDM for |key_system| and |security_origin|. The caller owns |
| 43 // the created cdm (passed back using |result|). | 49 // the created cdm (passed back using |result|). |
| 44 void CreateCdm(const blink::WebString& key_system, | 50 void CreateCdm(const blink::WebString& key_system, |
| 45 bool allow_distinctive_identifier, | 51 bool allow_distinctive_identifier, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 64 void OnRequestNotSupported(blink::WebEncryptedMediaRequest request, | 70 void OnRequestNotSupported(blink::WebEncryptedMediaRequest request, |
| 65 const blink::WebString& error_message); | 71 const blink::WebString& error_message); |
| 66 | 72 |
| 67 // Gets the Reporter for |key_system|. If it doesn't already exist, | 73 // Gets the Reporter for |key_system|. If it doesn't already exist, |
| 68 // create one. | 74 // create one. |
| 69 Reporter* GetReporter(const blink::WebString& key_system); | 75 Reporter* GetReporter(const blink::WebString& key_system); |
| 70 | 76 |
| 71 // Reporter singletons. | 77 // Reporter singletons. |
| 72 base::ScopedPtrHashMap<std::string, scoped_ptr<Reporter>> reporters_; | 78 base::ScopedPtrHashMap<std::string, scoped_ptr<Reporter>> reporters_; |
| 73 | 79 |
| 80 #if defined(OS_ANDROID) |
| 81 base::Callback<bool(void)> allow_secure_surfaces_cb_, |
| 82 #endif // defined(OS_ANDROID) |
| 74 CdmFactory* cdm_factory_; | 83 CdmFactory* cdm_factory_; |
| 75 KeySystemConfigSelector key_system_config_selector_; | 84 KeySystemConfigSelector key_system_config_selector_; |
| 76 base::WeakPtrFactory<WebEncryptedMediaClientImpl> weak_factory_; | 85 base::WeakPtrFactory<WebEncryptedMediaClientImpl> weak_factory_; |
| 77 }; | 86 }; |
| 78 | 87 |
| 79 } // namespace media | 88 } // namespace media |
| 80 | 89 |
| 81 #endif // MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_ | 90 #endif // MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_ |
| OLD | NEW |