Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / media / blink / key_system_config_selector.h
blob47a9feed9baf704f779077b630d5e57e7468c532
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.
5 #ifndef MEDIA_BLINK_KEY_SYSTEM_CONFIG_SELECTOR_H_
6 #define MEDIA_BLINK_KEY_SYSTEM_CONFIG_SELECTOR_H_
8 #include <string>
9 #include <vector>
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 "media/base/media_export.h"
16 #include "third_party/WebKit/public/platform/WebVector.h"
18 namespace blink {
20 struct WebMediaKeySystemConfiguration;
21 struct WebMediaKeySystemMediaCapability;
22 class WebSecurityOrigin;
23 class WebString;
25 } // namespace blink
27 namespace media {
29 class KeySystems;
30 class MediaPermission;
32 class MEDIA_EXPORT KeySystemConfigSelector {
33 public:
34 KeySystemConfigSelector(const KeySystems* key_systems,
35 MediaPermission* media_permission);
37 ~KeySystemConfigSelector();
39 void SelectConfig(
40 const blink::WebString& key_system,
41 const blink::WebVector<blink::WebMediaKeySystemConfiguration>&
42 candidate_configurations,
43 const blink::WebSecurityOrigin& security_origin,
44 base::Callback<void(const blink::WebMediaKeySystemConfiguration&)>
45 succeeded_cb,
46 base::Callback<void(const blink::WebString&)> not_supported_cb);
48 private:
49 struct SelectionRequest;
50 class ConfigState;
52 enum ConfigurationSupport {
53 CONFIGURATION_NOT_SUPPORTED,
54 CONFIGURATION_REQUIRES_PERMISSION,
55 CONFIGURATION_SUPPORTED,
58 void SelectConfigInternal(scoped_ptr<SelectionRequest> request);
60 void OnPermissionResult(scoped_ptr<SelectionRequest> request,
61 bool is_permission_granted);
63 ConfigurationSupport GetSupportedConfiguration(
64 const std::string& key_system,
65 const blink::WebMediaKeySystemConfiguration& candidate,
66 ConfigState* config_state,
67 blink::WebMediaKeySystemConfiguration* accumulated_configuration);
69 bool GetSupportedCapabilities(
70 const std::string& key_system,
71 EmeMediaType media_type,
72 const blink::WebVector<blink::WebMediaKeySystemMediaCapability>&
73 requested_media_capabilities,
74 ConfigState* config_state,
75 std::vector<blink::WebMediaKeySystemMediaCapability>*
76 supported_media_capabilities);
78 bool IsSupportedContentType(const std::string& key_system,
79 EmeMediaType media_type,
80 const std::string& container_mime_type,
81 const std::string& codecs);
83 const KeySystems* key_systems_;
84 MediaPermission* media_permission_;
85 base::WeakPtrFactory<KeySystemConfigSelector> weak_factory_;
87 DISALLOW_COPY_AND_ASSIGN(KeySystemConfigSelector);
90 } // namespace media
92 #endif // MEDIA_BLINK_KEY_SYSTEM_CONFIG_SELECTOR_H_