summaryrefslogtreecommitdiffstats
path: root/net/base/net_util.h
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-22 18:15:24 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-22 18:15:24 +0000
commitf9fe8630a0ceba09f1bfcc4af7a52048be0d133c (patch)
treec3a75daafa2d78e70e17bf24fb91502e8f94171c /net/base/net_util.h
parent03ce2f5bf335b39ad24306a3a962823e46305cc4 (diff)
downloadchromium_src-f9fe8630a0ceba09f1bfcc4af7a52048be0d133c.zip
chromium_src-f9fe8630a0ceba09f1bfcc4af7a52048be0d133c.tar.gz
chromium_src-f9fe8630a0ceba09f1bfcc4af7a52048be0d133c.tar.bz2
Shows Unicode IDN instead of Punycode in the followings:
- Bookmark Manager - Edit Bookmark dialog opened by Bookmark Manager - Edit Bookmark dialog opened by the star on the left of the address bar Introduces new function, net::FormatUrl(), which has the following parameters in addition to gfx::GetCleanStringFromUrl(). - bool omit_username_password - bool unescape and moves gfx::GetClienStringFromUrl() to net:: namespace, and removed the last two parameters. BUG=3991 Checked in for tkent Original review = http://codereview.chromium.org/115346 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16761 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/net_util.h')
-rw-r--r--net/base/net_util.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/net/base/net_util.h b/net/base/net_util.h
index e64cb88..2ab6101 100644
--- a/net/base/net_util.h
+++ b/net/base/net_util.h
@@ -23,6 +23,10 @@ namespace base {
class Time;
}
+namespace url_parse {
+struct Parsed;
+}
+
namespace net {
// Given the full path to a file name, creates a file: URL. The returned URL
@@ -170,6 +174,35 @@ bool IsPortAllowedByFtp(int port);
// Set socket to non-blocking mode
int SetNonBlocking(int fd);
+// Appends the given part of the original URL to the output string formatted for
+// the user. The given parsed structure will be updated. The host name formatter
+// also takes the same accept languages component as ElideURL. |new_parsed| may
+// be null.
+void AppendFormattedHost(const GURL& url, const std::wstring& languages,
+ std::wstring* output, url_parse::Parsed* new_parsed);
+
+// Creates a string representation of |url|. The IDN host name may
+// be in Unicode if |languages| accepts the Unicode representation.
+// If |omit_username_password| is true, the username and the password are
+// omitted. If |unescape| is true and the path part and the query part seem to
+// be encoded in %-encoded UTF-8, decodes %-encoding and UTF-8.
+// |new_parsed| will have parsing parameters of the resultant URL. |prefix_end|
+// will be the length before the hostname of the resultant URL. |new_parsed|
+// and |prefix_end| may be NULL.
+std::wstring FormatUrl(const GURL& url,
+ const std::wstring& languages,
+ bool omit_username_password,
+ bool unescape,
+ url_parse::Parsed* new_parsed,
+ size_t* prefix_end);
+
+// Creates a string representation of |url| for display to the user.
+// This is a shorthand of the above function with omit_username_password=true,
+// unescape=true, new_parsed=NULL, and prefix_end=NULL.
+inline std::wstring FormatUrl(const GURL& url, const std::wstring& languages) {
+ return FormatUrl(url, languages, true, true, NULL, NULL);
+}
+
} // namespace net
#endif // NET_BASE_NET_UTIL_H__