Chromium Code Reviews| 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 paths with an ellipsis. Experimental and not in kFormatUrlOmitAll. | |
|
Peter Kasting
2017/06/28 20:54:35
As implemented, this actually replaces the path, q
tommycli
2017/06/28 21:21:39
Done.
| |
| 59 extern const FormatUrlType kFormatUrlExperimentalEllipsizePath; | |
| 60 | |
| 57 // Creates a string representation of |url|. The IDN host name is turned to | 61 // 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 | 62 // Unicode if the Unicode representation is deemed safe. |format_type| is a |
| 59 // bitmask of FormatUrlTypes, see it for details. |unescape_rules| defines how | 63 // bitmask of FormatUrlTypes, see it for details. |unescape_rules| defines how |
| 60 // to clean the URL for human readability. You will generally want | 64 // 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 | 65 // |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 | 66 // |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. | 67 // be encoded in %-encoded UTF-8, decodes %-encoding and UTF-8. |
| 64 // | 68 // |
| 65 // The last three parameters may be NULL. | 69 // The last three parameters may be NULL. |
| 66 // | 70 // |
| (...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 | 143 // If |text| starts with "www." it is removed, otherwise |text| is returned |
| 140 // unmodified. | 144 // unmodified. |
| 141 base::string16 StripWWW(const base::string16& text); | 145 base::string16 StripWWW(const base::string16& text); |
| 142 | 146 |
| 143 // Runs |url|'s host through StripWWW(). |url| must be valid. | 147 // Runs |url|'s host through StripWWW(). |url| must be valid. |
| 144 base::string16 StripWWWFromHost(const GURL& url); | 148 base::string16 StripWWWFromHost(const GURL& url); |
| 145 | 149 |
| 146 } // namespace url_formatter | 150 } // namespace url_formatter |
| 147 | 151 |
| 148 #endif // COMPONENTS_URL_FORMATTER_URL_FORMATTER_H_ | 152 #endif // COMPONENTS_URL_FORMATTER_URL_FORMATTER_H_ |
| OLD | NEW |