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