2021-08-09 23:18:43 +02:00
|
|
|
diff --git chrome/common/media/component_widevine_cdm_hint_file_linux.cc chrome/common/media/component_widevine_cdm_hint_file_linux.cc
|
2024-08-26 14:44:25 +02:00
|
|
|
index b3e05e8183158..90be2d4a3368b 100644
|
2021-08-09 23:18:43 +02:00
|
|
|
--- chrome/common/media/component_widevine_cdm_hint_file_linux.cc
|
|
|
|
+++ chrome/common/media/component_widevine_cdm_hint_file_linux.cc
|
2024-04-23 22:06:00 +02:00
|
|
|
@@ -18,6 +18,7 @@
|
2021-08-09 23:18:43 +02:00
|
|
|
#include "base/values.h"
|
2024-04-23 22:06:00 +02:00
|
|
|
#include "base/version.h"
|
2021-08-09 23:18:43 +02:00
|
|
|
#include "chrome/common/chrome_paths.h"
|
|
|
|
+#include "third_party/widevine/cdm/widevine_cdm_common.h"
|
|
|
|
|
2024-06-14 19:01:45 +02:00
|
|
|
#if BUILDFLAG(IS_CHROMEOS_LACROS)
|
|
|
|
#include "base/command_line.h"
|
|
|
|
@@ -32,6 +33,26 @@ namespace {
|
2024-04-23 22:06:00 +02:00
|
|
|
const char kPath[] = "Path";
|
|
|
|
const char kLastBundledVersion[] = "LastBundledVersion";
|
2021-08-09 23:18:43 +02:00
|
|
|
|
|
|
|
+// On Linux the Widevine CDM is loaded into the zygote at startup. When the
|
|
|
|
+// component updater runs sometime later and finds a newer version of the
|
|
|
|
+// Widevine CDM, don't register it as the newer version can't be used. Instead,
|
|
|
|
+// save the path to the new Widevine CDM in this file. Next time at startup this
|
|
|
|
+// file will be checked, and if it references a usable Widevine CDM, use this
|
|
|
|
+// version instead of the old (potentially bundled) CDM.
|
|
|
|
+// Add this method instead of using chrome::FILE_COMPONENT_WIDEVINE_CDM_HINT
|
|
|
|
+// because only directories (not files) can be configured via
|
|
|
|
+// base::PathService::Override.
|
|
|
|
+bool GetHintFilePath(base::FilePath* hint_file_path) {
|
|
|
|
+ base::FilePath user_data_dir;
|
|
|
|
+ if (!base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir))
|
|
|
|
+ return false;
|
|
|
|
+ // Match the file name in chrome/common/chrome_paths.cc
|
|
|
|
+ *hint_file_path = user_data_dir
|
|
|
|
+ .AppendASCII(kWidevineCdmBaseDirectory)
|
|
|
|
+ .Append(FILE_PATH_LITERAL("latest-component-updated-widevine-cdm"));
|
|
|
|
+ return true;
|
|
|
|
+}
|
|
|
|
+
|
2024-04-23 22:06:00 +02:00
|
|
|
// Returns the hint file contents as a Value::Dict. Returned result may be an
|
|
|
|
// empty dictionary if the hint file does not exist or is formatted incorrectly.
|
|
|
|
base::Value::Dict GetHintFileContents() {
|
2024-06-14 19:01:45 +02:00
|
|
|
@@ -58,8 +79,7 @@ base::Value::Dict GetHintFileContents() {
|
|
|
|
hint_file_path = command_line->GetSwitchValuePath(
|
|
|
|
switches::kCrosWidevineComponentUpdatedHintFile);
|
|
|
|
#else
|
2021-08-09 23:18:43 +02:00
|
|
|
- CHECK(base::PathService::Get(chrome::FILE_COMPONENT_WIDEVINE_CDM_HINT,
|
|
|
|
- &hint_file_path));
|
|
|
|
+ CHECK(GetHintFilePath(&hint_file_path));
|
2024-06-14 19:01:45 +02:00
|
|
|
#endif // BUILDFLAG(IS_CHROMEOS_LACROS)
|
2021-08-09 23:18:43 +02:00
|
|
|
|
2024-06-14 19:01:45 +02:00
|
|
|
DVLOG(1) << __func__ << " checking " << hint_file_path;
|
|
|
|
@@ -98,8 +118,7 @@ bool UpdateWidevineCdmHintFile(const base::FilePath& cdm_base_path,
|
2024-08-26 14:44:25 +02:00
|
|
|
NOTREACHED() << "Lacros should not be updating the hint file.";
|
2024-06-14 19:01:45 +02:00
|
|
|
#else
|
2021-08-09 23:18:43 +02:00
|
|
|
base::FilePath hint_file_path;
|
|
|
|
- CHECK(base::PathService::Get(chrome::FILE_COMPONENT_WIDEVINE_CDM_HINT,
|
|
|
|
- &hint_file_path));
|
|
|
|
+ CHECK(GetHintFilePath(&hint_file_path));
|
|
|
|
|
2024-04-23 22:06:00 +02:00
|
|
|
base::Value::Dict dict;
|
|
|
|
dict.Set(kPath, cdm_base_path.value());
|