| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 bool VerifyInstallation( | 254 bool VerifyInstallation( |
| 255 const base::DictionaryValue& manifest, | 255 const base::DictionaryValue& manifest, |
| 256 const base::FilePath& install_dir) const override; | 256 const base::FilePath& install_dir) const override; |
| 257 void ComponentReady(const base::Version& version, | 257 void ComponentReady(const base::Version& version, |
| 258 const base::FilePath& path, | 258 const base::FilePath& path, |
| 259 std::unique_ptr<base::DictionaryValue> manifest) override; | 259 std::unique_ptr<base::DictionaryValue> manifest) override; |
| 260 base::FilePath GetRelativeInstallDir() const override; | 260 base::FilePath GetRelativeInstallDir() const override; |
| 261 void GetHash(std::vector<uint8_t>* hash) const override; | 261 void GetHash(std::vector<uint8_t>* hash) const override; |
| 262 std::string GetName() const override; | 262 std::string GetName() const override; |
| 263 update_client::InstallerAttributes GetInstallerAttributes() const override; | 263 update_client::InstallerAttributes GetInstallerAttributes() const override; |
| 264 void AddMimeTypes(std::vector<std::string>* mime_types) const override; |
| 264 | 265 |
| 265 // Checks and updates CDM adapter if necessary to make sure the latest CDM | 266 // Checks and updates CDM adapter if necessary to make sure the latest CDM |
| 266 // adapter is always used. | 267 // adapter is always used. |
| 267 // Note: The component is ready when CDM is present, but the CDM won't be | 268 // Note: The component is ready when CDM is present, but the CDM won't be |
| 268 // registered until the adapter is copied by this function (see | 269 // registered until the adapter is copied by this function (see |
| 269 // VerifyInstallation). | 270 // VerifyInstallation). |
| 270 void UpdateCdmAdapter(const base::Version& cdm_version, | 271 void UpdateCdmAdapter(const base::Version& cdm_version, |
| 271 const base::FilePath& cdm_install_dir, | 272 const base::FilePath& cdm_install_dir, |
| 272 std::unique_ptr<base::DictionaryValue> manifest); | 273 std::unique_ptr<base::DictionaryValue> manifest); |
| 273 | 274 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 334 |
| 334 std::string WidevineCdmComponentInstallerTraits::GetName() const { | 335 std::string WidevineCdmComponentInstallerTraits::GetName() const { |
| 335 return kWidevineCdmDisplayName; | 336 return kWidevineCdmDisplayName; |
| 336 } | 337 } |
| 337 | 338 |
| 338 update_client::InstallerAttributes | 339 update_client::InstallerAttributes |
| 339 WidevineCdmComponentInstallerTraits::GetInstallerAttributes() const { | 340 WidevineCdmComponentInstallerTraits::GetInstallerAttributes() const { |
| 340 return update_client::InstallerAttributes(); | 341 return update_client::InstallerAttributes(); |
| 341 } | 342 } |
| 342 | 343 |
| 344 void WidevineCdmComponentInstallerTraits::AddMimeTypes( |
| 345 std::vector<std::string>* mime_types) const { |
| 346 } |
| 347 |
| 343 static bool HasValidAdapter(const base::FilePath& adapter_version_path, | 348 static bool HasValidAdapter(const base::FilePath& adapter_version_path, |
| 344 const base::FilePath& adapter_install_path, | 349 const base::FilePath& adapter_install_path, |
| 345 const std::string& chrome_version) { | 350 const std::string& chrome_version) { |
| 346 std::string adapter_version; | 351 std::string adapter_version; |
| 347 return base::ReadFileToString(adapter_version_path, &adapter_version) && | 352 return base::ReadFileToString(adapter_version_path, &adapter_version) && |
| 348 adapter_version == chrome_version && | 353 adapter_version == chrome_version && |
| 349 base::PathExists(adapter_install_path); | 354 base::PathExists(adapter_install_path); |
| 350 } | 355 } |
| 351 | 356 |
| 352 void WidevineCdmComponentInstallerTraits::UpdateCdmAdapter( | 357 void WidevineCdmComponentInstallerTraits::UpdateCdmAdapter( |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 std::unique_ptr<ComponentInstallerTraits> traits( | 411 std::unique_ptr<ComponentInstallerTraits> traits( |
| 407 new WidevineCdmComponentInstallerTraits); | 412 new WidevineCdmComponentInstallerTraits); |
| 408 // |cus| will take ownership of |installer| during installer->Register(cus). | 413 // |cus| will take ownership of |installer| during installer->Register(cus). |
| 409 DefaultComponentInstaller* installer = | 414 DefaultComponentInstaller* installer = |
| 410 new DefaultComponentInstaller(std::move(traits)); | 415 new DefaultComponentInstaller(std::move(traits)); |
| 411 installer->Register(cus, base::Closure()); | 416 installer->Register(cus, base::Closure()); |
| 412 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 417 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| 413 } | 418 } |
| 414 | 419 |
| 415 } // namespace component_updater | 420 } // namespace component_updater |
| OLD | NEW |