OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ppapi/native_client/src/trusted/plugin/json_manifest.h" | 9 #include "ppapi/native_client/src/trusted/plugin/json_manifest.h" |
10 | 10 |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 &nexe_url, | 602 &nexe_url, |
603 pnacl_options, | 603 pnacl_options, |
604 uses_nonsfi_mode, | 604 uses_nonsfi_mode, |
605 error_info)) { | 605 error_info)) { |
606 return false; | 606 return false; |
607 } | 607 } |
608 | 608 |
609 return ResolveURL(nexe_url, full_url, error_info); | 609 return ResolveURL(nexe_url, full_url, error_info); |
610 } | 610 } |
611 | 611 |
612 bool JsonManifest::GetFileKeys(std::set<nacl::string>* keys) const { | |
613 if (!dictionary_.isMember(kFilesKey)) { | |
614 // trivial success: no keys when there is no "files" section. | |
615 return true; | |
616 } | |
617 const Json::Value& files = dictionary_[kFilesKey]; | |
618 CHECK(files.isObject()); | |
619 Json::Value::Members members = files.getMemberNames(); | |
620 for (size_t i = 0; i < members.size(); ++i) { | |
621 keys->insert(members[i]); | |
622 } | |
623 return true; | |
624 } | |
625 | |
626 bool JsonManifest::ResolveKey(const nacl::string& key, | 612 bool JsonManifest::ResolveKey(const nacl::string& key, |
627 nacl::string* full_url, | 613 nacl::string* full_url, |
628 PP_PNaClOptions* pnacl_options, | 614 PP_PNaClOptions* pnacl_options, |
629 ErrorInfo* error_info) const { | 615 ErrorInfo* error_info) const { |
630 NaClLog(3, "JsonManifest::ResolveKey(%s)\n", key.c_str()); | 616 NaClLog(3, "JsonManifest::ResolveKey(%s)\n", key.c_str()); |
631 // key must be one of kProgramKey or kFileKey '/' file-section-key | 617 // key must be one of kProgramKey or kFileKey '/' file-section-key |
632 | 618 |
633 if (full_url == NULL || pnacl_options == NULL || error_info == NULL) | 619 if (full_url == NULL || pnacl_options == NULL || error_info == NULL) |
634 return false; | 620 return false; |
635 | 621 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 "could not resolve url '" + relative_url + | 671 "could not resolve url '" + relative_url + |
686 "' relative to manifest base url '" + manifest_base_url_.c_str() + | 672 "' relative to manifest base url '" + manifest_base_url_.c_str() + |
687 "'."); | 673 "'."); |
688 return false; | 674 return false; |
689 } | 675 } |
690 *full_url = resolved_url.AsString(); | 676 *full_url = resolved_url.AsString(); |
691 return true; | 677 return true; |
692 } | 678 } |
693 | 679 |
694 } // namespace plugin | 680 } // namespace plugin |
OLD | NEW |