| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_STH_SET_COMPONENT_INSTALLER_H_ | 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_STH_SET_COMPONENT_INSTALLER_H_ |
| 6 #define CHROME_BROWSER_COMPONENT_UPDATER_STH_SET_COMPONENT_INSTALLER_H_ | 6 #define CHROME_BROWSER_COMPONENT_UPDATER_STH_SET_COMPONENT_INSTALLER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 bool VerifyInstallation(const base::DictionaryValue& manifest, | 54 bool VerifyInstallation(const base::DictionaryValue& manifest, |
| 55 const base::FilePath& install_dir) const override; | 55 const base::FilePath& install_dir) const override; |
| 56 void ComponentReady(const base::Version& version, | 56 void ComponentReady(const base::Version& version, |
| 57 const base::FilePath& install_dir, | 57 const base::FilePath& install_dir, |
| 58 std::unique_ptr<base::DictionaryValue> manifest) override; | 58 std::unique_ptr<base::DictionaryValue> manifest) override; |
| 59 base::FilePath GetRelativeInstallDir() const override; | 59 base::FilePath GetRelativeInstallDir() const override; |
| 60 void GetHash(std::vector<uint8_t>* hash) const override; | 60 void GetHash(std::vector<uint8_t>* hash) const override; |
| 61 std::string GetName() const override; | 61 std::string GetName() const override; |
| 62 update_client::InstallerAttributes GetInstallerAttributes() const override; | 62 update_client::InstallerAttributes GetInstallerAttributes() const override; |
| 63 | 63 |
| 64 // Posts a task to the blocking pool for reading the STHs from disk. |
| 65 void PostStartupLoadSTHsFromDisk(const base::FilePath& install_dir, |
| 66 const base::Version& version); |
| 67 |
| 64 // Reads and parses the on-disk json. | 68 // Reads and parses the on-disk json. |
| 65 void LoadSTHsFromDisk(const base::FilePath& sths_file_path, | 69 void LoadSTHsFromDisk(const base::FilePath& sths_file_path, |
| 66 const base::Version& version); | 70 const base::Version& version); |
| 67 | 71 |
| 68 // Handle successful parsing of JSON by distributing the new STH. | 72 // Handle successful parsing of JSON by distributing the new STH. |
| 69 void OnJsonParseSuccess(const std::string& log_id, | 73 void OnJsonParseSuccess(const std::string& log_id, |
| 70 std::unique_ptr<base::Value> parsed_json); | 74 std::unique_ptr<base::Value> parsed_json); |
| 71 | 75 |
| 72 // STH parsing failed - do nothing. | 76 // STH parsing failed - do nothing. |
| 73 void OnJsonParseError(const std::string& log_id, const std::string& error); | 77 void OnJsonParseError(const std::string& log_id, const std::string& error); |
| 74 | 78 |
| 75 // The observer is not owned by this class, so the code creating an instance | 79 // The observer is not owned by this class, so the code creating an instance |
| 76 // of this class is expected to ensure the STHObserver lives as long as | 80 // of this class is expected to ensure the STHObserver lives as long as |
| 77 // this class does. Typically the observer provided will be a global. | 81 // this class does. Typically the observer provided will be a global. |
| 78 net::ct::STHObserver* sth_observer_; | 82 net::ct::STHObserver* sth_observer_; |
| 79 | 83 |
| 80 DISALLOW_COPY_AND_ASSIGN(STHSetComponentInstallerTraits); | 84 DISALLOW_COPY_AND_ASSIGN(STHSetComponentInstallerTraits); |
| 81 }; | 85 }; |
| 82 | 86 |
| 83 void RegisterSTHSetComponent(ComponentUpdateService* cus, | 87 void RegisterSTHSetComponent(ComponentUpdateService* cus, |
| 84 const base::FilePath& user_data_dir); | 88 const base::FilePath& user_data_dir); |
| 85 | 89 |
| 86 } // namespace component_updater | 90 } // namespace component_updater |
| 87 | 91 |
| 88 #endif // CHROME_BROWSER_COMPONENT_UPDATER_STH_SET_COMPONENT_INSTALLER_H_ | 92 #endif // CHROME_BROWSER_COMPONENT_UPDATER_STH_SET_COMPONENT_INSTALLER_H_ |
| OLD | NEW |