| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 188 |
| 189 class WidevineCdmComponentInstaller : public ComponentInstaller { | 189 class WidevineCdmComponentInstaller : public ComponentInstaller { |
| 190 public: | 190 public: |
| 191 explicit WidevineCdmComponentInstaller(const base::Version& version); | 191 explicit WidevineCdmComponentInstaller(const base::Version& version); |
| 192 virtual ~WidevineCdmComponentInstaller() {} | 192 virtual ~WidevineCdmComponentInstaller() {} |
| 193 | 193 |
| 194 virtual void OnUpdateError(int error) OVERRIDE; | 194 virtual void OnUpdateError(int error) OVERRIDE; |
| 195 virtual bool Install(const base::DictionaryValue& manifest, | 195 virtual bool Install(const base::DictionaryValue& manifest, |
| 196 const base::FilePath& unpack_path) OVERRIDE; | 196 const base::FilePath& unpack_path) OVERRIDE; |
| 197 | 197 |
| 198 virtual bool GetInstalledFile(const std::string& file, | |
| 199 base::FilePath* installed_file) OVERRIDE; | |
| 200 | |
| 201 private: | 198 private: |
| 202 base::Version current_version_; | 199 base::Version current_version_; |
| 203 }; | 200 }; |
| 204 | 201 |
| 205 WidevineCdmComponentInstaller::WidevineCdmComponentInstaller( | 202 WidevineCdmComponentInstaller::WidevineCdmComponentInstaller( |
| 206 const base::Version& version) | 203 const base::Version& version) |
| 207 : current_version_(version) { | 204 : current_version_(version) { |
| 208 DCHECK(version.IsValid()); | 205 DCHECK(version.IsValid()); |
| 209 } | 206 } |
| 210 | 207 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 if (!file_util::CopyFile(adapter_source_path, adapter_install_path)) | 239 if (!file_util::CopyFile(adapter_source_path, adapter_install_path)) |
| 243 return false; | 240 return false; |
| 244 | 241 |
| 245 // Installation is done. Now register the Widevine CDM with chrome. | 242 // Installation is done. Now register the Widevine CDM with chrome. |
| 246 current_version_ = version; | 243 current_version_ = version; |
| 247 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( | 244 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( |
| 248 &RegisterWidevineCdmWithChrome, adapter_install_path, version)); | 245 &RegisterWidevineCdmWithChrome, adapter_install_path, version)); |
| 249 return true; | 246 return true; |
| 250 } | 247 } |
| 251 | 248 |
| 252 bool WidevineCdmComponentInstaller::GetInstalledFile( | |
| 253 const std::string& file, base::FilePath* installed_file) { | |
| 254 return false; | |
| 255 } | |
| 256 | |
| 257 void FinishWidevineCdmUpdateRegistration(ComponentUpdateService* cus, | 249 void FinishWidevineCdmUpdateRegistration(ComponentUpdateService* cus, |
| 258 const base::Version& version) { | 250 const base::Version& version) { |
| 259 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 251 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 260 CrxComponent widevine_cdm; | 252 CrxComponent widevine_cdm; |
| 261 widevine_cdm.name = "WidevineCdm"; | 253 widevine_cdm.name = "WidevineCdm"; |
| 262 widevine_cdm.installer = new WidevineCdmComponentInstaller(version); | 254 widevine_cdm.installer = new WidevineCdmComponentInstaller(version); |
| 263 widevine_cdm.version = version; | 255 widevine_cdm.version = version; |
| 264 widevine_cdm.pk_hash.assign(kSha2Hash, &kSha2Hash[sizeof(kSha2Hash)]); | 256 widevine_cdm.pk_hash.assign(kSha2Hash, &kSha2Hash[sizeof(kSha2Hash)]); |
| 265 if (cus->RegisterComponent(widevine_cdm) != ComponentUpdateService::kOk) { | 257 if (cus->RegisterComponent(widevine_cdm) != ComponentUpdateService::kOk) { |
| 266 NOTREACHED() << "Widevine CDM component registration failed."; | 258 NOTREACHED() << "Widevine CDM component registration failed."; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 303 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| 312 | 304 |
| 313 } // namespace | 305 } // namespace |
| 314 | 306 |
| 315 void RegisterWidevineCdmComponent(ComponentUpdateService* cus) { | 307 void RegisterWidevineCdmComponent(ComponentUpdateService* cus) { |
| 316 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 308 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| 317 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 309 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| 318 base::Bind(&StartWidevineCdmUpdateRegistration, cus)); | 310 base::Bind(&StartWidevineCdmUpdateRegistration, cus)); |
| 319 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 311 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| 320 } | 312 } |
| OLD | NEW |