OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ppb_nacl_private_impl.h" | 5 #include "components/nacl/renderer/ppb_nacl_private_impl.h" |
6 | 6 |
7 #include <numeric> | 7 #include <numeric> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 } | 603 } |
604 | 604 |
605 // Convert a URL to a filename for GetReadonlyPnaclFd. | 605 // Convert a URL to a filename for GetReadonlyPnaclFd. |
606 // Must be kept in sync with PnaclCanOpenFile() in | 606 // Must be kept in sync with PnaclCanOpenFile() in |
607 // components/nacl/browser/nacl_file_host.cc. | 607 // components/nacl/browser/nacl_file_host.cc. |
608 std::string PnaclComponentURLToFilename(const std::string& url) { | 608 std::string PnaclComponentURLToFilename(const std::string& url) { |
609 // PNaCl component URLs aren't arbitrary URLs; they are always either | 609 // PNaCl component URLs aren't arbitrary URLs; they are always either |
610 // generated from ManifestResolveKey or PnaclResources::ReadResourceInfo. | 610 // generated from ManifestResolveKey or PnaclResources::ReadResourceInfo. |
611 // So, it's safe to just use string parsing operations here instead of | 611 // So, it's safe to just use string parsing operations here instead of |
612 // URL-parsing ones. | 612 // URL-parsing ones. |
613 DCHECK(StartsWithASCII(url, kPNaClTranslatorBaseUrl, true)); | 613 DCHECK(base::StartsWithASCII(url, kPNaClTranslatorBaseUrl, true)); |
614 std::string r = url.substr(std::string(kPNaClTranslatorBaseUrl).length()); | 614 std::string r = url.substr(std::string(kPNaClTranslatorBaseUrl).length()); |
615 | 615 |
616 // Use white-listed-chars. | 616 // Use white-listed-chars. |
617 size_t replace_pos; | 617 size_t replace_pos; |
618 static const char* white_list = "abcdefghijklmnopqrstuvwxyz0123456789_"; | 618 static const char* white_list = "abcdefghijklmnopqrstuvwxyz0123456789_"; |
619 replace_pos = r.find_first_not_of(white_list); | 619 replace_pos = r.find_first_not_of(white_list); |
620 while(replace_pos != std::string::npos) { | 620 while(replace_pos != std::string::npos) { |
621 r = r.replace(replace_pos, 1, "_"); | 621 r = r.replace(replace_pos, 1, "_"); |
622 replace_pos = r.find_first_not_of(white_list); | 622 replace_pos = r.find_first_not_of(white_list); |
623 } | 623 } |
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1707 &StreamPexe | 1707 &StreamPexe |
1708 }; | 1708 }; |
1709 | 1709 |
1710 } // namespace | 1710 } // namespace |
1711 | 1711 |
1712 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1712 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
1713 return &nacl_interface; | 1713 return &nacl_interface; |
1714 } | 1714 } |
1715 | 1715 |
1716 } // namespace nacl | 1716 } // namespace nacl |
OLD | NEW |