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

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

Issue 632843003: Add a function to escape a query part of url (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Follow RFC 2396 to escape a query part of url Created 6 years, 2 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
« no previous file with comments | « no previous file | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 NET_EXPORT std::string EscapeExternalHandlerValue(const std::string& text); 47 NET_EXPORT std::string EscapeExternalHandlerValue(const std::string& text);
48 48
49 // Appends the given character to the output string, escaping the character if 49 // Appends the given character to the output string, escaping the character if
50 // the character would be interpretted as an HTML delimiter. 50 // the character would be interpretted as an HTML delimiter.
51 NET_EXPORT void AppendEscapedCharForHTML(char c, std::string* output); 51 NET_EXPORT void AppendEscapedCharForHTML(char c, std::string* output);
52 52
53 // Escapes chars that might cause this text to be interpretted as HTML tags. 53 // Escapes chars that might cause this text to be interpretted as HTML tags.
54 NET_EXPORT std::string EscapeForHTML(const std::string& text); 54 NET_EXPORT std::string EscapeForHTML(const std::string& text);
55 NET_EXPORT base::string16 EscapeForHTML(const base::string16& text); 55 NET_EXPORT base::string16 EscapeForHTML(const base::string16& text);
56 56
57 // Escapes characters in text suitable for use as a query part.
58 // We %XX everything except alphanumerics, the restricted chracters(;/?:@&=+$,),
59 // the mark characters(-_.!~*'()).
asanka 2014/10/10 20:59:16 You are once again going to be bitten by https://u
60 NET_EXPORT std::string EscapeQueryPart(const std::string& text);
61
57 // Unescaping ------------------------------------------------------------------ 62 // Unescaping ------------------------------------------------------------------
58 63
59 class UnescapeRule { 64 class UnescapeRule {
60 public: 65 public:
61 // A combination of the following flags that is passed to the unescaping 66 // A combination of the following flags that is passed to the unescaping
62 // functions. 67 // functions.
63 typedef uint32 Type; 68 typedef uint32 Type;
64 69
65 enum { 70 enum {
66 // Don't unescape anything at all. 71 // Don't unescape anything at all.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 UnescapeRule::Type rules, 131 UnescapeRule::Type rules,
127 base::OffsetAdjuster::Adjustments* adjustments); 132 base::OffsetAdjuster::Adjustments* adjustments);
128 133
129 // Unescapes the following ampersand character codes from |text|: 134 // Unescapes the following ampersand character codes from |text|:
130 // &lt; &gt; &amp; &quot; &#39; 135 // &lt; &gt; &amp; &quot; &#39;
131 NET_EXPORT base::string16 UnescapeForHTML(const base::string16& text); 136 NET_EXPORT base::string16 UnescapeForHTML(const base::string16& text);
132 137
133 } // namespace net 138 } // namespace net
134 139
135 #endif // NET_BASE_ESCAPE_H_ 140 #endif // NET_BASE_ESCAPE_H_
OLDNEW
« no previous file with comments | « no previous file | net/base/escape.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698