Remove use of deprecated SkImage::getTexture() from gl_renderer.cc
[chromium-blink-merge.git] / media / blink / key_system_config_selector.h
blob7a8afbf0dab7829096f8abb0395f7622e40df6fc
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/callback.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h"
15 #include "media/base/eme_constants.h"
16 #include "media/base/media_export.h"
17 #include "third_party/WebKit/public/platform/WebVector.h"
19 namespace blink {
21 struct WebMediaKeySystemConfiguration;
22 struct WebMediaKeySystemMediaCapability;
23 class WebSecurityOrigin;
24 class WebString;
26 } // namespace blink
28 namespace media {
30 struct CdmConfig;
31 class KeySystems;
32 class MediaPermission;
34 class MEDIA_EXPORT KeySystemConfigSelector {
35 public:
36 KeySystemConfigSelector(
37 const KeySystems* key_systems,
38 MediaPermission* media_permission);
40 ~KeySystemConfigSelector();
42 void SelectConfig(
43 const blink::WebString& key_system,
44 const blink::WebVector<blink::WebMediaKeySystemConfiguration>&
45 candidate_configurations,
46 const blink::WebSecurityOrigin& security_origin,
47 bool are_secure_codecs_supported,
48 base::Callback<void(const blink::WebMediaKeySystemConfiguration&,
49 const CdmConfig&)> succeeded_cb,
50 base::Callback<void(const blink::WebString&)> not_supported_cb);
52 private:
53 struct SelectionRequest;
54 class ConfigState;
56 enum ConfigurationSupport {
57 CONFIGURATION_NOT_SUPPORTED,
58 CONFIGURATION_REQUIRES_PERMISSION,
59 CONFIGURATION_SUPPORTED,
62 void SelectConfigInternal(scoped_ptr<SelectionRequest> request);
64 void OnPermissionResult(scoped_ptr<SelectionRequest> request,
65 bool is_permission_granted);
67 ConfigurationSupport GetSupportedConfiguration(
68 const std::string& key_system,
69 const blink::WebMediaKeySystemConfiguration& candidate,
70 ConfigState* config_state,
71 blink::WebMediaKeySystemConfiguration* accumulated_configuration);
73 bool GetSupportedCapabilities(
74 const std::string& key_system,
75 EmeMediaType media_type,
76 const blink::WebVector<blink::WebMediaKeySystemMediaCapability>&
77 requested_media_capabilities,
78 ConfigState* config_state,
79 std::vector<blink::WebMediaKeySystemMediaCapability>*
80 supported_media_capabilities);
82 bool IsSupportedContentType(const std::string& key_system,
83 EmeMediaType media_type,
84 const std::string& container_mime_type,
85 const std::string& codecs,
86 ConfigState* config_state);
88 const KeySystems* key_systems_;
89 MediaPermission* media_permission_;
90 base::WeakPtrFactory<KeySystemConfigSelector> weak_factory_;
92 DISALLOW_COPY_AND_ASSIGN(KeySystemConfigSelector);
95 } // namespace media
97 #endif // MEDIA_BLINK_KEY_SYSTEM_CONFIG_SELECTOR_H_