OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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. |
| 4 |
| 5 #ifndef MEDIA_BLINK_KEY_SYSTEM_CONFIG_SELECTOR_H_ |
| 6 #define MEDIA_BLINK_KEY_SYSTEM_CONFIG_SELECTOR_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/bind.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" |
| 14 #include "media/base/eme_constants.h" |
| 15 #include "third_party/WebKit/public/platform/WebVector.h" |
| 16 |
| 17 namespace blink { |
| 18 |
| 19 struct WebMediaKeySystemConfiguration; |
| 20 struct WebMediaKeySystemMediaCapability; |
| 21 class WebSecurityOrigin; |
| 22 class WebString; |
| 23 |
| 24 } // namespace blink |
| 25 |
| 26 namespace media { |
| 27 |
| 28 class KeySystems; |
| 29 class MediaPermission; |
| 30 |
| 31 class KeySystemConfigSelector { |
| 32 public: |
| 33 KeySystemConfigSelector(const KeySystems* key_systems, |
| 34 MediaPermission* media_permission); |
| 35 |
| 36 ~KeySystemConfigSelector(); |
| 37 |
| 38 void SelectConfig( |
| 39 const blink::WebString& key_system, |
| 40 const blink::WebVector<blink::WebMediaKeySystemConfiguration>& |
| 41 candidate_configurations, |
| 42 const blink::WebSecurityOrigin& security_origin, |
| 43 base::Callback<void(const blink::WebMediaKeySystemConfiguration&)> |
| 44 succeeded_cb, |
| 45 base::Callback<void(const blink::WebString&)> not_supported_cb); |
| 46 |
| 47 private: |
| 48 struct SelectionRequest; |
| 49 class ConfigState; |
| 50 |
| 51 enum ConfigurationSupport { |
| 52 CONFIGURATION_NOT_SUPPORTED, |
| 53 CONFIGURATION_REQUIRES_PERMISSION, |
| 54 CONFIGURATION_SUPPORTED, |
| 55 }; |
| 56 |
| 57 void SelectConfigInternal(scoped_ptr<SelectionRequest> request); |
| 58 |
| 59 void OnPermissionResult(scoped_ptr<SelectionRequest> request, |
| 60 bool is_permission_granted); |
| 61 |
| 62 ConfigurationSupport GetSupportedConfiguration( |
| 63 const std::string& key_system, |
| 64 const blink::WebMediaKeySystemConfiguration& candidate, |
| 65 ConfigState* config_state, |
| 66 blink::WebMediaKeySystemConfiguration* accumulated_configuration); |
| 67 |
| 68 bool GetSupportedCapabilities( |
| 69 const std::string& key_system, |
| 70 EmeMediaType media_type, |
| 71 const blink::WebVector<blink::WebMediaKeySystemMediaCapability>& |
| 72 requested_media_capabilities, |
| 73 ConfigState* config_state, |
| 74 std::vector<blink::WebMediaKeySystemMediaCapability>* |
| 75 supported_media_capabilities); |
| 76 |
| 77 bool IsSupportedContentType(const std::string& key_system, |
| 78 EmeMediaType media_type, |
| 79 const std::string& container_mime_type, |
| 80 const std::string& codecs); |
| 81 |
| 82 const KeySystems* key_systems_; |
| 83 MediaPermission* media_permission_; |
| 84 base::WeakPtrFactory<KeySystemConfigSelector> weak_factory_; |
| 85 |
| 86 DISALLOW_COPY_AND_ASSIGN(KeySystemConfigSelector); |
| 87 }; |
| 88 |
| 89 } // namespace media |
| 90 |
| 91 #endif // MEDIA_BLINK_KEY_SYSTEM_CONFIG_SELECTOR_H_ |
OLD | NEW |