| 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 <memory> |   10 #include <memory> | 
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  243  |  243  | 
|  244 class WidevineCdmComponentInstallerTraits : public ComponentInstallerTraits { |  244 class WidevineCdmComponentInstallerTraits : public ComponentInstallerTraits { | 
|  245  public: |  245  public: | 
|  246   WidevineCdmComponentInstallerTraits(); |  246   WidevineCdmComponentInstallerTraits(); | 
|  247   ~WidevineCdmComponentInstallerTraits() override {} |  247   ~WidevineCdmComponentInstallerTraits() override {} | 
|  248  |  248  | 
|  249  private: |  249  private: | 
|  250   // The following methods override ComponentInstallerTraits. |  250   // The following methods override ComponentInstallerTraits. | 
|  251   bool SupportsGroupPolicyEnabledComponentUpdates() const override; |  251   bool SupportsGroupPolicyEnabledComponentUpdates() const override; | 
|  252   bool RequiresNetworkEncryption() const override; |  252   bool RequiresNetworkEncryption() const override; | 
|  253   update_client::CrxInstaller::Result OnCustomInstall( |  253   bool OnCustomInstall(const base::DictionaryValue& manifest, | 
|  254       const base::DictionaryValue& manifest, |  254                                const base::FilePath& install_dir) override; | 
|  255       const base::FilePath& install_dir) override; |  | 
|  256   bool VerifyInstallation( |  255   bool VerifyInstallation( | 
|  257       const base::DictionaryValue& manifest, |  256       const base::DictionaryValue& manifest, | 
|  258       const base::FilePath& install_dir) const override; |  257       const base::FilePath& install_dir) const override; | 
|  259   void ComponentReady(const base::Version& version, |  258   void ComponentReady(const base::Version& version, | 
|  260                       const base::FilePath& path, |  259                       const base::FilePath& path, | 
|  261                       std::unique_ptr<base::DictionaryValue> manifest) override; |  260                       std::unique_ptr<base::DictionaryValue> manifest) override; | 
|  262   base::FilePath GetRelativeInstallDir() const override; |  261   base::FilePath GetRelativeInstallDir() const override; | 
|  263   void GetHash(std::vector<uint8_t>* hash) const override; |  262   void GetHash(std::vector<uint8_t>* hash) const override; | 
|  264   std::string GetName() const override; |  263   std::string GetName() const override; | 
|  265   update_client::InstallerAttributes GetInstallerAttributes() const override; |  264   update_client::InstallerAttributes GetInstallerAttributes() const override; | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
|  282  |  281  | 
|  283 bool WidevineCdmComponentInstallerTraits:: |  282 bool WidevineCdmComponentInstallerTraits:: | 
|  284     SupportsGroupPolicyEnabledComponentUpdates() const { |  283     SupportsGroupPolicyEnabledComponentUpdates() const { | 
|  285   return true; |  284   return true; | 
|  286 } |  285 } | 
|  287  |  286  | 
|  288 bool WidevineCdmComponentInstallerTraits::RequiresNetworkEncryption() const { |  287 bool WidevineCdmComponentInstallerTraits::RequiresNetworkEncryption() const { | 
|  289   return false; |  288   return false; | 
|  290 } |  289 } | 
|  291  |  290  | 
|  292 update_client::CrxInstaller::Result |  291 bool WidevineCdmComponentInstallerTraits::OnCustomInstall( | 
|  293 WidevineCdmComponentInstallerTraits::OnCustomInstall( |  | 
|  294     const base::DictionaryValue& manifest, |  292     const base::DictionaryValue& manifest, | 
|  295     const base::FilePath& install_dir) { |  293     const base::FilePath& install_dir) { | 
|  296   return update_client::CrxInstaller::Result(0); |  294   return true; | 
|  297 } |  295 } | 
|  298  |  296  | 
|  299 // Once the CDM is ready, check the CDM adapter. |  297 // Once the CDM is ready, check the CDM adapter. | 
|  300 void WidevineCdmComponentInstallerTraits::ComponentReady( |  298 void WidevineCdmComponentInstallerTraits::ComponentReady( | 
|  301     const base::Version& version, |  299     const base::Version& version, | 
|  302     const base::FilePath& path, |  300     const base::FilePath& path, | 
|  303     std::unique_ptr<base::DictionaryValue> manifest) { |  301     std::unique_ptr<base::DictionaryValue> manifest) { | 
|  304   if (!IsCompatibleWithChrome(*manifest)) { |  302   if (!IsCompatibleWithChrome(*manifest)) { | 
|  305     VLOG(1) << "Installed Widevine CDM component is incompatible."; |  303     VLOG(1) << "Installed Widevine CDM component is incompatible."; | 
|  306     return; |  304     return; | 
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  416   std::unique_ptr<ComponentInstallerTraits> traits( |  414   std::unique_ptr<ComponentInstallerTraits> traits( | 
|  417       new WidevineCdmComponentInstallerTraits); |  415       new WidevineCdmComponentInstallerTraits); | 
|  418   // |cus| will take ownership of |installer| during installer->Register(cus). |  416   // |cus| will take ownership of |installer| during installer->Register(cus). | 
|  419   DefaultComponentInstaller* installer = |  417   DefaultComponentInstaller* installer = | 
|  420       new DefaultComponentInstaller(std::move(traits)); |  418       new DefaultComponentInstaller(std::move(traits)); | 
|  421   installer->Register(cus, base::Closure()); |  419   installer->Register(cus, base::Closure()); | 
|  422 #endif  // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |  420 #endif  // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 
|  423 } |  421 } | 
|  424  |  422  | 
|  425 }  // namespace component_updater |  423 }  // namespace component_updater | 
| OLD | NEW |