Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: ppapi/native_client/src/trusted/plugin/json_manifest.cc

Issue 231853003: Pepper: Remove Manifest::ResolveURL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nit Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 const Json::Value& isa_dict = dictionary[key]; 573 const Json::Value& isa_dict = dictionary[key];
574 nacl::string relative_url; 574 nacl::string relative_url;
575 bool uses_nonsfi_mode; 575 bool uses_nonsfi_mode;
576 if (!GetURLFromISADictionary(isa_dict, key, &relative_url, 576 if (!GetURLFromISADictionary(isa_dict, key, &relative_url,
577 pnacl_options, &uses_nonsfi_mode, error_info)) { 577 pnacl_options, &uses_nonsfi_mode, error_info)) {
578 return false; 578 return false;
579 } 579 }
580 return ResolveURL(relative_url, full_url, error_info); 580 return ResolveURL(relative_url, full_url, error_info);
581 } 581 }
582 582
583 bool JsonManifest::ResolveURL(const nacl::string& relative_url,
584 nacl::string* full_url,
585 ErrorInfo* error_info) const {
586 // The contents of the manifest are resolved relative to the manifest URL.
587 CHECK(url_util_ != NULL);
588 pp::Var resolved_url =
589 url_util_->ResolveRelativeToURL(pp::Var(manifest_base_url_),
590 relative_url);
591 if (!resolved_url.is_string()) {
592 error_info->SetReport(
593 PP_NACL_ERROR_MANIFEST_RESOLVE_URL,
594 "could not resolve url '" + relative_url +
595 "' relative to manifest base url '" + manifest_base_url_.c_str() +
596 "'.");
597 return false;
598 }
599 *full_url = resolved_url.AsString();
600 return true;
601 }
602
603 bool JsonManifest::GetProgramURL(nacl::string* full_url, 583 bool JsonManifest::GetProgramURL(nacl::string* full_url,
604 PnaclOptions* pnacl_options, 584 PnaclOptions* pnacl_options,
605 bool* uses_nonsfi_mode, 585 bool* uses_nonsfi_mode,
606 ErrorInfo* error_info) const { 586 ErrorInfo* error_info) const {
607 if (full_url == NULL || pnacl_options == NULL || error_info == NULL) 587 if (full_url == NULL || pnacl_options == NULL || error_info == NULL)
608 return false; 588 return false;
609 589
610 const Json::Value& program = dictionary_[kProgramKey]; 590 const Json::Value& program = dictionary_[kProgramKey];
611 591
612 nacl::string nexe_url; 592 nacl::string nexe_url;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 } 659 }
680 if (!files.isMember(rest)) { 660 if (!files.isMember(rest)) {
681 error_info->SetReport( 661 error_info->SetReport(
682 PP_NACL_ERROR_MANIFEST_RESOLVE_URL, 662 PP_NACL_ERROR_MANIFEST_RESOLVE_URL,
683 nacl::string("ResolveKey: no such \"files\" entry: ") + key); 663 nacl::string("ResolveKey: no such \"files\" entry: ") + key);
684 return false; 664 return false;
685 } 665 }
686 return GetKeyUrl(files, rest, full_url, pnacl_options, error_info); 666 return GetKeyUrl(files, rest, full_url, pnacl_options, error_info);
687 } 667 }
688 668
669 bool JsonManifest::ResolveURL(const nacl::string& relative_url,
670 nacl::string* full_url,
671 ErrorInfo* error_info) const {
672 // The contents of the manifest are resolved relative to the manifest URL.
673 CHECK(url_util_ != NULL);
674 pp::Var resolved_url =
675 url_util_->ResolveRelativeToURL(pp::Var(manifest_base_url_),
676 relative_url);
677 if (!resolved_url.is_string()) {
678 error_info->SetReport(
679 PP_NACL_ERROR_MANIFEST_RESOLVE_URL,
680 "could not resolve url '" + relative_url +
681 "' relative to manifest base url '" + manifest_base_url_.c_str() +
682 "'.");
683 return false;
684 }
685 *full_url = resolved_url.AsString();
686 return true;
687 }
688
689 } // namespace plugin 689 } // namespace plugin
OLDNEW
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/json_manifest.h ('k') | ppapi/native_client/src/trusted/plugin/manifest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698