| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 294 |
| 295 return pnacl_component; | 295 return pnacl_component; |
| 296 } | 296 } |
| 297 | 297 |
| 298 namespace { | 298 namespace { |
| 299 | 299 |
| 300 void FinishPnaclUpdateRegistration( | 300 void FinishPnaclUpdateRegistration( |
| 301 const Version& current_version, | 301 const Version& current_version, |
| 302 const std::string& current_fingerprint, | 302 const std::string& current_fingerprint, |
| 303 const scoped_refptr<PnaclComponentInstaller>& pci) { | 303 const scoped_refptr<PnaclComponentInstaller>& pci) { |
| 304 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 304 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 305 pci->set_current_version(current_version); | 305 pci->set_current_version(current_version); |
| 306 CheckVersionCompatiblity(current_version); | 306 CheckVersionCompatiblity(current_version); |
| 307 pci->set_current_fingerprint(current_fingerprint); | 307 pci->set_current_fingerprint(current_fingerprint); |
| 308 CrxComponent pnacl_component = pci->GetCrxComponent(); | 308 CrxComponent pnacl_component = pci->GetCrxComponent(); |
| 309 | 309 |
| 310 ComponentUpdateService::Status status = | 310 ComponentUpdateService::Status status = |
| 311 pci->cus()->RegisterComponent(pnacl_component); | 311 pci->cus()->RegisterComponent(pnacl_component); |
| 312 if (status != ComponentUpdateService::Status::kOk && | 312 if (status != ComponentUpdateService::Status::kOk && |
| 313 status != ComponentUpdateService::Status::kReplaced) { | 313 status != ComponentUpdateService::Status::kReplaced) { |
| 314 NOTREACHED() << "Pnacl component registration failed."; | 314 NOTREACHED() << "Pnacl component registration failed."; |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 | 317 |
| 318 // Check if there is an existing version on disk first to know when | 318 // Check if there is an existing version on disk first to know when |
| 319 // a hosted version is actually newer. | 319 // a hosted version is actually newer. |
| 320 void StartPnaclUpdateRegistration( | 320 void StartPnaclUpdateRegistration( |
| 321 const scoped_refptr<PnaclComponentInstaller>& pci) { | 321 const scoped_refptr<PnaclComponentInstaller>& pci) { |
| 322 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 322 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 323 base::FilePath path = pci->GetPnaclBaseDirectory(); | 323 base::FilePath path = pci->GetPnaclBaseDirectory(); |
| 324 if (!base::PathExists(path)) { | 324 if (!base::PathExists(path)) { |
| 325 if (!base::CreateDirectory(path)) { | 325 if (!base::CreateDirectory(path)) { |
| 326 NOTREACHED() << "Could not create base Pnacl directory."; | 326 NOTREACHED() << "Could not create base Pnacl directory."; |
| 327 return; | 327 return; |
| 328 } | 328 } |
| 329 } | 329 } |
| 330 | 330 |
| 331 Version current_version(kNullVersion); | 331 Version current_version(kNullVersion); |
| 332 std::string current_fingerprint; | 332 std::string current_fingerprint; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 } // namespace component_updater | 379 } // namespace component_updater |
| 380 | 380 |
| 381 namespace pnacl { | 381 namespace pnacl { |
| 382 | 382 |
| 383 bool NeedsOnDemandUpdate() { | 383 bool NeedsOnDemandUpdate() { |
| 384 return base::subtle::NoBarrier_Load( | 384 return base::subtle::NoBarrier_Load( |
| 385 &component_updater::needs_on_demand_update) != 0; | 385 &component_updater::needs_on_demand_update) != 0; |
| 386 } | 386 } |
| 387 | 387 |
| 388 } // namespace pnacl | 388 } // namespace pnacl |
| OLD | NEW |