| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/pnacl_component_installer.h" | 5 #include "chrome/browser/component_updater/pnacl_component_installer.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 OverrideDirPnaclComponent(path); | 265 OverrideDirPnaclComponent(path); |
| 266 return true; | 266 return true; |
| 267 } | 267 } |
| 268 | 268 |
| 269 // Given |file|, which can be a path like "_platform_specific/arm/pnacl_foo", | 269 // Given |file|, which can be a path like "_platform_specific/arm/pnacl_foo", |
| 270 // returns the assumed install path. The path separator in |file| is '/' | 270 // returns the assumed install path. The path separator in |file| is '/' |
| 271 // for all platforms. Caller is responsible for checking that the | 271 // for all platforms. Caller is responsible for checking that the |
| 272 // |installed_file| actually exists. | 272 // |installed_file| actually exists. |
| 273 bool PnaclComponentInstaller::GetInstalledFile(const std::string& file, | 273 bool PnaclComponentInstaller::GetInstalledFile(const std::string& file, |
| 274 base::FilePath* installed_file) { | 274 base::FilePath* installed_file) { |
| 275 if (current_version().Equals(Version(kNullVersion))) | 275 if (current_version() == Version(kNullVersion)) |
| 276 return false; | 276 return false; |
| 277 | 277 |
| 278 *installed_file = GetPnaclBaseDirectory() | 278 *installed_file = GetPnaclBaseDirectory() |
| 279 .AppendASCII(current_version().GetString()) | 279 .AppendASCII(current_version().GetString()) |
| 280 .AppendASCII(file); | 280 .AppendASCII(file); |
| 281 return true; | 281 return true; |
| 282 } | 282 } |
| 283 | 283 |
| 284 bool PnaclComponentInstaller::Uninstall() { | 284 bool PnaclComponentInstaller::Uninstall() { |
| 285 return false; | 285 return false; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 scoped_ptr<base::DictionaryValue> manifest(ReadComponentManifest(path)); | 332 scoped_ptr<base::DictionaryValue> manifest(ReadComponentManifest(path)); |
| 333 scoped_ptr<base::DictionaryValue> pnacl_manifest(ReadPnaclManifest(path)); | 333 scoped_ptr<base::DictionaryValue> pnacl_manifest(ReadPnaclManifest(path)); |
| 334 Version manifest_version; | 334 Version manifest_version; |
| 335 // Check that the component manifest and PNaCl manifest files | 335 // Check that the component manifest and PNaCl manifest files |
| 336 // are legit, and that the indicated version matches the one | 336 // are legit, and that the indicated version matches the one |
| 337 // encoded within the path name. | 337 // encoded within the path name. |
| 338 if (manifest == NULL || pnacl_manifest == NULL || | 338 if (manifest == NULL || pnacl_manifest == NULL || |
| 339 !CheckPnaclComponentManifest(*manifest, | 339 !CheckPnaclComponentManifest(*manifest, |
| 340 *pnacl_manifest, | 340 *pnacl_manifest, |
| 341 &manifest_version) || | 341 &manifest_version) || |
| 342 !current_version.Equals(manifest_version)) { | 342 current_version != manifest_version) { |
| 343 current_version = Version(kNullVersion); | 343 current_version = Version(kNullVersion); |
| 344 } else { | 344 } else { |
| 345 OverrideDirPnaclComponent(path); | 345 OverrideDirPnaclComponent(path); |
| 346 base::ReadFileToString(path.AppendASCII("manifest.fingerprint"), | 346 base::ReadFileToString(path.AppendASCII("manifest.fingerprint"), |
| 347 ¤t_fingerprint); | 347 ¤t_fingerprint); |
| 348 } | 348 } |
| 349 } | 349 } |
| 350 | 350 |
| 351 BrowserThread::PostTask(BrowserThread::UI, | 351 BrowserThread::PostTask(BrowserThread::UI, |
| 352 FROM_HERE, | 352 FROM_HERE, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 376 } // namespace component_updater | 376 } // namespace component_updater |
| 377 | 377 |
| 378 namespace pnacl { | 378 namespace pnacl { |
| 379 | 379 |
| 380 bool NeedsOnDemandUpdate() { | 380 bool NeedsOnDemandUpdate() { |
| 381 return base::subtle::NoBarrier_Load( | 381 return base::subtle::NoBarrier_Load( |
| 382 &component_updater::needs_on_demand_update) != 0; | 382 &component_updater::needs_on_demand_update) != 0; |
| 383 } | 383 } |
| 384 | 384 |
| 385 } // namespace pnacl | 385 } // namespace pnacl |
| OLD | NEW |