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

Unified Diff: content/public/common/content_decryption_module_service.h

Issue 1637083002: Add CdmService to keep track of CDMs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ContentDecryptionModule Created 4 years, 10 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
Index: content/public/common/content_decryption_module_service.h
diff --git a/content/public/common/content_decryption_module_service.h b/content/public/common/content_decryption_module_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..5c0498b3375d16680887f15a0e60de4cad5bcc4b
--- /dev/null
+++ b/content/public/common/content_decryption_module_service.h
@@ -0,0 +1,93 @@
+// Copyright 2016 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 CONTENT_PUBLIC_COMMON_CONTENT_DECRYPTION_MODULE_SERVICE_H_
+#define CONTENT_PUBLIC_COMMON_CONTENT_DECRYPTION_MODULE_SERVICE_H_
+
+#include <string>
+#include <vector>
+
+#include "base/files/file_path.h"
+#include "base/lazy_instance.h"
+#include "base/macros.h"
+#include "base/strings/string16.h"
+#include "base/version.h"
+#include "content/common/content_export.h"
+#include "content/public/common/content_decryption_module_registration.h"
+
+namespace content {
+
+class CONTENT_EXPORT ContentDecryptionModuleService {
+ public:
+ // Returns the ContentDecryptionModuleService singleton.
+ static ContentDecryptionModuleService* GetInstance();
+
+ // Registers |key_system|, replacing any entry that may exist for it (with
+ // same |version|). |module_library_path| is the path to the actual CDM
+ // (may be empty if the CDM is already included as part of the system),
+ // and |supported_codecs| is the list of codecs supported by this CDM
+ // (which may be none).
+ void Register(const std::string& key_system,
+ const std::string& version,
+ const base::FilePath& module_library_path,
+ const std::vector<base::string16>& supported_codecs,
+ const std::vector<base::string16>& supported_init_data_types);
+
+ // Determines if the CDM library path is set for |key_system| with specified
+ // |version|. If |version| is empty, then the latest registered version of
+ // |key_system| is used (if there is one). If found, true is returned and
+ // |module_library_path| is updated. Otherwise false is returned and
+ // |module_library_path| is unchanged.
+ bool GetCdmLibraryPath(const std::string& key_system,
+ const std::string& version,
+ base::FilePath* module_library_path);
+
+ // Determines the codecs set for |key_system| with specified |version|.
+ // If |version| is empty, then the latest registered version of |key_system|
+ // is used (if there is one). If found, true is returned and
+ // |supported_codecs| is updated with the list of codecs registered for
+ // |key_system| (which may be none). Otherwise false is returned and
+ // |supported_codecs| is unchanged.
+ bool GetSupportedCodecs(const std::string& key_system,
+ const std::string& version,
+ std::vector<base::string16>* supported_codecs);
+
+ // Determines the InitDataType set for |key_system| with specified |version|.
+ // If |version| is empty, then the latest registered version of |key_system|
+ // is used (if there is one). If found, true is returned and
+ // |supported_init_data_types| is updated with the list of InitDataTypes
+ // registered for |key_system| (which may be none). Otherwise false is
+ // returned and |supported_init_data_types| is unchanged.
+ bool GetSupportedInitDataTypes(
+ const std::string& key_system,
+ const std::string& version,
+ std::vector<base::string16>* supported_init_data_types);
+
+ // Returns the list of all registered key systems and the matching path to
+ // the library. Note that multiple key systems may use the same library,
+ // so some of the paths in |key_systems| may be duplicated. Paths in
+ // |key_systems| may also be empty if the CDM is already included as
+ // part of the system.
+ void GetAllRegisteredModules(
+ std::vector<std::pair<std::string, base::FilePath>>* modules);
+
+ private:
+ friend struct base::DefaultLazyInstanceTraits<ContentDecryptionModuleService>;
+
+ ContentDecryptionModuleService();
+ ~ContentDecryptionModuleService();
+
+ // Finds the entry in |registered_modules_| that matches |key_system| and
+ // |version|. Returns NULL if not found.
+ ContentDecryptionModuleRegistration* FindEntry(const std::string& key_system,
+ const std::string& version);
+
+ std::vector<ContentDecryptionModuleRegistration> registered_modules_;
+
+ DISALLOW_COPY_AND_ASSIGN(ContentDecryptionModuleService);
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_COMMON_CONTENT_DECRYPTION_MODULE_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698