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. | |
Sorin Jianu
2017/03/03 02:19:03
Needs an empty line after this.
xiaochu
2017/03/03 17:16:25
Done.
| |
4 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_CROS_COMPONENT_INSTALLER_H_ | |
5 #define CHROME_BROWSER_COMPONENT_UPDATER_CROS_COMPONENT_INSTALLER_H_ | |
6 | |
7 #include <string> | |
8 | |
9 #include "components/component_updater/default_component_installer.h" | |
10 #include "crypto/sha2.h" | |
11 | |
12 #if defined(OS_CHROMEOS) | |
13 #include "build/build_config.h" | |
Sorin Jianu
2017/03/03 02:19:03
This can and must be included outside the #if dire
xiaochu
2017/03/03 17:16:25
Done.
| |
14 #endif // defined(OS_CHROMEOS) | |
15 | |
16 namespace component_updater { | |
17 | |
18 class ComponentUpdateService; | |
19 | |
20 struct ComponentConfig { | |
21 std::string name; | |
22 std::string dir; | |
23 std::string sha2hashstr; | |
24 ComponentConfig(const std::string& name, | |
25 const std::string& dir, | |
26 const std::string& sha2hashstr) | |
27 : name(name), dir(dir), sha2hashstr(sha2hashstr) {} | |
Sorin Jianu
2017/03/03 02:19:03
we want to define the ctor and dtor in a cc file,
xiaochu
2017/03/03 17:16:25
Done.
| |
28 ~ComponentConfig() {} | |
29 }; | |
30 #if defined(OS_CHROMEOS) | |
Sorin Jianu
2017/03/03 02:19:03
an empty line between 29 and 30 would be helpful
xiaochu
2017/03/03 17:16:25
Done.
| |
31 class CrOSComponentInstallerTraits : public ComponentInstallerTraits { | |
32 public: | |
33 explicit CrOSComponentInstallerTraits(const ComponentConfig& config); | |
34 ~CrOSComponentInstallerTraits() override {} | |
35 | |
36 private: | |
37 // The following methods override ComponentInstallerTraits. | |
38 bool SupportsGroupPolicyEnabledComponentUpdates() const override; | |
39 bool RequiresNetworkEncryption() const override; | |
40 update_client::CrxInstaller::Result OnCustomInstall( | |
41 const base::DictionaryValue& manifest, | |
42 const base::FilePath& install_dir) override; | |
43 bool VerifyInstallation(const base::DictionaryValue& manifest, | |
44 const base::FilePath& install_dir) const override; | |
45 void ComponentReady(const base::Version& version, | |
46 const base::FilePath& path, | |
47 std::unique_ptr<base::DictionaryValue> manifest) override; | |
48 base::FilePath GetRelativeInstallDir() const override; | |
49 void GetHash(std::vector<uint8_t>* hash) const override; | |
50 std::string GetName() const override; | |
51 update_client::InstallerAttributes GetInstallerAttributes() const override; | |
52 std::vector<std::string> GetMimeTypes() const override; | |
53 std::string dir_name; | |
54 std::string name; | |
55 uint8_t kSha2Hash_[crypto::kSHA256Length] = {}; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(CrOSComponentInstallerTraits); | |
58 }; | |
59 | |
60 #endif // defined(OS_CHROMEOS) | |
61 | |
62 // Register a CrOS component. | |
63 // It must be called on UI thread. | |
64 bool RegisterCrOSComponent(ComponentUpdateService* cus, | |
65 const std::string& name); | |
66 | |
67 } // namespace component_updater | |
68 | |
69 #endif // CHROME_BROWSER_COMPONENT_UPDATER_CROS_COMPONENT_INSTALLER_H_ | |
OLD | NEW |