OLD | NEW |
---|---|
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 #include "chrome/browser/component_updater/cros_component_installer.h" | 5 #include "chrome/browser/component_updater/cros_component_installer.h" |
6 #include "base/task_scheduler/post_task.h" | 6 #include "base/task_scheduler/post_task.h" |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/component_updater/component_installer_errors.h" | 8 #include "chrome/browser/component_updater/component_installer_errors.h" |
9 #include "components/component_updater/component_updater_paths.h" | 9 #include "components/component_updater/component_updater_paths.h" |
10 #include "components/crx_file/id_util.h" | 10 #include "components/crx_file/id_util.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 } | 88 } |
89 BrowserThread::PostTask( | 89 BrowserThread::PostTask( |
90 BrowserThread::UI, FROM_HERE, | 90 BrowserThread::UI, FROM_HERE, |
91 base::Bind(&ImageLoaderRegistration, version, install_dir, name)); | 91 base::Bind(&ImageLoaderRegistration, version, install_dir, name)); |
92 return update_client::CrxInstaller::Result(update_client::InstallError::NONE); | 92 return update_client::CrxInstaller::Result(update_client::InstallError::NONE); |
93 } | 93 } |
94 | 94 |
95 void CrOSComponentInstallerTraits::ComponentReady( | 95 void CrOSComponentInstallerTraits::ComponentReady( |
96 const base::Version& version, | 96 const base::Version& version, |
97 const base::FilePath& path, | 97 const base::FilePath& path, |
98 std::unique_ptr<base::DictionaryValue> manifest) {} | 98 std::unique_ptr<base::DictionaryValue> manifest) { |
99 g_browser_process->platform_part()->AddCompatibleCrOSComponent(GetName()); | |
100 } | |
99 | 101 |
100 bool CrOSComponentInstallerTraits::VerifyInstallation( | 102 bool CrOSComponentInstallerTraits::VerifyInstallation( |
101 const base::DictionaryValue& manifest, | 103 const base::DictionaryValue& manifest, |
102 const base::FilePath& install_dir) const { | 104 const base::FilePath& install_dir) const { |
103 return true; | 105 return true; |
104 } | 106 } |
105 | 107 |
106 base::FilePath CrOSComponentInstallerTraits::GetRelativeInstallDir() const { | 108 base::FilePath CrOSComponentInstallerTraits::GetRelativeInstallDir() const { |
107 return base::FilePath(name); | 109 return base::FilePath(name); |
108 } | 110 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 const update_client::Callback& install_callback) { | 148 const update_client::Callback& install_callback) { |
147 cus->GetOnDemandUpdater().OnDemandUpdate(id, install_callback); | 149 cus->GetOnDemandUpdater().OnDemandUpdate(id, install_callback); |
148 } | 150 } |
149 | 151 |
150 bool CrOSComponent::InstallCrOSComponent( | 152 bool CrOSComponent::InstallCrOSComponent( |
151 const std::string& name, | 153 const std::string& name, |
152 const update_client::Callback& install_callback) { | 154 const update_client::Callback& install_callback) { |
153 auto* const cus = g_browser_process->component_updater(); | 155 auto* const cus = g_browser_process->component_updater(); |
154 const ConfigMap components = { | 156 const ConfigMap components = { |
155 {"epson-inkjet-printer-escpr", | 157 {"epson-inkjet-printer-escpr", |
156 {{"env_version", "0.0"}, | 158 {{"env_version", "2.0"}, |
waffles
2017/05/24 21:14:35
Did you mean to change this line?
xiaochu
2017/05/24 21:35:37
Done.
Sorry about that. I'm saving this to next C
| |
157 {"sha2hashstr", | 159 {"sha2hashstr", |
158 "1913a5e0a6cad30b6f03e176177e0d7ed62c5d6700a9c66da556d7c3f5d6a47e"}}}}; | 160 "1913a5e0a6cad30b6f03e176177e0d7ed62c5d6700a9c66da556d7c3f5d6a47e"}}}}; |
159 if (name.empty()) { | 161 if (name.empty()) { |
160 base::PostTask( | 162 base::PostTask( |
161 FROM_HERE, | 163 FROM_HERE, |
162 base::Bind(install_callback, update_client::Error::INVALID_ARGUMENT)); | 164 base::Bind(install_callback, update_client::Error::INVALID_ARGUMENT)); |
163 return false; | 165 return false; |
164 } | 166 } |
165 const auto it = components.find(name); | 167 const auto it = components.find(name); |
166 if (it == components.end()) { | 168 if (it == components.end()) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 chromeos::DBusThreadManager::Get()->GetImageLoaderClient(); | 208 chromeos::DBusThreadManager::Get()->GetImageLoaderClient(); |
207 if (loader) { | 209 if (loader) { |
208 loader->LoadComponent(name, base::Bind(&MountResult, mount_callback)); | 210 loader->LoadComponent(name, base::Bind(&MountResult, mount_callback)); |
209 } else { | 211 } else { |
210 DVLOG(1) << "Failed to get ImageLoaderClient object."; | 212 DVLOG(1) << "Failed to get ImageLoaderClient object."; |
211 } | 213 } |
212 } | 214 } |
213 #endif // defined(OS_CHROMEOS | 215 #endif // defined(OS_CHROMEOS |
214 | 216 |
215 } // namespace component_updater | 217 } // namespace component_updater |
OLD | NEW |