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 *installed_file = |
| 262 GetWidevineCdmBaseDirectory().AppendASCII(current_version_.GetString()) |
| 263 .AppendASCII(kWidevineCdmFileName); |
| 264 return true; |
255 } | 265 } |
256 | 266 |
257 void FinishWidevineCdmUpdateRegistration(ComponentUpdateService* cus, | 267 void FinishWidevineCdmUpdateRegistration(ComponentUpdateService* cus, |
258 const base::Version& version) { | 268 const base::Version& version) { |
259 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 269 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
260 CrxComponent widevine_cdm; | 270 CrxComponent widevine_cdm; |
261 widevine_cdm.name = "WidevineCdm"; | 271 widevine_cdm.name = "WidevineCdm"; |
262 widevine_cdm.installer = new WidevineCdmComponentInstaller(version); | 272 widevine_cdm.installer = new WidevineCdmComponentInstaller(version); |
263 widevine_cdm.version = version; | 273 widevine_cdm.version = version; |
264 widevine_cdm.pk_hash.assign(kSha2Hash, &kSha2Hash[sizeof(kSha2Hash)]); | 274 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) | 321 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
312 | 322 |
313 } // namespace | 323 } // namespace |
314 | 324 |
315 void RegisterWidevineCdmComponent(ComponentUpdateService* cus) { | 325 void RegisterWidevineCdmComponent(ComponentUpdateService* cus) { |
316 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 326 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
317 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 327 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
318 base::Bind(&StartWidevineCdmUpdateRegistration, cus)); | 328 base::Bind(&StartWidevineCdmUpdateRegistration, cus)); |
319 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 329 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
320 } | 330 } |
OLD | NEW |