Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_CROS_COMPONENT_INSTALLER_H_ | |
| 5 #define CHROME_BROWSER_COMPONENT_UPDATER_CROS_COMPONENT_INSTALLER_H_ | |
| 6 | |
| 7 #include "base/json/json_file_value_serializer.h" | |
| 8 #include "base/json/json_string_value_serializer.h" | |
| 9 #include "base/task_scheduler/post_task.h" | |
| 10 #include "base/task_scheduler/task_traits.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 struct ComponentConfig { | |
| 19 std::string name; | |
| 20 std::string dir; | |
| 21 std::string sha2hashstr; | |
| 22 }; | |
| 23 #if defined(OS_CHROMEOS) | |
| 24 class CrOSComponentInstallerTraits : public ComponentInstallerTraits { | |
| 25 public: | |
| 26 CrOSComponentInstallerTraits(std::string dir_name, | |
| 27 std::string name, | |
| 28 std::string sha2HashStr); | |
| 29 ~CrOSComponentInstallerTraits() override {} | |
| 30 | |
| 31 private: | |
| 32 // The following methods override ComponentInstallerTraits. | |
| 33 bool SupportsGroupPolicyEnabledComponentUpdates() const override; | |
| 34 bool RequiresNetworkEncryption() const override; | |
| 35 update_client::CrxInstaller::Result OnCustomInstall( | |
| 36 const base::DictionaryValue& manifest, | |
| 37 const base::FilePath& install_dir) override; | |
| 38 bool VerifyInstallation(const base::DictionaryValue& manifest, | |
| 39 const base::FilePath& install_dir) const override; | |
| 40 void ComponentReady(const base::Version& version, | |
| 41 const base::FilePath& path, | |
| 42 std::unique_ptr<base::DictionaryValue> manifest) override; | |
| 43 base::FilePath GetRelativeInstallDir() const override; | |
| 44 void GetHash(std::vector<uint8_t>* hash) const override; | |
| 45 std::string GetName() const override; | |
| 46 update_client::InstallerAttributes GetInstallerAttributes() const override; | |
| 47 std::vector<std::string> GetMimeTypes() const override; | |
| 48 std::string dir_name; | |
| 49 std::string name; | |
| 50 uint8_t kSha2Hash_[crypto::kSHA256Length] = {}; | |
| 51 | |
| 52 DISALLOW_COPY_AND_ASSIGN(CrOSComponentInstallerTraits); | |
| 53 }; | |
| 54 | |
| 55 #endif // defined(OS_CHROMEOS) | |
| 56 | |
| 57 // Register a CrOS component. | |
| 58 // It must be called on UI thread. | |
| 59 // It also assumes LoadCrOSConfig has finished loading configuration. Otherwise, | |
|
waffles
2017/03/02 18:52:39
Comment is now out of date.
xiaochu
2017/03/02 19:24:10
Done.
| |
| 60 // it does nothing. | |
| 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 |