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 #ifndef URL_URL_CANON_INTERNAL_FILE_H_ | 5 #ifndef URL_URL_CANON_INTERNAL_FILE_H_ |
6 #define URL_URL_CANON_INTERNAL_FILE_H_ | 6 #define URL_URL_CANON_INTERNAL_FILE_H_ |
7 | 7 |
8 // As with url_canon_internal.h, this file is intended to be included in | 8 // As with url_canon_internal.h, this file is intended to be included in |
9 // another C++ file where the template types are defined. This allows the | 9 // another C++ file where the template types are defined. This allows the |
10 // programmer to use this to use these functions for their own strings | 10 // programmer to use this to use these functions for their own strings |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // should probably handle validity checking of UNC hosts differently than | 106 // should probably handle validity checking of UNC hosts differently than |
107 // for regular IP hosts. | 107 // for regular IP hosts. |
108 bool success = URLCanonInternal<CHAR, UCHAR>::DoHost( | 108 bool success = URLCanonInternal<CHAR, UCHAR>::DoHost( |
109 source.host, parsed.host, output, &new_parsed->host); | 109 source.host, parsed.host, output, &new_parsed->host); |
110 | 110 |
111 // Write a separator for the start of the path. We'll ignore any slashes | 111 // Write a separator for the start of the path. We'll ignore any slashes |
112 // already at the beginning of the path. | 112 // already at the beginning of the path. |
113 new_parsed->path.begin = output->length(); | 113 new_parsed->path.begin = output->length(); |
114 output->push_back('/'); | 114 output->push_back('/'); |
115 | 115 |
116 // Copies and normalizes the "c:" at the beginning, if present. | 116 // Copy and normalize the "c:" at the beginning, if present. |
117 int after_drive = FileDoDriveSpec(source.path, parsed.path.begin, | 117 int after_drive = FileDoDriveSpec(source.path, parsed.path.begin, |
118 parsed.path.end(), output); | 118 parsed.path.end(), output); |
119 | 119 |
120 // Copies the rest of the path | 120 // Copy the rest of the path. |
121 FileDoPath<CHAR, UCHAR>(source.path, after_drive, parsed.path.end(), output); | 121 FileDoPath<CHAR, UCHAR>(source.path, after_drive, parsed.path.end(), output); |
122 new_parsed->path.len = output->length() - new_parsed->path.begin; | 122 new_parsed->path.len = output->length() - new_parsed->path.begin; |
123 | 123 |
124 // Things following the path we can use the standard canonicalizers for. | 124 // For things following the path, we can use the standard canonicalizers. |
125 success &= URLCanonInternal<CHAR, UCHAR>::DoQuery( | 125 success &= URLCanonInternal<CHAR, UCHAR>::DoQuery( |
126 source.query, parsed.query, output, &new_parsed->query); | 126 source.query, parsed.query, output, &new_parsed->query); |
127 success &= URLCanonInternal<CHAR, UCHAR>::DoRef( | 127 success &= URLCanonInternal<CHAR, UCHAR>::DoRef( |
128 source.ref, parsed.ref, output, &new_parsed->ref); | 128 source.ref, parsed.ref, output, &new_parsed->ref); |
129 | 129 |
130 return success; | 130 return success; |
131 } | 131 } |
132 | 132 |
133 } // namespace url | 133 } // namespace url |
134 | 134 |
135 #endif // URL_URL_CANON_INTERNAL_FILE_H_ | 135 #endif // URL_URL_CANON_INTERNAL_FILE_H_ |
OLD | NEW |