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 "native_client/src/trusted/plugin/pnacl_resources.h" | 5 #include "native_client/src/trusted/plugin/pnacl_resources.h" |
6 | 6 |
7 #include "native_client/src/include/portability_io.h" | 7 #include "native_client/src/include/portability_io.h" |
8 #include "native_client/src/shared/platform/nacl_check.h" | 8 #include "native_client/src/shared/platform/nacl_check.h" |
9 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" | 9 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" |
10 #include "native_client/src/trusted/plugin/manifest.h" | 10 #include "native_client/src/trusted/plugin/manifest.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 } else { | 34 } else { |
35 return nacl::string(kPnaclComponentID) + GetSandboxISA() + "/"; | 35 return nacl::string(kPnaclComponentID) + GetSandboxISA() + "/"; |
36 } | 36 } |
37 } | 37 } |
38 | 38 |
39 bool PnaclUrls::IsPnaclComponent(const nacl::string& full_url) { | 39 bool PnaclUrls::IsPnaclComponent(const nacl::string& full_url) { |
40 return full_url.find(kPnaclComponentID, 0) == 0; | 40 return full_url.find(kPnaclComponentID, 0) == 0; |
41 } | 41 } |
42 | 42 |
43 // Convert a URL to a filename accepted by GetReadonlyPnaclFd. | 43 // Convert a URL to a filename accepted by GetReadonlyPnaclFd. |
44 // Must be kept in sync with pnacl_file_host.cc. | 44 // Must be kept in sync with chrome/browser/nacl_host/nacl_file_host. |
45 nacl::string PnaclUrls::PnaclComponentURLToFilename( | 45 nacl::string PnaclUrls::PnaclComponentURLToFilename( |
46 const nacl::string& full_url) { | 46 const nacl::string& full_url) { |
47 // strip componentID. | 47 // strip componentID. |
48 nacl::string r = full_url.substr(nacl::string(kPnaclComponentID).length()); | 48 nacl::string r = full_url.substr(nacl::string(kPnaclComponentID).length()); |
49 | 49 |
50 // Use white-listed-chars. | 50 // Use white-listed-chars. |
51 size_t replace_pos; | 51 size_t replace_pos; |
52 static const char* white_list = "abcdefghijklmnopqrstuvwxyz0123456789_"; | 52 static const char* white_list = "abcdefghijklmnopqrstuvwxyz0123456789_"; |
53 replace_pos = r.find_first_not_of(white_list); | 53 replace_pos = r.find_first_not_of(white_list); |
54 while(replace_pos != nacl::string::npos) { | 54 while(replace_pos != nacl::string::npos) { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 pp_error, | 188 pp_error, |
189 "PnaclResources::ResourceReady failed."); | 189 "PnaclResources::ResourceReady failed."); |
190 } else { | 190 } else { |
191 resource_wrappers_[url] = | 191 resource_wrappers_[url] = |
192 plugin_->wrapper_factory()->MakeFileDesc(fd, O_RDONLY); | 192 plugin_->wrapper_factory()->MakeFileDesc(fd, O_RDONLY); |
193 delayed_callback_->RunIfTime(); | 193 delayed_callback_->RunIfTime(); |
194 } | 194 } |
195 } | 195 } |
196 | 196 |
197 } // namespace plugin | 197 } // namespace plugin |
OLD | NEW |