Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: chrome/browser/component_updater/cros_component_installer.h

Issue 2882133003: component_updater: add '_env_version' attribute for cros_component_installer (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/component_updater/cros_component_installer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 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_CROS_COMPONENT_INSTALLER_H_ 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_CROS_COMPONENT_INSTALLER_H_
6 #define CHROME_BROWSER_COMPONENT_UPDATER_CROS_COMPONENT_INSTALLER_H_ 6 #define CHROME_BROWSER_COMPONENT_UPDATER_CROS_COMPONENT_INSTALLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "components/component_updater/component_updater_service.h" 11 #include "components/component_updater/component_updater_service.h"
12 #include "components/component_updater/default_component_installer.h" 12 #include "components/component_updater/default_component_installer.h"
13 #include "components/update_client/update_client.h" 13 #include "components/update_client/update_client.h"
14 #include "crypto/sha2.h" 14 #include "crypto/sha2.h"
15 15
16 namespace component_updater { 16 namespace component_updater {
17 17
18 #if defined(OS_CHROMEOS) 18 #if defined(OS_CHROMEOS)
19 struct ComponentConfig { 19 struct ComponentConfig {
20 std::string name; 20 std::string name;
21 std::string dir; 21 std::string env_version;
22 std::string sha2hashstr; 22 std::string sha2hashstr;
23 ComponentConfig(const std::string& name, 23 ComponentConfig(const std::string& name,
24 const std::string& dir, 24 const std::string& env_version,
25 const std::string& sha2hashstr); 25 const std::string& sha2hashstr);
26 ~ComponentConfig(); 26 ~ComponentConfig();
27 }; 27 };
28 28
29 using ConfigMap = std::map<std::string, std::map<std::string, std::string>>; 29 using ConfigMap = std::map<std::string, std::map<std::string, std::string>>;
30 30
31 class CrOSComponentInstallerTraits : public ComponentInstallerTraits { 31 class CrOSComponentInstallerTraits : public ComponentInstallerTraits {
32 public: 32 public:
33 explicit CrOSComponentInstallerTraits(const ComponentConfig& config); 33 explicit CrOSComponentInstallerTraits(const ComponentConfig& config);
34 ~CrOSComponentInstallerTraits() override {} 34 ~CrOSComponentInstallerTraits() override {}
35 35
36 private: 36 private:
37 // The following methods override ComponentInstallerTraits. 37 // The following methods override ComponentInstallerTraits.
38 bool SupportsGroupPolicyEnabledComponentUpdates() const override; 38 bool SupportsGroupPolicyEnabledComponentUpdates() const override;
39 bool RequiresNetworkEncryption() const override; 39 bool RequiresNetworkEncryption() const override;
40 update_client::CrxInstaller::Result OnCustomInstall( 40 update_client::CrxInstaller::Result OnCustomInstall(
41 const base::DictionaryValue& manifest, 41 const base::DictionaryValue& manifest,
42 const base::FilePath& install_dir) override; 42 const base::FilePath& install_dir) override;
43 bool VerifyInstallation(const base::DictionaryValue& manifest, 43 bool VerifyInstallation(const base::DictionaryValue& manifest,
44 const base::FilePath& install_dir) const override; 44 const base::FilePath& install_dir) const override;
45 void ComponentReady(const base::Version& version, 45 void ComponentReady(const base::Version& version,
46 const base::FilePath& path, 46 const base::FilePath& path,
47 std::unique_ptr<base::DictionaryValue> manifest) override; 47 std::unique_ptr<base::DictionaryValue> manifest) override;
48 base::FilePath GetRelativeInstallDir() const override; 48 base::FilePath GetRelativeInstallDir() const override;
49 void GetHash(std::vector<uint8_t>* hash) const override; 49 void GetHash(std::vector<uint8_t>* hash) const override;
50 std::string GetName() const override; 50 std::string GetName() const override;
51 update_client::InstallerAttributes GetInstallerAttributes() const override; 51 update_client::InstallerAttributes GetInstallerAttributes() const override;
52 std::vector<std::string> GetMimeTypes() const override; 52 std::vector<std::string> GetMimeTypes() const override;
53 std::string dir_name;
54 std::string name; 53 std::string name;
54 std::string env_version;
55 uint8_t kSha2Hash_[crypto::kSHA256Length] = {}; 55 uint8_t kSha2Hash_[crypto::kSHA256Length] = {};
56 56
57 DISALLOW_COPY_AND_ASSIGN(CrOSComponentInstallerTraits); 57 DISALLOW_COPY_AND_ASSIGN(CrOSComponentInstallerTraits);
58 }; 58 };
59 59
60 // This class contains functions used to register and install a component. 60 // This class contains functions used to register and install a component.
61 class CrOSComponent { 61 class CrOSComponent {
62 public: 62 public:
63 // Register and start installing a CrOS component. 63 // Register and start installing a CrOS component.
64 // |install_callback| is triggered after install finishes and returns error 64 // |install_callback| is triggered after install finishes and returns error
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 static void InstallChromeOSComponent( 115 static void InstallChromeOSComponent(
116 ComponentUpdateService* cus, 116 ComponentUpdateService* cus,
117 const std::string& id, 117 const std::string& id,
118 const update_client::Callback& install_callback); 118 const update_client::Callback& install_callback);
119 }; 119 };
120 #endif // defined(OS_CHROMEOS) 120 #endif // defined(OS_CHROMEOS)
121 121
122 } // namespace component_updater 122 } // namespace component_updater
123 123
124 #endif // CHROME_BROWSER_COMPONENT_UPDATER_CROS_COMPONENT_INSTALLER_H_ 124 #endif // CHROME_BROWSER_COMPONENT_UPDATER_CROS_COMPONENT_INSTALLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/component_updater/cros_component_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698