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 "components/component_updater/default_component_installer.h" | |
| 8 #include "crypto/sha2.h" | |
| 9 | |
| 10 namespace component_updater { | |
| 11 | |
| 12 class ComponentUpdateService; | |
| 13 | |
| 14 struct ComponentConfig { | |
|
Sorin Jianu
2017/03/02 22:27:25
Also, we usually declare ctor and dtor for such da
xiaochu
2017/03/03 00:08:53
Done.
| |
| 15 std::string name; | |
|
Sorin Jianu
2017/03/02 22:27:25
include <string>
xiaochu
2017/03/03 00:08:53
Done.
| |
| 16 std::string dir; | |
| 17 std::string sha2hashstr; | |
| 18 }; | |
| 19 #if defined(OS_CHROMEOS) | |
|
Sorin Jianu
2017/03/02 22:27:25
Superimportant: #include "build/build_config.h"
wh
xiaochu
2017/03/03 00:08:53
included once here. not including it in .cc file.
| |
| 20 class CrOSComponentInstallerTraits : public ComponentInstallerTraits { | |
| 21 public: | |
| 22 CrOSComponentInstallerTraits(std::string dir_name, | |
|
Sorin Jianu
2017/03/02 22:27:25
& to const type
Sorin Jianu
2017/03/02 22:27:25
Can it take a ComponentConfig as a param?
xiaochu
2017/03/03 00:08:53
Done.
| |
| 23 std::string name, | |
| 24 std::string sha2HashStr); | |
| 25 ~CrOSComponentInstallerTraits() override {} | |
| 26 | |
| 27 private: | |
| 28 // The following methods override ComponentInstallerTraits. | |
| 29 bool SupportsGroupPolicyEnabledComponentUpdates() const override; | |
| 30 bool RequiresNetworkEncryption() const override; | |
| 31 update_client::CrxInstaller::Result OnCustomInstall( | |
| 32 const base::DictionaryValue& manifest, | |
| 33 const base::FilePath& install_dir) override; | |
| 34 bool VerifyInstallation(const base::DictionaryValue& manifest, | |
| 35 const base::FilePath& install_dir) const override; | |
| 36 void ComponentReady(const base::Version& version, | |
| 37 const base::FilePath& path, | |
| 38 std::unique_ptr<base::DictionaryValue> manifest) override; | |
| 39 base::FilePath GetRelativeInstallDir() const override; | |
| 40 void GetHash(std::vector<uint8_t>* hash) const override; | |
| 41 std::string GetName() const override; | |
| 42 update_client::InstallerAttributes GetInstallerAttributes() const override; | |
| 43 std::vector<std::string> GetMimeTypes() const override; | |
| 44 std::string dir_name; | |
| 45 std::string name; | |
| 46 uint8_t kSha2Hash_[crypto::kSHA256Length] = {}; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(CrOSComponentInstallerTraits); | |
| 49 }; | |
| 50 | |
| 51 #endif // defined(OS_CHROMEOS) | |
| 52 | |
| 53 // Register a CrOS component. | |
| 54 // It must be called on UI thread. | |
| 55 bool RegisterCrOSComponent(ComponentUpdateService* cus, | |
| 56 const std::string& name); | |
| 57 | |
| 58 } // namespace component_updater | |
| 59 | |
| 60 #endif // CHROME_BROWSER_COMPONENT_UPDATER_CROS_COMPONENT_INSTALLER_H_ | |
| OLD | NEW |