diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-25 02:58:23 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-25 02:58:23 +0000 |
commit | 1d438cca3295d0de03785aa7140215766fc2cd82 (patch) | |
tree | 059bdb259f161071c4c5ec620e661aa62afbdc8f /net/base/escape.cc | |
parent | f56797b39e5ed58dec8f92ff922fc2dbdb3eca5d (diff) | |
download | chromium_src-1d438cca3295d0de03785aa7140215766fc2cd82.zip chromium_src-1d438cca3295d0de03785aa7140215766fc2cd82.tar.gz chromium_src-1d438cca3295d0de03785aa7140215766fc2cd82.tar.bz2 |
net: Move more functions into net namespace.
BUG=64263
TEST=None
R=willchan@chromium.org
Review URL: http://codereview.chromium.org/8028015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102671 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/escape.cc')
-rw-r--r-- | net/base/escape.cc | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/net/base/escape.cc b/net/base/escape.cc index 0ab01e4..893d032 100644 --- a/net/base/escape.cc +++ b/net/base/escape.cc @@ -230,40 +230,6 @@ std::string EscapeExternalHandlerValue(const std::string& text) { return Escape(text, kExternalHandlerCharmap, false); } -string16 UnescapeAndDecodeUTF8URLComponentWithOffsets( - const std::string& text, - UnescapeRule::Type rules, - std::vector<size_t>* offsets_for_adjustment) { - string16 result; - std::vector<size_t> original_offsets; - if (offsets_for_adjustment) - original_offsets = *offsets_for_adjustment; - std::string unescaped_url( - UnescapeURLWithOffsetsImpl(text, rules, offsets_for_adjustment)); - if (UTF8ToUTF16AndAdjustOffsets(unescaped_url.data(), unescaped_url.length(), - &result, offsets_for_adjustment)) - return result; // Character set looks like it's valid. - - // Not valid. Return the escaped version. Undo our changes to - // |offset_for_adjustment| since we haven't changed the string after all. - if (offsets_for_adjustment) - *offsets_for_adjustment = original_offsets; - return UTF8ToUTF16AndAdjustOffsets(text, offsets_for_adjustment); -} - -string16 UnescapeAndDecodeUTF8URLComponent(const std::string& text, - UnescapeRule::Type rules, - size_t* offset_for_adjustment) { - std::vector<size_t> offsets; - if (offset_for_adjustment) - offsets.push_back(*offset_for_adjustment); - string16 result = - UnescapeAndDecodeUTF8URLComponentWithOffsets(text, rules, &offsets); - if (offset_for_adjustment) - *offset_for_adjustment = offsets[0]; - return result; -} - std::string UnescapeURLComponent(const std::string& escaped_text, UnescapeRule::Type rules) { return UnescapeURLWithOffsetsImpl(escaped_text, rules, NULL); @@ -323,6 +289,42 @@ string16 EscapeForHTML(const string16& input) { return EscapeForHTMLImpl(input); } +namespace net { + +string16 UnescapeAndDecodeUTF8URLComponent(const std::string& text, + UnescapeRule::Type rules, + size_t* offset_for_adjustment) { + std::vector<size_t> offsets; + if (offset_for_adjustment) + offsets.push_back(*offset_for_adjustment); + string16 result = + UnescapeAndDecodeUTF8URLComponentWithOffsets(text, rules, &offsets); + if (offset_for_adjustment) + *offset_for_adjustment = offsets[0]; + return result; +} + +string16 UnescapeAndDecodeUTF8URLComponentWithOffsets( + const std::string& text, + UnescapeRule::Type rules, + std::vector<size_t>* offsets_for_adjustment) { + string16 result; + std::vector<size_t> original_offsets; + if (offsets_for_adjustment) + original_offsets = *offsets_for_adjustment; + std::string unescaped_url( + UnescapeURLWithOffsetsImpl(text, rules, offsets_for_adjustment)); + if (UTF8ToUTF16AndAdjustOffsets(unescaped_url.data(), unescaped_url.length(), + &result, offsets_for_adjustment)) + return result; // Character set looks like it's valid. + + // Not valid. Return the escaped version. Undo our changes to + // |offset_for_adjustment| since we haven't changed the string after all. + if (offsets_for_adjustment) + *offsets_for_adjustment = original_offsets; + return UTF8ToUTF16AndAdjustOffsets(text, offsets_for_adjustment); +} + string16 UnescapeForHTML(const string16& input) { static const struct { const char* ampersand_code; @@ -358,8 +360,6 @@ string16 UnescapeForHTML(const string16& input) { return text; } -namespace net { - std::string EscapeQueryParamValue(const std::string& text, bool use_plus) { return Escape(text, kQueryCharmap, use_plus); } |