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

Side by Side Diff: url/url_util.h

Issue 2644133002: Do not sanitize about:blank/#foo & about:blank?foo (Closed)
Patch Set: Addressed comments Created 3 years, 11 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 URL_URL_UTIL_H_ 5 #ifndef URL_URL_UTIL_H_
6 #define URL_URL_UTIL_H_ 6 #define URL_URL_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "base/strings/string_piece.h" 12 #include "base/strings/string_piece.h"
13 #include "url/gurl.h"
13 #include "url/third_party/mozilla/url_parse.h" 14 #include "url/third_party/mozilla/url_parse.h"
14 #include "url/url_canon.h" 15 #include "url/url_canon.h"
15 #include "url/url_constants.h" 16 #include "url/url_constants.h"
16 #include "url/url_export.h" 17 #include "url/url_export.h"
17 18
18 namespace url { 19 namespace url {
19 20
20 // Init ------------------------------------------------------------------------ 21 // Init ------------------------------------------------------------------------
21 22
22 // Initialization is NOT required, it will be implicitly initialized when first 23 // Initialization is NOT required, it will be implicitly initialized when first
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // Returns true if the given scheme identified by |scheme| within |spec| is in 146 // Returns true if the given scheme identified by |scheme| within |spec| is in
146 // the list of allowed schemes for referrers (see AddReferrerScheme). 147 // the list of allowed schemes for referrers (see AddReferrerScheme).
147 URL_EXPORT bool IsReferrerScheme(const char* spec, const Component& scheme); 148 URL_EXPORT bool IsReferrerScheme(const char* spec, const Component& scheme);
148 149
149 // Returns true and sets |type| to the SchemeType of the given scheme 150 // Returns true and sets |type| to the SchemeType of the given scheme
150 // identified by |scheme| within |spec| if the scheme is in the list of known 151 // identified by |scheme| within |spec| if the scheme is in the list of known
151 // standard-format schemes (see AddStandardScheme). 152 // standard-format schemes (see AddStandardScheme).
152 URL_EXPORT bool GetStandardSchemeType(const char* spec, 153 URL_EXPORT bool GetStandardSchemeType(const char* spec,
153 const Component& scheme, 154 const Component& scheme,
154 SchemeType* type); 155 SchemeType* type);
156 // Check whether the url is of the form about:blank, about:blank?foo or
157 // about:blank/#foo.
158 URL_EXPORT bool IsAboutBlankURL(const GURL& url);
Mike West 2017/01/20 12:57:57 Nit: `IsAboutBlank` is shorter, and seems clear en
clamy 2017/01/20 13:19:28 Done.
155 159
156 // Hosts ---------------------------------------------------------------------- 160 // Hosts ----------------------------------------------------------------------
157 161
158 // Returns true if the |canonicalized_host| matches or is in the same domain as 162 // Returns true if the |canonicalized_host| matches or is in the same domain as
159 // the given |lower_ascii_domain| string. For example, if the canonicalized 163 // the given |lower_ascii_domain| string. For example, if the canonicalized
160 // hostname is "www.google.com", this will return true for "com", "google.com", 164 // hostname is "www.google.com", this will return true for "com", "google.com",
161 // and "www.google.com" domains. 165 // and "www.google.com" domains.
162 // 166 //
163 // If either of the input StringPieces is empty, the return value is false. The 167 // If either of the input StringPieces is empty, the return value is false. The
164 // input domain should be a lower-case ASCII string in order to match the 168 // input domain should be a lower-case ASCII string in order to match the
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 255
252 // Escapes the given string as defined by the JS method encodeURIComponent. See 256 // Escapes the given string as defined by the JS method encodeURIComponent. See
253 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeUR IComponent 257 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeUR IComponent
254 URL_EXPORT void EncodeURIComponent(const char* input, 258 URL_EXPORT void EncodeURIComponent(const char* input,
255 int length, 259 int length,
256 CanonOutput* output); 260 CanonOutput* output);
257 261
258 } // namespace url 262 } // namespace url
259 263
260 #endif // URL_URL_UTIL_H_ 264 #endif // URL_URL_UTIL_H_
OLDNEW
« no previous file with comments | « url/url_constants.cc ('k') | url/url_util.cc » ('j') | url/url_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698