OLD | NEW |
1 /* Based on nsURLParsers.cc from Mozilla | 1 /* Based on nsURLParsers.cc from Mozilla |
2 * ------------------------------------- | 2 * ------------------------------------- |
3 * The contents of this file are subject to the Mozilla Public License Version | 3 * The contents of this file are subject to the Mozilla Public License Version |
4 * 1.1 (the "License"); you may not use this file except in compliance with | 4 * 1.1 (the "License"); you may not use this file except in compliance with |
5 * the License. You may obtain a copy of the License at | 5 * the License. You may obtain a copy of the License at |
6 * http://www.mozilla.org/MPL/ | 6 * http://www.mozilla.org/MPL/ |
7 * | 7 * |
8 * Software distributed under the License is distributed on an "AS IS" basis, | 8 * Software distributed under the License is distributed on an "AS IS" basis, |
9 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | 9 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
10 * for the specific language governing rights and limitations under the | 10 * for the specific language governing rights and limitations under the |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 return ref.begin; // Back over delimiter. | 785 return ref.begin; // Back over delimiter. |
786 | 786 |
787 // When there is a ref and we get here, the component we wanted was before | 787 // When there is a ref and we get here, the component we wanted was before |
788 // this and not found, so we always know the beginning of the ref is right. | 788 // this and not found, so we always know the beginning of the ref is right. |
789 return ref.begin - 1; // Don't want delimiter counted. | 789 return ref.begin - 1; // Don't want delimiter counted. |
790 } | 790 } |
791 | 791 |
792 return cur; | 792 return cur; |
793 } | 793 } |
794 | 794 |
| 795 Component Parsed::GetContent() const { |
| 796 const int begin = CountCharactersBefore(USERNAME, false); |
| 797 const int len = Length() - begin; |
| 798 // For compatability with the standard URL parser, we treat no content as |
| 799 // -1, rather than having a length of 0 (we normally wouldn't care so |
| 800 // much for these non-standard URLs). |
| 801 return len ? Component(begin, len) : Component(); |
| 802 } |
| 803 |
795 bool ExtractScheme(const char* url, int url_len, Component* scheme) { | 804 bool ExtractScheme(const char* url, int url_len, Component* scheme) { |
796 return DoExtractScheme(url, url_len, scheme); | 805 return DoExtractScheme(url, url_len, scheme); |
797 } | 806 } |
798 | 807 |
799 bool ExtractScheme(const base::char16* url, int url_len, Component* scheme) { | 808 bool ExtractScheme(const base::char16* url, int url_len, Component* scheme) { |
800 return DoExtractScheme(url, url_len, scheme); | 809 return DoExtractScheme(url, url_len, scheme); |
801 } | 810 } |
802 | 811 |
803 // This handles everything that may be an authority terminator, including | 812 // This handles everything that may be an authority terminator, including |
804 // backslash. For special backslash handling see DoParseAfterScheme. | 813 // backslash. For special backslash handling see DoParseAfterScheme. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 } | 923 } |
915 | 924 |
916 void ParseAfterScheme(const base::char16* spec, | 925 void ParseAfterScheme(const base::char16* spec, |
917 int spec_len, | 926 int spec_len, |
918 int after_scheme, | 927 int after_scheme, |
919 Parsed* parsed) { | 928 Parsed* parsed) { |
920 DoParseAfterScheme(spec, spec_len, after_scheme, parsed); | 929 DoParseAfterScheme(spec, spec_len, after_scheme, parsed); |
921 } | 930 } |
922 | 931 |
923 } // namespace url_parse | 932 } // namespace url_parse |
OLD | NEW |