diff options
Diffstat (limited to 'net/base/net_util.h')
-rw-r--r-- | net/base/net_util.h | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/net/base/net_util.h b/net/base/net_util.h index 53314bf..f614eb6 100644 --- a/net/base/net_util.h +++ b/net/base/net_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -36,22 +36,6 @@ struct Parsed; namespace net { -// Used by FormatUrl to specify handling of certain parts of the url. -typedef uint32 FormatUrlType; -typedef uint32 FormatUrlTypes; - -// Nothing is ommitted. -extern const FormatUrlType kFormatUrlOmitNothing; - -// If set, any username and password are removed. -extern const FormatUrlType kFormatUrlOmitUsernamePassword; - -// If the scheme is 'http://', it's removed. -extern const FormatUrlType kFormatUrlOmitHTTP; - -// Convenience for omitting all unecessary types. -extern const FormatUrlType kFormatUrlOmitAll; - // Holds a list of ports that should be accepted despite bans. extern std::set<int> explicitly_allowed_ports; @@ -261,12 +245,13 @@ void AppendFormattedHost(const GURL& url, size_t* offset_for_adjustment); // Creates a string representation of |url|. The IDN host name may be in Unicode -// if |languages| accepts the Unicode representation. |format_type| is a bitmask -// of FormatUrlTypes, see it for details. |unescape_rules| defines how to clean -// the URL for human readability. You will generally want |UnescapeRule::SPACES| -// for display to the user if you can handle spaces, or |UnescapeRule::NORMAL| -// if not. If the path part and the query part seem to be encoded in %-encoded -// UTF-8, decodes %-encoding and UTF-8. +// if |languages| accepts the Unicode representation. If +// |omit_username_password| is true, any username and password are removed. +// |unescape_rules| defines how to clean the URL for human readability. +// You will generally want |UnescapeRule::SPACES| for display to the user if you +// can handle spaces, or |UnescapeRule::NORMAL| if not. If the path part and the +// query part seem to be encoded in %-encoded UTF-8, decodes %-encoding and +// UTF-8. // // The last three parameters may be NULL. // |new_parsed| will be set to the parsing parameters of the resultant URL. @@ -282,17 +267,18 @@ void AppendFormattedHost(const GURL& url, // std::wstring::npos. std::wstring FormatUrl(const GURL& url, const std::wstring& languages, - FormatUrlTypes format_types, + bool omit_username_password, UnescapeRule::Type unescape_rules, url_parse::Parsed* new_parsed, size_t* prefix_end, size_t* offset_for_adjustment); -// This is a convenience for FormatUrl with -// format_types=kFormatUrlOmitUsernamePassword and unescape=SPACES. +// 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=SPACES, new_parsed=NULL, and prefix_end=NULL. inline std::wstring FormatUrl(const GURL& url, const std::wstring& languages) { - return FormatUrl(url, languages, kFormatUrlOmitUsernamePassword, - UnescapeRule::SPACES, NULL, NULL, NULL); + return FormatUrl(url, languages, true, UnescapeRule::SPACES, NULL, NULL, + NULL); } // Strip the portions of |url| that aren't core to the network request. |