OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_CROS_COMPONENT_INSTALLER_H_ |
| 6 #define CHROME_BROWSER_COMPONENT_UPDATER_CROS_COMPONENT_INSTALLER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "build/build_config.h" |
| 11 #include "components/component_updater/default_component_installer.h" |
| 12 #include "crypto/sha2.h" |
| 13 |
| 14 namespace component_updater { |
| 15 |
| 16 class ComponentUpdateService; |
| 17 |
| 18 #if defined(OS_CHROMEOS) |
| 19 struct ComponentConfig { |
| 20 std::string name; |
| 21 std::string dir; |
| 22 std::string sha2hashstr; |
| 23 ComponentConfig(const std::string& name, |
| 24 const std::string& dir, |
| 25 const std::string& sha2hashstr); |
| 26 ~ComponentConfig(); |
| 27 }; |
| 28 |
| 29 class CrOSComponentInstallerTraits : public ComponentInstallerTraits { |
| 30 public: |
| 31 explicit CrOSComponentInstallerTraits(const ComponentConfig& config); |
| 32 ~CrOSComponentInstallerTraits() override {} |
| 33 |
| 34 private: |
| 35 // The following methods override ComponentInstallerTraits. |
| 36 bool SupportsGroupPolicyEnabledComponentUpdates() const override; |
| 37 bool RequiresNetworkEncryption() const override; |
| 38 update_client::CrxInstaller::Result OnCustomInstall( |
| 39 const base::DictionaryValue& manifest, |
| 40 const base::FilePath& install_dir) override; |
| 41 bool VerifyInstallation(const base::DictionaryValue& manifest, |
| 42 const base::FilePath& install_dir) const override; |
| 43 void ComponentReady(const base::Version& version, |
| 44 const base::FilePath& path, |
| 45 std::unique_ptr<base::DictionaryValue> manifest) override; |
| 46 base::FilePath GetRelativeInstallDir() const override; |
| 47 void GetHash(std::vector<uint8_t>* hash) const override; |
| 48 std::string GetName() const override; |
| 49 update_client::InstallerAttributes GetInstallerAttributes() const override; |
| 50 std::vector<std::string> GetMimeTypes() const override; |
| 51 std::string dir_name; |
| 52 std::string name; |
| 53 uint8_t kSha2Hash_[crypto::kSHA256Length] = {}; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(CrOSComponentInstallerTraits); |
| 56 }; |
| 57 #endif // defined(OS_CHROMEOS) |
| 58 |
| 59 // Register a CrOS component. |
| 60 // It must be called on UI thread. |
| 61 bool RegisterCrOSComponent(ComponentUpdateService* cus, |
| 62 const std::string& name); |
| 63 |
| 64 } // namespace component_updater |
| 65 |
| 66 #endif // CHROME_BROWSER_COMPONENT_UPDATER_CROS_COMPONENT_INSTALLER_H_ |
OLD | NEW |