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_THIRD_PARTY_MOZILLA_URL_PARSE_H_ | 5 #ifndef URL_THIRD_PARTY_MOZILLA_URL_PARSE_H_ |
6 #define URL_THIRD_PARTY_MOZILLA_URL_PARSE_H_ | 6 #define URL_THIRD_PARTY_MOZILLA_URL_PARSE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // The password is separated form the username with a colon, as in | 152 // The password is separated form the username with a colon, as in |
153 // "http://me:secret@host/" | 153 // "http://me:secret@host/" |
154 Component password; | 154 Component password; |
155 | 155 |
156 // Host name. | 156 // Host name. |
157 Component host; | 157 Component host; |
158 | 158 |
159 // Port number. | 159 // Port number. |
160 Component port; | 160 Component port; |
161 | 161 |
162 // Path, this is everything following the host name. Length will be -1 if | 162 // Path, this is everything following the host name, stopping at the query of |
163 // unspecified. This includes the preceeding slash, so the path on | 163 // ref delimiter (if any). Length will be -1 if unspecified. This includes |
164 // http://www.google.com/asdf" is "/asdf". As a result, it is impossible to | 164 // the preceeding slash, so the path on http://www.google.com/asdf" is |
165 // have a 0 length path, it will be -1 in cases like "http://host?foo". | 165 // "/asdf". As a result, it is impossible to have a 0 length path, it will |
| 166 // be -1 in cases like "http://host?foo". |
166 // Note that we treat backslashes the same as slashes. | 167 // Note that we treat backslashes the same as slashes. |
167 Component path; | 168 Component path; |
168 | 169 |
169 // Stuff between the ? and the # after the path. This does not include the | 170 // Stuff between the ? and the # after the path. This does not include the |
170 // preceeding ? character. Length will be -1 if unspecified, 0 if there is | 171 // preceeding ? character. Length will be -1 if unspecified, 0 if there is |
171 // a question mark but no query string. | 172 // a question mark but no query string. |
172 Component query; | 173 Component query; |
173 | 174 |
174 // Indicated by a #, this is everything following the hash sign (not | 175 // Indicated by a #, this is everything following the hash sign (not |
175 // including it). If there are multiple hash signs, we'll use the last one. | 176 // including it). If there are multiple hash signs, we'll use the last one. |
176 // Length will be -1 if there is no hash sign, or 0 if there is one but | 177 // Length will be -1 if there is no hash sign, or 0 if there is one but |
177 // nothing follows it. | 178 // nothing follows it. |
178 Component ref; | 179 Component ref; |
179 | 180 |
| 181 // The URL spec from the character after the scheme: until the end of the |
| 182 // URL, regardless of the scheme. This is mostly useful for 'opaque' non- |
| 183 // hierarchical schemes like data: and javascript: as a convient way to get |
| 184 // the string with the scheme stripped off. |
| 185 Component Content() const; |
| 186 |
180 // This is used for nested URL types, currently only filesystem. If you | 187 // This is used for nested URL types, currently only filesystem. If you |
181 // parse a filesystem URL, the resulting Parsed will have a nested | 188 // parse a filesystem URL, the resulting Parsed will have a nested |
182 // inner_parsed_ to hold the parsed inner URL's component information. | 189 // inner_parsed_ to hold the parsed inner URL's component information. |
183 // For all other url types [including the inner URL], it will be NULL. | 190 // For all other url types [including the inner URL], it will be NULL. |
184 Parsed* inner_parsed() const { | 191 Parsed* inner_parsed() const { |
185 return inner_parsed_; | 192 return inner_parsed_; |
186 } | 193 } |
187 | 194 |
188 void set_inner_parsed(const Parsed& inner_parsed) { | 195 void set_inner_parsed(const Parsed& inner_parsed) { |
189 if (!inner_parsed_) | 196 if (!inner_parsed_) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 int url_len, | 231 int url_len, |
225 Parsed* parsed); | 232 Parsed* parsed); |
226 URL_EXPORT void ParseStandardURL(const base::char16* url, | 233 URL_EXPORT void ParseStandardURL(const base::char16* url, |
227 int url_len, | 234 int url_len, |
228 Parsed* parsed); | 235 Parsed* parsed); |
229 | 236 |
230 // PathURL is for when the scheme is known not to have an authority (host) | 237 // PathURL is for when the scheme is known not to have an authority (host) |
231 // section but that aren't file URLs either. The scheme is parsed, and | 238 // section but that aren't file URLs either. The scheme is parsed, and |
232 // everything after the scheme is considered as the path. This is used for | 239 // everything after the scheme is considered as the path. This is used for |
233 // things like "about:" and "javascript:" | 240 // things like "about:" and "javascript:" |
234 URL_EXPORT void ParsePathURL(const char* url, int url_len, Parsed* parsed); | 241 URL_EXPORT void ParsePathURL(const char* url, int url_len, Parsed* parsed, |
| 242 bool trim_tail = true); |
235 URL_EXPORT void ParsePathURL(const base::char16* url, | 243 URL_EXPORT void ParsePathURL(const base::char16* url, |
236 int url_len, | 244 int url_len, |
237 Parsed* parsed); | 245 Parsed* parsed, |
| 246 bool trim_tail = true); |
238 | 247 |
239 // FileURL is for file URLs. There are some special rules for interpreting | 248 // FileURL is for file URLs. There are some special rules for interpreting |
240 // these. | 249 // these. |
241 URL_EXPORT void ParseFileURL(const char* url, int url_len, Parsed* parsed); | 250 URL_EXPORT void ParseFileURL(const char* url, int url_len, Parsed* parsed); |
242 URL_EXPORT void ParseFileURL(const base::char16* url, | 251 URL_EXPORT void ParseFileURL(const base::char16* url, |
243 int url_len, | 252 int url_len, |
244 Parsed* parsed); | 253 Parsed* parsed); |
245 | 254 |
246 // Filesystem URLs are structured differently than other URLs. | 255 // Filesystem URLs are structured differently than other URLs. |
247 URL_EXPORT void ParseFileSystemURL(const char* url, | 256 URL_EXPORT void ParseFileSystemURL(const char* url, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 Component* key, | 361 Component* key, |
353 Component* value); | 362 Component* value); |
354 URL_EXPORT bool ExtractQueryKeyValue(const base::char16* url, | 363 URL_EXPORT bool ExtractQueryKeyValue(const base::char16* url, |
355 Component* query, | 364 Component* query, |
356 Component* key, | 365 Component* key, |
357 Component* value); | 366 Component* value); |
358 | 367 |
359 } // namespace url_parse | 368 } // namespace url_parse |
360 | 369 |
361 #endif // URL_THIRD_PARTY_MOZILLA_URL_PARSE_H_ | 370 #endif // URL_THIRD_PARTY_MOZILLA_URL_PARSE_H_ |
OLD | NEW |