| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // url_formatter contains routines for formatting URLs in a way that can be | 5 // url_formatter contains routines for formatting URLs in a way that can be |
| 6 // safely and securely displayed to users. For example, it is responsible | 6 // safely and securely displayed to users. For example, it is responsible |
| 7 // for determining when to convert an IDN A-Label (e.g. "xn--[something]") | 7 // for determining when to convert an IDN A-Label (e.g. "xn--[something]") |
| 8 // into the IDN U-Label. | 8 // into the IDN U-Label. |
| 9 // | 9 // |
| 10 // Note that this formatting is only intended for display purposes; it would | 10 // Note that this formatting is only intended for display purposes; it would |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // If set, any username and password are removed. | 44 // If set, any username and password are removed. |
| 45 extern const FormatUrlType kFormatUrlOmitUsernamePassword; | 45 extern const FormatUrlType kFormatUrlOmitUsernamePassword; |
| 46 | 46 |
| 47 // If the scheme is 'http://', it's removed. | 47 // If the scheme is 'http://', it's removed. |
| 48 extern const FormatUrlType kFormatUrlOmitHTTP; | 48 extern const FormatUrlType kFormatUrlOmitHTTP; |
| 49 | 49 |
| 50 // Omits the path if it is just a slash and there is no query or ref. This is | 50 // Omits the path if it is just a slash and there is no query or ref. This is |
| 51 // meaningful for non-file "standard" URLs. | 51 // meaningful for non-file "standard" URLs. |
| 52 extern const FormatUrlType kFormatUrlOmitTrailingSlashOnBareHostname; | 52 extern const FormatUrlType kFormatUrlOmitTrailingSlashOnBareHostname; |
| 53 | 53 |
| 54 // Convenience for omitting all unecessary types. | 54 // Convenience for omitting all unecessary types. Does not include experimental |
| 55 // flags below. |
| 55 extern const FormatUrlType kFormatUrlOmitAll; | 56 extern const FormatUrlType kFormatUrlOmitAll; |
| 56 | 57 |
| 58 // Replaces the path, query, and ref with an ellipsis. Experimental and not in |
| 59 // kFormatUrlOmitAll. |
| 60 extern const FormatUrlType kFormatUrlExperimentalElideAfterHost; |
| 61 |
| 57 // Creates a string representation of |url|. The IDN host name is turned to | 62 // Creates a string representation of |url|. The IDN host name is turned to |
| 58 // Unicode if the Unicode representation is deemed safe. |format_type| is a | 63 // Unicode if the Unicode representation is deemed safe. |format_type| is a |
| 59 // bitmask of FormatUrlTypes, see it for details. |unescape_rules| defines how | 64 // bitmask of FormatUrlTypes, see it for details. |unescape_rules| defines how |
| 60 // to clean the URL for human readability. You will generally want | 65 // to clean the URL for human readability. You will generally want |
| 61 // |UnescapeRule::SPACES| for display to the user if you can handle spaces, or | 66 // |UnescapeRule::SPACES| for display to the user if you can handle spaces, or |
| 62 // |UnescapeRule::NORMAL| if not. If the path part and the query part seem to | 67 // |UnescapeRule::NORMAL| if not. If the path part and the query part seem to |
| 63 // be encoded in %-encoded UTF-8, decodes %-encoding and UTF-8. | 68 // be encoded in %-encoded UTF-8, decodes %-encoding and UTF-8. |
| 64 // | 69 // |
| 65 // The last three parameters may be NULL. | 70 // The last three parameters may be NULL. |
| 66 // | 71 // |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // If |text| starts with "www." it is removed, otherwise |text| is returned | 144 // If |text| starts with "www." it is removed, otherwise |text| is returned |
| 140 // unmodified. | 145 // unmodified. |
| 141 base::string16 StripWWW(const base::string16& text); | 146 base::string16 StripWWW(const base::string16& text); |
| 142 | 147 |
| 143 // Runs |url|'s host through StripWWW(). |url| must be valid. | 148 // Runs |url|'s host through StripWWW(). |url| must be valid. |
| 144 base::string16 StripWWWFromHost(const GURL& url); | 149 base::string16 StripWWWFromHost(const GURL& url); |
| 145 | 150 |
| 146 } // namespace url_formatter | 151 } // namespace url_formatter |
| 147 | 152 |
| 148 #endif // COMPONENTS_URL_FORMATTER_URL_FORMATTER_H_ | 153 #endif // COMPONENTS_URL_FORMATTER_URL_FORMATTER_H_ |
| OLD | NEW |