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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 | 244 |
| 245 // Installation is done. Now register the Widevine CDM with chrome. | 245 // Installation is done. Now register the Widevine CDM with chrome. |
| 246 current_version_ = version; | 246 current_version_ = version; |
| 247 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( | 247 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( |
| 248 &RegisterWidevineCdmWithChrome, adapter_install_path, version)); | 248 &RegisterWidevineCdmWithChrome, adapter_install_path, version)); |
| 249 return true; | 249 return true; |
| 250 } | 250 } |
| 251 | 251 |
| 252 bool WidevineCdmComponentInstaller::GetInstalledFile( | 252 bool WidevineCdmComponentInstaller::GetInstalledFile( |
| 253 const std::string& file, base::FilePath* installed_file) { | 253 const std::string& file, base::FilePath* installed_file) { |
| 254 return false; | 254 // Only the CDM is component-updated. |
| 255 if (file != kWidevineCdmFileName) | |
| 256 return false; | |
| 257 | |
| 258 if (current_version_.Equals(base::Version(kNullVersion))) | |
| 259 return false; // No CDM has been installed yet. | |
| 260 | |
| 261 base::FilePath installed_cdm_path = | |
| 262 GetWidevineCdmBaseDirectory().AppendASCII(current_version_.GetString()) | |
| 263 .AppendASCII(kWidevineCdmFileName); | |
| 264 | |
| 265 // Ideally we should check if PathExists(installed_cdm_path) here. But this | |
|
Sorin Jianu
2013/06/21 19:49:24
This comment can be removed. The function just map
xhwang
2013/06/21 19:56:04
Done.
| |
| 266 // thread does not allow IO. | |
| 267 | |
| 268 *installed_file = installed_cdm_path; | |
| 269 return true; | |
| 255 } | 270 } |
| 256 | 271 |
| 257 void FinishWidevineCdmUpdateRegistration(ComponentUpdateService* cus, | 272 void FinishWidevineCdmUpdateRegistration(ComponentUpdateService* cus, |
| 258 const base::Version& version) { | 273 const base::Version& version) { |
| 259 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 274 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 260 CrxComponent widevine_cdm; | 275 CrxComponent widevine_cdm; |
| 261 widevine_cdm.name = "WidevineCdm"; | 276 widevine_cdm.name = "WidevineCdm"; |
| 262 widevine_cdm.installer = new WidevineCdmComponentInstaller(version); | 277 widevine_cdm.installer = new WidevineCdmComponentInstaller(version); |
| 263 widevine_cdm.version = version; | 278 widevine_cdm.version = version; |
| 264 widevine_cdm.pk_hash.assign(kSha2Hash, &kSha2Hash[sizeof(kSha2Hash)]); | 279 widevine_cdm.pk_hash.assign(kSha2Hash, &kSha2Hash[sizeof(kSha2Hash)]); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 311 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 326 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| 312 | 327 |
| 313 } // namespace | 328 } // namespace |
| 314 | 329 |
| 315 void RegisterWidevineCdmComponent(ComponentUpdateService* cus) { | 330 void RegisterWidevineCdmComponent(ComponentUpdateService* cus) { |
| 316 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 331 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| 317 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 332 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| 318 base::Bind(&StartWidevineCdmUpdateRegistration, cus)); | 333 base::Bind(&StartWidevineCdmUpdateRegistration, cus)); |
| 319 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 334 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| 320 } | 335 } |
| OLD | NEW |