| 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/pnacl_component_installer.h" | 5 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 7 #include <string> | 8 #include <string> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/atomicops.h" | 11 #include "base/atomicops.h" |
| 11 #include "base/base_paths.h" | 12 #include "base/base_paths.h" |
| 12 #include "base/bind.h" | 13 #include "base/bind.h" |
| 13 #include "base/callback.h" | 14 #include "base/callback.h" |
| 14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 15 #include "base/files/file_enumerator.h" | 16 #include "base/files/file_enumerator.h" |
| 16 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 44 // in path names. This should only be characters in the set: [a-z0-9_]. | 45 // in path names. This should only be characters in the set: [a-z0-9_]. |
| 45 // Keep in sync with chrome/browser/nacl_host/nacl_file_host. | 46 // Keep in sync with chrome/browser/nacl_host/nacl_file_host. |
| 46 std::string SanitizeForPath(const std::string& input) { | 47 std::string SanitizeForPath(const std::string& input) { |
| 47 std::string result; | 48 std::string result; |
| 48 base::ReplaceChars(input, "-", "_", &result); | 49 base::ReplaceChars(input, "-", "_", &result); |
| 49 return result; | 50 return result; |
| 50 } | 51 } |
| 51 | 52 |
| 52 // Set the component's hash to the multi-CRX PNaCl package. | 53 // Set the component's hash to the multi-CRX PNaCl package. |
| 53 void SetPnaclHash(CrxComponent* component) { | 54 void SetPnaclHash(CrxComponent* component) { |
| 54 static const uint8 sha256_hash[32] = { | 55 static const uint8_t sha256_hash[32] = { |
| 55 // This corresponds to AppID: hnimpnehoodheedghdeeijklkeaacbdc | 56 // This corresponds to AppID: hnimpnehoodheedghdeeijklkeaacbdc |
| 56 0x7d, 0x8c, 0xfd, 0x47, 0xee, 0x37, 0x44, 0x36, | 57 0x7d, 0x8c, 0xfd, 0x47, 0xee, 0x37, 0x44, 0x36, |
| 57 0x73, 0x44, 0x89, 0xab, 0xa4, 0x00, 0x21, 0x32, | 58 0x73, 0x44, 0x89, 0xab, 0xa4, 0x00, 0x21, 0x32, |
| 58 0x4a, 0x06, 0x06, 0xf1, 0x51, 0x3c, 0x51, 0xba, | 59 0x4a, 0x06, 0x06, 0xf1, 0x51, 0x3c, 0x51, 0xba, |
| 59 0x31, 0x2f, 0xbc, 0xb3, 0x99, 0x07, 0xdc, 0x9c | 60 0x31, 0x2f, 0xbc, 0xb3, 0x99, 0x07, 0xdc, 0x9c |
| 60 }; | 61 }; |
| 61 | 62 |
| 62 component->pk_hash.assign(sha256_hash, &sha256_hash[arraysize(sha256_hash)]); | 63 component->pk_hash.assign(sha256_hash, &sha256_hash[arraysize(sha256_hash)]); |
| 63 } | 64 } |
| 64 | 65 |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 } // namespace component_updater | 372 } // namespace component_updater |
| 372 | 373 |
| 373 namespace pnacl { | 374 namespace pnacl { |
| 374 | 375 |
| 375 bool NeedsOnDemandUpdate() { | 376 bool NeedsOnDemandUpdate() { |
| 376 return base::subtle::NoBarrier_Load( | 377 return base::subtle::NoBarrier_Load( |
| 377 &component_updater::needs_on_demand_update) != 0; | 378 &component_updater::needs_on_demand_update) != 0; |
| 378 } | 379 } |
| 379 | 380 |
| 380 } // namespace pnacl | 381 } // namespace pnacl |
| OLD | NEW |