Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/component_updater/widevine_cdm_component_installer.h" | 5 #include "chrome/browser/component_updater/widevine_cdm_component_installer.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 return true; | 141 return true; |
| 142 } | 142 } |
| 143 | 143 |
| 144 typedef bool (*VersionCheckFunc)(int version); | 144 typedef bool (*VersionCheckFunc)(int version); |
| 145 | 145 |
| 146 bool CheckForCompatibleVersion(const base::DictionaryValue& manifest, | 146 bool CheckForCompatibleVersion(const base::DictionaryValue& manifest, |
| 147 const std::string version_name, | 147 const std::string version_name, |
| 148 VersionCheckFunc version_check_func) { | 148 VersionCheckFunc version_check_func) { |
| 149 std::string versions_string; | 149 std::string versions_string; |
| 150 if (!manifest.GetString(version_name, &versions_string)) { | 150 if (!manifest.GetString(version_name, &versions_string)) { |
| 151 DLOG(WARNING) | 151 DLOG(WARNING) << "Widevine CDM component manifest missing " << version_name; |
| 152 << "Widevine CDM component manifest is missing " << version_name; | 152 return false; |
|
ddorwin
2014/03/05 22:44:03
Note: A missing string is a failure, but an empty
xhwang
2014/03/06 01:28:42
If the string is empty, it should return false at
ddorwin
2014/03/06 02:03:53
Yes.
| |
| 153 // TODO(ddorwin): Remove this once all users have been updated. | |
| 154 // The original manifests did not include this string, so add its version. | |
| 155 if (version_name == kCdmModuleVersionsName) | |
| 156 versions_string = "4"; | |
| 157 else if (version_name == kCdmInterfaceVersionsName) | |
| 158 versions_string = "1"; | |
| 159 else if (version_name == kCdmHostVersionsName) | |
| 160 versions_string = "1"; | |
| 161 } | 153 } |
| 162 DLOG_IF(WARNING, versions_string.empty()) | 154 DLOG_IF(WARNING, versions_string.empty()) |
| 163 << "Widevine CDM component manifest has empty " << version_name; | 155 << "Widevine CDM component manifest has empty " << version_name; |
| 164 | 156 |
| 165 std::vector<std::string> versions; | 157 std::vector<std::string> versions; |
| 166 base::SplitString(versions_string, | 158 base::SplitString(versions_string, |
| 167 kCdmValueDelimiter, | 159 kCdmValueDelimiter, |
| 168 &versions); | 160 &versions); |
| 169 | 161 |
| 170 for (size_t i = 0; i < versions.size(); ++i) { | 162 for (size_t i = 0; i < versions.size(); ++i) { |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 381 DefaultComponentInstaller* installer | 373 DefaultComponentInstaller* installer |
| 382 = new DefaultComponentInstaller(traits.Pass()); | 374 = new DefaultComponentInstaller(traits.Pass()); |
| 383 installer->Register(cus); | 375 installer->Register(cus); |
| 384 #else | 376 #else |
| 385 return; | 377 return; |
| 386 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 378 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| 387 } | 379 } |
| 388 | 380 |
| 389 } // namespace component_updater | 381 } // namespace component_updater |
| 390 | 382 |
| OLD | NEW |