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 // Functions for canonicalizing "filesystem:file:" URLs. | 5 // Functions for canonicalizing "filesystem:file:" URLs. |
6 | 6 |
7 #include "url/url_canon.h" | 7 #include "url/url_canon.h" |
8 #include "url/url_canon_internal.h" | 8 #include "url/url_canon_internal.h" |
9 #include "url/url_file.h" | 9 #include "url/url_file.h" |
10 #include "url/url_parse_internal.h" | 10 #include "url/url_parse_internal.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 // Scheme (known, so we don't bother running it through the more | 36 // Scheme (known, so we don't bother running it through the more |
37 // complicated scheme canonicalizer). | 37 // complicated scheme canonicalizer). |
38 new_parsed->scheme.begin = output->length(); | 38 new_parsed->scheme.begin = output->length(); |
39 output->Append("filesystem:", 11); | 39 output->Append("filesystem:", 11); |
40 new_parsed->scheme.len = 10; | 40 new_parsed->scheme.len = 10; |
41 | 41 |
42 if (!parsed.inner_parsed() || !parsed.inner_parsed()->scheme.is_valid()) | 42 if (!parsed.inner_parsed() || !parsed.inner_parsed()->scheme.is_valid()) |
43 return false; | 43 return false; |
44 | 44 |
45 bool success = true; | 45 bool success = true; |
46 if (CompareSchemeComponent(spec, inner_parsed->scheme, kFileScheme)) { | 46 if (CompareSchemeComponent(spec, inner_parsed->scheme, url::kFileScheme)) { |
47 new_inner_parsed.scheme.begin = output->length(); | 47 new_inner_parsed.scheme.begin = output->length(); |
48 output->Append("file://", 7); | 48 output->Append("file://", 7); |
49 new_inner_parsed.scheme.len = 4; | 49 new_inner_parsed.scheme.len = 4; |
50 success &= CanonicalizePath(spec, inner_parsed->path, output, | 50 success &= CanonicalizePath(spec, inner_parsed->path, output, |
51 &new_inner_parsed.path); | 51 &new_inner_parsed.path); |
52 } else if (IsStandard(spec, inner_parsed->scheme)) { | 52 } else if (IsStandard(spec, inner_parsed->scheme)) { |
53 success = CanonicalizeStandardURL(spec, parsed.inner_parsed()->Length(), | 53 success = CanonicalizeStandardURL(spec, parsed.inner_parsed()->Length(), |
54 *parsed.inner_parsed(), charset_converter, | 54 *parsed.inner_parsed(), charset_converter, |
55 output, &new_inner_parsed); | 55 output, &new_inner_parsed); |
56 } else { | 56 } else { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 Parsed* new_parsed) { | 120 Parsed* new_parsed) { |
121 RawCanonOutput<1024> utf8; | 121 RawCanonOutput<1024> utf8; |
122 URLComponentSource<char> source(base); | 122 URLComponentSource<char> source(base); |
123 Parsed parsed(base_parsed); | 123 Parsed parsed(base_parsed); |
124 SetupUTF16OverrideComponents(base, replacements, &utf8, &source, &parsed); | 124 SetupUTF16OverrideComponents(base, replacements, &utf8, &source, &parsed); |
125 return DoCanonicalizeFileSystemURL<char, unsigned char>( | 125 return DoCanonicalizeFileSystemURL<char, unsigned char>( |
126 base, source, parsed, charset_converter, output, new_parsed); | 126 base, source, parsed, charset_converter, output, new_parsed); |
127 } | 127 } |
128 | 128 |
129 } // namespace url | 129 } // namespace url |
OLD | NEW |