| 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 COMPONENTS_URL_FIXER_URL_FIXER_H_ | 5 #ifndef COMPONENTS_URL_FORMATTER_URL_FIXER_H_ |
| 6 #define COMPONENTS_URL_FIXER_URL_FIXER_H_ | 6 #define COMPONENTS_URL_FORMATTER_URL_FIXER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
| 12 | 12 |
| 13 namespace base { | 13 namespace base { |
| 14 class FilePath; | 14 class FilePath; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace url { | 17 namespace url { |
| 18 struct Component; | 18 struct Component; |
| 19 struct Parsed; | 19 struct Parsed; |
| 20 } | 20 } |
| 21 | 21 |
| 22 // This object is designed to convert various types of input into URLs that we | 22 // This object is designed to convert various types of input into URLs that we |
| 23 // know are valid. For example, user typing in the URL bar or command line | 23 // know are valid. For example, user typing in the URL bar or command line |
| 24 // options. This is NOT the place for converting between different types of URLs | 24 // options. This is NOT the place for converting between different types of URLs |
| 25 // or parsing them, see net_util.h for that. | 25 // or parsing them, see net_util.h for that. |
| 26 namespace url_fixer { | 26 namespace url_formatter { |
| 27 | 27 |
| 28 // Segments the given text string into parts of a URL. This is most useful for | 28 // Segments the given text string into parts of a URL. This is most useful for |
| 29 // schemes such as http, https, and ftp where |SegmentURL| will find many | 29 // 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::Parsed* parts); | 33 std::string SegmentURL(const std::string& text, url::Parsed* parts); |
| 34 base::string16 SegmentURL(const base::string16& text, url::Parsed* parts); | 34 base::string16 SegmentURL(const base::string16& text, url::Parsed* parts); |
| 35 | 35 |
| 36 // Converts |text| to a fixed-up URL and returns it. Attempts to make some | 36 // Converts |text| to a fixed-up URL and returns it. Attempts to make some |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 // Returns true if |scheme1| is equivalent to |scheme2|. | 76 // Returns true if |scheme1| is equivalent to |scheme2|. |
| 77 // Generally this is true if the two schemes are actually identical, but it's | 77 // Generally this is true if the two schemes are actually identical, but it's |
| 78 // also true when one scheme is "about" and the other "chrome". | 78 // also true when one scheme is "about" and the other "chrome". |
| 79 bool IsEquivalentScheme(const std::string& scheme1, const std::string& scheme2); | 79 bool IsEquivalentScheme(const std::string& scheme1, const std::string& scheme2); |
| 80 | 80 |
| 81 // For paths like ~, we use $HOME for the current user's home directory. | 81 // For paths like ~, we use $HOME for the current user's home directory. |
| 82 // For tests, we allow our idea of $HOME to be overriden by this variable. | 82 // For tests, we allow our idea of $HOME to be overriden by this variable. |
| 83 extern const char* home_directory_override; | 83 extern const char* home_directory_override; |
| 84 | 84 |
| 85 } // namespace url_fixer | 85 } // namespace url_formatter |
| 86 | 86 |
| 87 #endif // COMPONENTS_URL_FIXER_URL_FIXER_H_ | 87 #endif // COMPONENTS_URL_FORMATTER_URL_FIXER_H_ |
| OLD | NEW |