summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-06 14:34:29 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-06 14:34:29 +0000
commitc83d7d18704dff81e58c93b92647fb6600424e74 (patch)
tree340f9ba8ae94ae757a79ac956ccba1e06da26f57 /net
parent0b512bd7f686c74777a6c3bccf4ef9eab3aca8a9 (diff)
downloadchromium_src-c83d7d18704dff81e58c93b92647fb6600424e74.zip
chromium_src-c83d7d18704dff81e58c93b92647fb6600424e74.tar.gz
chromium_src-c83d7d18704dff81e58c93b92647fb6600424e74.tar.bz2
net: Move more three Escape() functions into net namespace.
BUG=64263 TEST=None R=willchan@chromium.org Review URL: http://codereview.chromium.org/8479021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108808 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/escape.cc35
-rw-r--r--net/base/escape.h26
2 files changed, 30 insertions, 31 deletions
diff --git a/net/base/escape.cc b/net/base/escape.cc
index 8544292..830d5c2 100644
--- a/net/base/escape.cc
+++ b/net/base/escape.cc
@@ -15,7 +15,7 @@
namespace {
-static const char* const kHexString = "0123456789ABCDEF";
+const char kHexString[] = "0123456789ABCDEF";
inline char IntToHex(int i) {
DCHECK_GE(i, 0) << i << " not a hex value";
DCHECK_LE(i, 15) << i << " not a hex value";
@@ -219,8 +219,6 @@ str EscapeForHTMLImpl(const str& input) {
return result;
}
-} // namespace
-
// Everything except alphanumerics and !'()*-._~
// See RFC 2396 for the list of reserved characters.
static const Charmap kQueryCharmap(
@@ -232,36 +230,39 @@ static const Charmap kPathCharmap(
0xffffffffL, 0xd400002dL, 0x78000000L, 0xb8000001L,
0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL);
-std::string EscapePath(const std::string& path) {
- return Escape(path, kPathCharmap, false);
-}
-
// non-printable, non-7bit, and (including space) ?>=<;+'&%$#"![\]^`{|}
static const Charmap kUrlEscape(
0xffffffffL, 0xf80008fdL, 0x78000001L, 0xb8000001L,
0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL
);
-std::string EscapeUrlEncodedData(const std::string& path,
- bool use_plus) {
- return Escape(path, kUrlEscape, use_plus);
-}
-
// non-7bit
static const Charmap kNonASCIICharmap(
0x00000000L, 0x00000000L, 0x00000000L, 0x00000000L,
0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL);
-std::string EscapeNonASCII(const std::string& input) {
- return Escape(input, kNonASCIICharmap, false);
-}
-
// Everything except alphanumerics, the reserved characters(;/?:@&=+$,) and
// !'()*-._~%
static const Charmap kExternalHandlerCharmap(
0xffffffffL, 0x5000080dL, 0x68000000L, 0xb8000001L,
0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL);
+} // namespace
+
+std::string EscapePath(const std::string& path) {
+ return Escape(path, kPathCharmap, false);
+}
+
+std::string EscapeUrlEncodedData(const std::string& path, bool use_plus) {
+ return Escape(path, kUrlEscape, use_plus);
+}
+
+namespace net {
+
+std::string EscapeNonASCII(const std::string& input) {
+ return Escape(input, kNonASCIICharmap, false);
+}
+
std::string EscapeExternalHandlerValue(const std::string& text) {
return Escape(text, kExternalHandlerCharmap, false);
}
@@ -270,8 +271,6 @@ void AppendEscapedCharForHTML(char c, std::string* output) {
AppendEscapedCharForHTMLImpl(c, output);
}
-namespace net {
-
std::string EscapeForHTML(const std::string& input) {
return EscapeForHTMLImpl(input);
}
diff --git a/net/base/escape.h b/net/base/escape.h
index 45f2ddf..0d2684a 100644
--- a/net/base/escape.h
+++ b/net/base/escape.h
@@ -26,19 +26,6 @@ NET_EXPORT std::string EscapePath(const std::string& path);
NET_EXPORT std::string EscapeUrlEncodedData(const std::string& path,
bool use_plus);
-// Escape all non-ASCII input.
-NET_EXPORT std::string EscapeNonASCII(const std::string& input);
-
-// Escapes characters in text suitable for use as an external protocol handler
-// command.
-// We %XX everything except alphanumerics and %-_.!~*'() and the restricted
-// chracters (;/?:@&=+$,).
-NET_EXPORT std::string EscapeExternalHandlerValue(const std::string& text);
-
-// Append the given character to the output string, escaping the character if
-// the character would be interpretted as an HTML delimiter.
-NET_EXPORT void AppendEscapedCharForHTML(char c, std::string* output);
-
// Unescaping ------------------------------------------------------------------
class UnescapeRule {
@@ -83,6 +70,19 @@ class UnescapeRule {
namespace net {
+// Escape all non-ASCII input.
+NET_EXPORT std::string EscapeNonASCII(const std::string& input);
+
+// Escapes characters in text suitable for use as an external protocol handler
+// command.
+// We %XX everything except alphanumerics and %-_.!~*'() and the restricted
+// chracters (;/?:@&=+$,).
+NET_EXPORT std::string EscapeExternalHandlerValue(const std::string& text);
+
+// Append the given character to the output string, escaping the character if
+// the character would be interpretted as an HTML delimiter.
+NET_EXPORT void AppendEscapedCharForHTML(char c, std::string* output);
+
// Escape chars that might cause this text to be interpretted as HTML tags.
NET_EXPORT std::string EscapeForHTML(const std::string& text);
NET_EXPORT string16 EscapeForHTML(const string16& text);