Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: media/blink/key_system_config_selector.h

Issue 1052273004: Extract requestMediaKeySystemAccess() algorithm. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 class WebMediaKeySystemConfiguration;
20 class 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(
34 const KeySystems* key_systems,
35 MediaPermission* media_permission);
36
37 ~KeySystemConfigSelector();
38
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);
47
48 private:
49 struct SelectionRequest;
50 class ConfigState;
51
52 enum ConfigurationSupport {
53 CONFIGURATION_NOT_SUPPORTED,
54 CONFIGURATION_REQUIRES_PERMISSION,
55 CONFIGURATION_SUPPORTED,
56 };
57
58 void OnPermissionResult(
59 scoped_ptr<SelectionRequest> request,
60 bool is_permission_granted);
61
62 void OnSelectConfig(scoped_ptr<SelectionRequest> request);
63
64 ConfigurationSupport GetSupportedConfiguration(
65 const std::string& key_system,
66 const blink::WebMediaKeySystemConfiguration& candidate,
67 ConfigState* config_state,
68 blink::WebMediaKeySystemConfiguration* accumulated_configuration);
69
70 bool GetSupportedCapabilities(
71 const std::string& key_system,
72 EmeMediaType media_type,
73 const blink::WebVector<blink::WebMediaKeySystemMediaCapability>&
74 requested_media_capabilities,
75 ConfigState* config_state,
76 std::vector<blink::WebMediaKeySystemMediaCapability>*
77 supported_media_capabilities);
78
79 bool IsSupportedContentType(
80 const std::string& key_system,
81 EmeMediaType media_type,
82 const std::string& container_mime_type,
83 const std::string& codecs);
84
85 const KeySystems* key_systems_;
86 MediaPermission* media_permission_;
87 base::WeakPtrFactory<KeySystemConfigSelector> weak_factory_;
88
89 DISALLOW_COPY_AND_ASSIGN(KeySystemConfigSelector);
90 };
91
92 } // namespace media
93
94 #endif // MEDIA_BLINK_KEY_SYSTEM_CONFIG_SELECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698