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(base::StartsWithASCII(url, kPNaClTranslatorBaseUrl, true)); | 613 DCHECK(base::StartsWith(url, kPNaClTranslatorBaseUrl, |
| 614 base::CompareCase::SENSITIVE)); |
614 std::string r = url.substr(std::string(kPNaClTranslatorBaseUrl).length()); | 615 std::string r = url.substr(std::string(kPNaClTranslatorBaseUrl).length()); |
615 | 616 |
616 // Use white-listed-chars. | 617 // Use white-listed-chars. |
617 size_t replace_pos; | 618 size_t replace_pos; |
618 static const char* white_list = "abcdefghijklmnopqrstuvwxyz0123456789_"; | 619 static const char* white_list = "abcdefghijklmnopqrstuvwxyz0123456789_"; |
619 replace_pos = r.find_first_not_of(white_list); | 620 replace_pos = r.find_first_not_of(white_list); |
620 while(replace_pos != std::string::npos) { | 621 while(replace_pos != std::string::npos) { |
621 r = r.replace(replace_pos, 1, "_"); | 622 r = r.replace(replace_pos, 1, "_"); |
622 replace_pos = r.find_first_not_of(white_list); | 623 replace_pos = r.find_first_not_of(white_list); |
623 } | 624 } |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1701 &StreamPexe | 1702 &StreamPexe |
1702 }; | 1703 }; |
1703 | 1704 |
1704 } // namespace | 1705 } // namespace |
1705 | 1706 |
1706 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1707 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
1707 return &nacl_interface; | 1708 return &nacl_interface; |
1708 } | 1709 } |
1709 | 1710 |
1710 } // namespace nacl | 1711 } // namespace nacl |
OLD | NEW |