Chromium Code Reviews| 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 #include "components/nacl/renderer/json_manifest.h" | 5 #include "components/nacl/renderer/json_manifest.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 error_info->string = | 435 error_info->string = |
| 436 "could not resolve url '" + nexe_url + | 436 "could not resolve url '" + nexe_url + |
| 437 "' relative to manifest base url '" + manifest_base_url_.c_str() + | 437 "' relative to manifest base url '" + manifest_base_url_.c_str() + |
| 438 "'."; | 438 "'."; |
| 439 return false; | 439 return false; |
| 440 } | 440 } |
| 441 *full_url = resolved_gurl.possibly_invalid_spec(); | 441 *full_url = resolved_gurl.possibly_invalid_spec(); |
| 442 return true; | 442 return true; |
| 443 } | 443 } |
| 444 | 444 |
| 445 void JsonManifest::GetFiles( | |
| 446 std::vector<std::pair<std::string, std::string> >* out_files, | |
| 447 const std::string& scheme) const { | |
|
Mark Seaborn
2015/02/12 03:57:34
If this arg is always the same, you might as well
Yusuke Sato
2015/02/13 23:01:17
Done.
| |
| 448 const Json::Value& files = dictionary_[kFilesKey]; | |
| 449 if (!files.isObject()) | |
| 450 return; | |
| 451 | |
| 452 const std::vector<std::string>& keys = files.getMemberNames(); | |
| 453 for (size_t i = 0; i < keys.size(); ++i) { | |
| 454 std::string full_url; | |
| 455 PP_PNaClOptions unused_pnacl_options; // pnacl does not support "files". | |
| 456 // We skip invalid entries in "files". | |
| 457 if (GetKeyUrl(files, keys[i], &full_url, &unused_pnacl_options)) { | |
| 458 if (scheme.empty() || GURL(full_url).SchemeIs(scheme.c_str())) | |
|
Mark Seaborn
2015/02/12 03:57:34
scheme is always passed as "chrome-extension", so
Yusuke Sato
2015/02/13 23:01:17
Done.
| |
| 459 out_files->push_back(std::make_pair(full_url, keys[i])); | |
| 460 } | |
| 461 } | |
| 462 } | |
| 463 | |
| 445 bool JsonManifest::ResolveKey(const std::string& key, | 464 bool JsonManifest::ResolveKey(const std::string& key, |
| 446 std::string* full_url, | 465 std::string* full_url, |
| 447 PP_PNaClOptions* pnacl_options) const { | 466 PP_PNaClOptions* pnacl_options) const { |
| 448 // key must be one of kProgramKey or kFileKey '/' file-section-key | 467 // key must be one of kProgramKey or kFileKey '/' file-section-key |
| 449 if (full_url == NULL || pnacl_options == NULL) | 468 if (full_url == NULL || pnacl_options == NULL) |
| 450 return false; | 469 return false; |
| 451 | 470 |
| 452 if (key == kProgramKey) | 471 if (key == kProgramKey) |
| 453 return GetKeyUrl(dictionary_, key, full_url, pnacl_options); | 472 return GetKeyUrl(dictionary_, key, full_url, pnacl_options); |
| 454 | 473 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 645 } else { | 664 } else { |
| 646 // NaCl | 665 // NaCl |
| 647 *url = isa_spec[kUrlKey].asString(); | 666 *url = isa_spec[kUrlKey].asString(); |
| 648 pnacl_options->translate = PP_FALSE; | 667 pnacl_options->translate = PP_FALSE; |
| 649 } | 668 } |
| 650 | 669 |
| 651 return true; | 670 return true; |
| 652 } | 671 } |
| 653 | 672 |
| 654 } // namespace nacl | 673 } // namespace nacl |
| OLD | NEW |