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

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: Class vs struct forward declarations. 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
« no previous file with comments | « media/blink/BUILD.gn ('k') | media/blink/key_system_config_selector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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_
OLDNEW
« no previous file with comments | « media/blink/BUILD.gn ('k') | media/blink/key_system_config_selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698