| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 const base::FilePath& install_dir) override; | 253 const base::FilePath& install_dir) override; |
| 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 std::string GetAp() const override; | 263 update_client::InstallerAttributes GetInstallerAttributes() const override; |
| 264 | 264 |
| 265 // Checks and updates CDM adapter if necessary to make sure the latest CDM | 265 // Checks and updates CDM adapter if necessary to make sure the latest CDM |
| 266 // adapter is always used. | 266 // adapter is always used. |
| 267 // Note: The component is ready when CDM is present, but the CDM won't be | 267 // 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 | 268 // registered until the adapter is copied by this function (see |
| 269 // VerifyInstallation). | 269 // VerifyInstallation). |
| 270 void UpdateCdmAdapter(const base::Version& cdm_version, | 270 void UpdateCdmAdapter(const base::Version& cdm_version, |
| 271 const base::FilePath& cdm_install_dir, | 271 const base::FilePath& cdm_install_dir, |
| 272 std::unique_ptr<base::DictionaryValue> manifest); | 272 std::unique_ptr<base::DictionaryValue> manifest); |
| 273 | 273 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 328 |
| 329 void WidevineCdmComponentInstallerTraits::GetHash( | 329 void WidevineCdmComponentInstallerTraits::GetHash( |
| 330 std::vector<uint8_t>* hash) const { | 330 std::vector<uint8_t>* hash) const { |
| 331 hash->assign(kSha2Hash, kSha2Hash + arraysize(kSha2Hash)); | 331 hash->assign(kSha2Hash, kSha2Hash + arraysize(kSha2Hash)); |
| 332 } | 332 } |
| 333 | 333 |
| 334 std::string WidevineCdmComponentInstallerTraits::GetName() const { | 334 std::string WidevineCdmComponentInstallerTraits::GetName() const { |
| 335 return kWidevineCdmDisplayName; | 335 return kWidevineCdmDisplayName; |
| 336 } | 336 } |
| 337 | 337 |
| 338 std::string WidevineCdmComponentInstallerTraits::GetAp() const { | 338 update_client::InstallerAttributes |
| 339 return std::string(); | 339 WidevineCdmComponentInstallerTraits::GetInstallerAttributes() const { |
| 340 return update_client::InstallerAttributes(); |
| 340 } | 341 } |
| 341 | 342 |
| 342 static bool HasValidAdapter(const base::FilePath& adapter_version_path, | 343 static bool HasValidAdapter(const base::FilePath& adapter_version_path, |
| 343 const base::FilePath& adapter_install_path, | 344 const base::FilePath& adapter_install_path, |
| 344 const std::string& chrome_version) { | 345 const std::string& chrome_version) { |
| 345 std::string adapter_version; | 346 std::string adapter_version; |
| 346 return base::ReadFileToString(adapter_version_path, &adapter_version) && | 347 return base::ReadFileToString(adapter_version_path, &adapter_version) && |
| 347 adapter_version == chrome_version && | 348 adapter_version == chrome_version && |
| 348 base::PathExists(adapter_install_path); | 349 base::PathExists(adapter_install_path); |
| 349 } | 350 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 std::unique_ptr<ComponentInstallerTraits> traits( | 406 std::unique_ptr<ComponentInstallerTraits> traits( |
| 406 new WidevineCdmComponentInstallerTraits); | 407 new WidevineCdmComponentInstallerTraits); |
| 407 // |cus| will take ownership of |installer| during installer->Register(cus). | 408 // |cus| will take ownership of |installer| during installer->Register(cus). |
| 408 DefaultComponentInstaller* installer = | 409 DefaultComponentInstaller* installer = |
| 409 new DefaultComponentInstaller(std::move(traits)); | 410 new DefaultComponentInstaller(std::move(traits)); |
| 410 installer->Register(cus, base::Closure()); | 411 installer->Register(cus, base::Closure()); |
| 411 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 412 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| 412 } | 413 } |
| 413 | 414 |
| 414 } // namespace component_updater | 415 } // namespace component_updater |
| OLD | NEW |