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