| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_COMMON_NET_URL_FIXER_UPPER_H_ | 5 #ifndef CHROME_COMMON_NET_URL_FIXER_UPPER_H_ |
| 6 #define CHROME_COMMON_NET_URL_FIXER_UPPER_H_ | 6 #define CHROME_COMMON_NET_URL_FIXER_UPPER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // options. This is NOT the place for converting between different types of | 24 // options. This is NOT the place for converting between different types of |
| 25 // URLs or parsing them, see net_util.h for that. | 25 // URLs or parsing them, see net_util.h for that. |
| 26 namespace URLFixerUpper { | 26 namespace URLFixerUpper { |
| 27 | 27 |
| 28 // Segments the given text string into parts of a URL. This is most useful | 28 // Segments the given text string into parts of a URL. This is most useful |
| 29 // for schemes such as http, https, and ftp where |SegmentURL| will find many | 29 // for schemes such as http, https, and ftp where |SegmentURL| will find many |
| 30 // segments. Currently does not segment "file" schemes. | 30 // segments. Currently does not segment "file" schemes. |
| 31 // Returns the canonicalized scheme, or the empty string when |text| is only | 31 // Returns the canonicalized scheme, or the empty string when |text| is only |
| 32 // whitespace. | 32 // whitespace. |
| 33 std::string SegmentURL(const std::string& text, url_parse::Parsed* parts); | 33 std::string SegmentURL(const std::string& text, url_parse::Parsed* parts); |
| 34 string16 SegmentURL(const string16& text, url_parse::Parsed* parts); | 34 base::string16 SegmentURL(const base::string16& text, |
| 35 url_parse::Parsed* parts); |
| 35 | 36 |
| 36 // Converts |text| to a fixed-up URL and returns it. Attempts to make | 37 // Converts |text| to a fixed-up URL and returns it. Attempts to make |
| 37 // some "smart" adjustments to obviously-invalid input where possible. | 38 // some "smart" adjustments to obviously-invalid input where possible. |
| 38 // |text| may be an absolute path to a file, which will get converted to a | 39 // |text| may be an absolute path to a file, which will get converted to a |
| 39 // "file:" URL. | 40 // "file:" URL. |
| 40 // | 41 // |
| 41 // The result will be a "more" valid URL than the input. It may still not | 42 // The result will be a "more" valid URL than the input. It may still not |
| 42 // be valid, so check the return value's validity or use | 43 // be valid, so check the return value's validity or use |
| 43 // possibly_invalid_spec(). | 44 // possibly_invalid_spec(). |
| 44 // | 45 // |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 void OffsetComponent(int offset, url_parse::Component* part); | 77 void OffsetComponent(int offset, url_parse::Component* part); |
| 77 | 78 |
| 78 // For paths like ~, we use $HOME for the current user's home | 79 // For paths like ~, we use $HOME for the current user's home |
| 79 // directory. For tests, we allow our idea of $HOME to be overriden | 80 // directory. For tests, we allow our idea of $HOME to be overriden |
| 80 // by this variable. | 81 // by this variable. |
| 81 extern const char* home_directory_override; | 82 extern const char* home_directory_override; |
| 82 | 83 |
| 83 } // namespace URLFixerUpper | 84 } // namespace URLFixerUpper |
| 84 | 85 |
| 85 #endif // CHROME_COMMON_NET_URL_FIXER_UPPER_H_ | 86 #endif // CHROME_COMMON_NET_URL_FIXER_UPPER_H_ |
| OLD | NEW |