OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_COMPONENT_UPDATER_DEFAULT_COMPONENT_INSTALLER_H_ | 5 #ifndef COMPONENTS_COMPONENT_UPDATER_DEFAULT_COMPONENT_INSTALLER_H_ |
6 #define COMPONENTS_COMPONENT_UPDATER_DEFAULT_COMPONENT_INSTALLER_H_ | 6 #define COMPONENTS_COMPONENT_UPDATER_DEFAULT_COMPONENT_INSTALLER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 // Registers the component for update checks and installs. | 92 // Registers the component for update checks and installs. |
93 void Register(ComponentUpdateService* cus); | 93 void Register(ComponentUpdateService* cus); |
94 | 94 |
95 // Overridden from ComponentInstaller: | 95 // Overridden from ComponentInstaller: |
96 void OnUpdateError(int error) override; | 96 void OnUpdateError(int error) override; |
97 bool Install(const base::DictionaryValue& manifest, | 97 bool Install(const base::DictionaryValue& manifest, |
98 const base::FilePath& unpack_path) override; | 98 const base::FilePath& unpack_path) override; |
99 bool GetInstalledFile(const std::string& file, | 99 bool GetInstalledFile(const std::string& file, |
100 base::FilePath* installed_file) override; | 100 base::FilePath* installed_file) override; |
| 101 bool Uninstall() override; |
101 | 102 |
102 private: | 103 private: |
103 ~DefaultComponentInstaller() override; | 104 ~DefaultComponentInstaller() override; |
104 | 105 |
105 base::FilePath GetInstallDirectory(); | 106 base::FilePath GetInstallDirectory(); |
106 bool InstallHelper(const base::DictionaryValue& manifest, | 107 bool InstallHelper(const base::DictionaryValue& manifest, |
107 const base::FilePath& unpack_path, | 108 const base::FilePath& unpack_path, |
108 const base::FilePath& install_path); | 109 const base::FilePath& install_path); |
109 void StartRegistration(ComponentUpdateService* cus); | 110 void StartRegistration(ComponentUpdateService* cus); |
110 void FinishRegistration(ComponentUpdateService* cus); | 111 void FinishRegistration(ComponentUpdateService* cus); |
111 void ComponentReady(scoped_ptr<base::DictionaryValue> manifest); | 112 void ComponentReady(scoped_ptr<base::DictionaryValue> manifest); |
| 113 void UninstallOnTaskRunner(); |
112 | 114 |
113 base::Version current_version_; | 115 base::Version current_version_; |
114 std::string current_fingerprint_; | 116 std::string current_fingerprint_; |
115 scoped_ptr<base::DictionaryValue> current_manifest_; | 117 scoped_ptr<base::DictionaryValue> current_manifest_; |
116 scoped_ptr<ComponentInstallerTraits> installer_traits_; | 118 scoped_ptr<ComponentInstallerTraits> installer_traits_; |
117 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 119 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
118 | 120 |
119 // Used to post responses back to the main thread. Initialized on the main | 121 // Used to post responses back to the main thread. Initialized on the main |
120 // loop but accessed from the task runner. | 122 // loop but accessed from the task runner. |
121 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 123 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
122 | 124 |
123 base::ThreadChecker thread_checker_; | 125 base::ThreadChecker thread_checker_; |
124 | 126 |
125 DISALLOW_COPY_AND_ASSIGN(DefaultComponentInstaller); | 127 DISALLOW_COPY_AND_ASSIGN(DefaultComponentInstaller); |
126 }; | 128 }; |
127 | 129 |
128 } // namespace component_updater | 130 } // namespace component_updater |
129 | 131 |
130 #endif // COMPONENTS_COMPONENT_UPDATER_DEFAULT_COMPONENT_INSTALLER_H_ | 132 #endif // COMPONENTS_COMPONENT_UPDATER_DEFAULT_COMPONENT_INSTALLER_H_ |
OLD | NEW |