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. |
ddorwin
2013/06/21 17:54:49
tiny nit: component-updated
xhwang
2013/06/21 18:16:54
Done.
| |
255 if (file != kWidevineCdmFileName) | |
256 return false; | |
257 | |
258 // No CDM has been installed yet. | |
ddorwin
2013/06/21 17:54:49
This reads as a fact when it should describe the c
xhwang
2013/06/21 18:16:54
Done.
| |
259 if (current_version_.Equals(base::Version(kNullVersion))) | |
260 return false; | |
261 | |
262 base::FilePath installed_cdm_path = | |
263 GetWidevineCdmBaseDirectory().AppendASCII(current_version_.GetString()) | |
264 .AppendASCII(kWidevineCdmFileName); | |
265 | |
266 // Ideally we should check if PathExists(installed_cdm_path) here. But this | |
ddorwin
2013/06/21 17:54:49
What are the other implementations doing?
Maybe th
xhwang
2013/06/21 18:16:54
I think I am the first one implementing this :)
S
waffles
2013/06/21 18:23:24
We will have a failure with a more specific error
| |
267 // thread does not allow IO. | |
268 | |
269 *installed_file = installed_cdm_path; | |
270 return true; | |
255 } | 271 } |
256 | 272 |
257 void FinishWidevineCdmUpdateRegistration(ComponentUpdateService* cus, | 273 void FinishWidevineCdmUpdateRegistration(ComponentUpdateService* cus, |
258 const base::Version& version) { | 274 const base::Version& version) { |
259 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 275 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
260 CrxComponent widevine_cdm; | 276 CrxComponent widevine_cdm; |
261 widevine_cdm.name = "WidevineCdm"; | 277 widevine_cdm.name = "WidevineCdm"; |
262 widevine_cdm.installer = new WidevineCdmComponentInstaller(version); | 278 widevine_cdm.installer = new WidevineCdmComponentInstaller(version); |
263 widevine_cdm.version = version; | 279 widevine_cdm.version = version; |
264 widevine_cdm.pk_hash.assign(kSha2Hash, &kSha2Hash[sizeof(kSha2Hash)]); | 280 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) | 327 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
312 | 328 |
313 } // namespace | 329 } // namespace |
314 | 330 |
315 void RegisterWidevineCdmComponent(ComponentUpdateService* cus) { | 331 void RegisterWidevineCdmComponent(ComponentUpdateService* cus) { |
316 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 332 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
317 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 333 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
318 base::Bind(&StartWidevineCdmUpdateRegistration, cus)); | 334 base::Bind(&StartWidevineCdmUpdateRegistration, cus)); |
319 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 335 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
320 } | 336 } |
OLD | NEW |