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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/key_system_config_selector.h
diff --git a/media/blink/key_system_config_selector.h b/media/blink/key_system_config_selector.h
new file mode 100644
index 0000000000000000000000000000000000000000..1bebbe1520782fe71e4489fba114fd2fbd2cbbd4
--- /dev/null
+++ b/media/blink/key_system_config_selector.h
@@ -0,0 +1,91 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_BLINK_KEY_SYSTEM_CONFIG_SELECTOR_H_
+#define MEDIA_BLINK_KEY_SYSTEM_CONFIG_SELECTOR_H_
+
+#include <string>
+#include <vector>
+
+#include "base/bind.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "media/base/eme_constants.h"
+#include "third_party/WebKit/public/platform/WebVector.h"
+
+namespace blink {
+
+struct WebMediaKeySystemConfiguration;
+struct WebMediaKeySystemMediaCapability;
+class WebSecurityOrigin;
+class WebString;
+
+} // namespace blink
+
+namespace media {
+
+class KeySystems;
+class MediaPermission;
+
+class KeySystemConfigSelector {
+ public:
+ KeySystemConfigSelector(const KeySystems* key_systems,
+ MediaPermission* media_permission);
+
+ ~KeySystemConfigSelector();
+
+ void SelectConfig(
+ const blink::WebString& key_system,
+ const blink::WebVector<blink::WebMediaKeySystemConfiguration>&
+ candidate_configurations,
+ const blink::WebSecurityOrigin& security_origin,
+ base::Callback<void(const blink::WebMediaKeySystemConfiguration&)>
+ succeeded_cb,
+ base::Callback<void(const blink::WebString&)> not_supported_cb);
+
+ private:
+ struct SelectionRequest;
+ class ConfigState;
+
+ enum ConfigurationSupport {
+ CONFIGURATION_NOT_SUPPORTED,
+ CONFIGURATION_REQUIRES_PERMISSION,
+ CONFIGURATION_SUPPORTED,
+ };
+
+ void SelectConfigInternal(scoped_ptr<SelectionRequest> request);
+
+ void OnPermissionResult(scoped_ptr<SelectionRequest> request,
+ bool is_permission_granted);
+
+ ConfigurationSupport GetSupportedConfiguration(
+ const std::string& key_system,
+ const blink::WebMediaKeySystemConfiguration& candidate,
+ ConfigState* config_state,
+ blink::WebMediaKeySystemConfiguration* accumulated_configuration);
+
+ bool GetSupportedCapabilities(
+ const std::string& key_system,
+ EmeMediaType media_type,
+ const blink::WebVector<blink::WebMediaKeySystemMediaCapability>&
+ requested_media_capabilities,
+ ConfigState* config_state,
+ std::vector<blink::WebMediaKeySystemMediaCapability>*
+ supported_media_capabilities);
+
+ bool IsSupportedContentType(const std::string& key_system,
+ EmeMediaType media_type,
+ const std::string& container_mime_type,
+ const std::string& codecs);
+
+ const KeySystems* key_systems_;
+ MediaPermission* media_permission_;
+ base::WeakPtrFactory<KeySystemConfigSelector> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(KeySystemConfigSelector);
+};
+
+} // namespace media
+
+#endif // MEDIA_BLINK_KEY_SYSTEM_CONFIG_SELECTOR_H_
« 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