Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: net/base/escape.h

Issue 7978039: net: Put more functions from escape.h into net namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view.cc ('k') | net/base/escape.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef NET_BASE_ESCAPE_H_ 5 #ifndef NET_BASE_ESCAPE_H_
6 #define NET_BASE_ESCAPE_H_ 6 #define NET_BASE_ESCAPE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 size_t* offset_for_adjustment); 115 size_t* offset_for_adjustment);
116 NET_EXPORT string16 UnescapeAndDecodeUTF8URLComponentWithOffsets( 116 NET_EXPORT string16 UnescapeAndDecodeUTF8URLComponentWithOffsets(
117 const std::string& text, 117 const std::string& text,
118 UnescapeRule::Type rules, 118 UnescapeRule::Type rules,
119 std::vector<size_t>* offsets_for_adjustment); 119 std::vector<size_t>* offsets_for_adjustment);
120 120
121 // Unescape the following ampersand character codes from |text|: 121 // Unescape the following ampersand character codes from |text|:
122 // &lt; &gt; &amp; &quot; &#39; 122 // &lt; &gt; &amp; &quot; &#39;
123 NET_EXPORT string16 UnescapeForHTML(const string16& text); 123 NET_EXPORT string16 UnescapeForHTML(const string16& text);
124 124
125 namespace net {
126
125 // Deprecated ------------------------------------------------------------------ 127 // Deprecated ------------------------------------------------------------------
126 128
127 // Escapes characters in text suitable for use as a query parameter value. 129 // Escapes characters in text suitable for use as a query parameter value.
128 // We %XX everything except alphanumerics and -_.!~*'() 130 // We %XX everything except alphanumerics and -_.!~*'()
129 // Spaces change to "+" unless you pass usePlus=false. 131 // Spaces change to "+" unless you pass usePlus=false.
130 // This is basically the same as encodeURIComponent in javascript. 132 // This is basically the same as encodeURIComponent in javascript.
131 // For the string16 version, we do a conversion to charset before encoding the 133 // For the string16 version, we do a conversion to charset before encoding the
132 // string. If the charset doesn't exist, we return false. 134 // string. If the charset doesn't exist, we return false.
133 NET_EXPORT std::string EscapeQueryParamValue(const std::string& text, 135 NET_EXPORT std::string EscapeQueryParamValue(const std::string& text,
134 bool use_plus); 136 bool use_plus);
135 NET_EXPORT bool EscapeQueryParamValue(const string16& text, 137 NET_EXPORT bool EscapeQueryParamValue(const string16& text,
136 const char* codepage, 138 const char* codepage,
137 bool use_plus, 139 bool use_plus,
138 string16* escaped); 140 string16* escaped);
139 141
140 namespace net {
141
142 // A specialized version of EscapeQueryParamValue for string16s that 142 // A specialized version of EscapeQueryParamValue for string16s that
143 // assumes the codepage is UTF8. This is provided as a convenience. 143 // assumes the codepage is UTF8. This is provided as a convenience.
144 NET_EXPORT string16 EscapeQueryParamValueUTF8(const string16& text, 144 NET_EXPORT string16 EscapeQueryParamValueUTF8(const string16& text,
145 bool use_plus); 145 bool use_plus);
146 146
147 namespace internal { 147 namespace internal {
148 148
149 // Private Functions (Exposed for Unit Testing) -------------------------------- 149 // Private Functions (Exposed for Unit Testing) --------------------------------
150 150
151 // A function called by std::for_each that will adjust any offset which occurs 151 // A function called by std::for_each that will adjust any offset which occurs
152 // after one or more encoded characters. 152 // after one or more encoded characters.
153 struct NET_EXPORT_PRIVATE AdjustEncodingOffset { 153 struct NET_EXPORT_PRIVATE AdjustEncodingOffset {
154 typedef std::vector<size_t> Adjustments; 154 typedef std::vector<size_t> Adjustments;
155 155
156 explicit AdjustEncodingOffset(const Adjustments& adjustments); 156 explicit AdjustEncodingOffset(const Adjustments& adjustments);
157 void operator()(size_t& offset); 157 void operator()(size_t& offset);
158 158
159 const Adjustments& adjustments; 159 const Adjustments& adjustments;
160 }; 160 };
161 161
162 } // namespace internal 162 } // namespace internal
163 163
164 } // namespace net 164 } // namespace net
165 165
166 #endif // NET_BASE_ESCAPE_H_ 166 #endif // NET_BASE_ESCAPE_H_
OLDNEW
« no previous file with comments | « content/renderer/render_view.cc ('k') | net/base/escape.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698