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

Side by Side Diff: url/url_util.h

Issue 2623353002: Share schemes needed for mixed content checking between the browser and renderer. (Closed)
Patch Set: remove unused public methods 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
« no previous file with comments | « third_party/WebKit/public/web/WebSecurityPolicy.h ('k') | url/url_util.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 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 10
10 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
11 #include "base/strings/string_piece.h" 12 #include "base/strings/string_piece.h"
12 #include "url/third_party/mozilla/url_parse.h" 13 #include "url/third_party/mozilla/url_parse.h"
13 #include "url/url_canon.h" 14 #include "url/url_canon.h"
14 #include "url/url_constants.h" 15 #include "url/url_constants.h"
15 #include "url/url_export.h" 16 #include "url/url_export.h"
16 17
17 namespace url { 18 namespace url {
18 19
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // A URL with the scheme doesn't have the authority component. 51 // A URL with the scheme doesn't have the authority component.
51 SCHEME_WITHOUT_AUTHORITY, 52 SCHEME_WITHOUT_AUTHORITY,
52 }; 53 };
53 54
54 // A pair for representing a standard scheme name and the SchemeType for it. 55 // A pair for representing a standard scheme name and the SchemeType for it.
55 struct URL_EXPORT SchemeWithType { 56 struct URL_EXPORT SchemeWithType {
56 const char* scheme; 57 const char* scheme;
57 SchemeType type; 58 SchemeType type;
58 }; 59 };
59 60
61 // The following Add*Scheme method are not threadsafe and can not be called
62 // concurrently with any other url_util function. They will assert if the lists
63 // of schemes have been locked (see LockSchemeRegistries).
64
60 // Adds an application-defined scheme to the internal list of "standard-format" 65 // Adds an application-defined scheme to the internal list of "standard-format"
61 // URL schemes. A standard-format scheme adheres to what RFC 3986 calls "generic 66 // URL schemes. A standard-format scheme adheres to what RFC 3986 calls "generic
62 // URI syntax" (https://tools.ietf.org/html/rfc3986#section-3). 67 // URI syntax" (https://tools.ietf.org/html/rfc3986#section-3).
63 // 68
64 // This function is not threadsafe and can not be called concurrently with any
65 // other url_util function. It will assert if the lists of schemes have
66 // been locked (see LockSchemeRegistries).
67 URL_EXPORT void AddStandardScheme(const char* new_scheme, 69 URL_EXPORT void AddStandardScheme(const char* new_scheme,
68 SchemeType scheme_type); 70 SchemeType scheme_type);
69 71
70 // Adds an application-defined scheme to the internal list of schemes allowed 72 // Adds an application-defined scheme to the internal list of schemes allowed
71 // for referrers. 73 // for referrers.
72 //
73 // This function is not threadsafe and can not be called concurrently with any
74 // other url_util function. It will assert if the lists of schemes have
75 // been locked (see LockSchemeRegistries).
76 URL_EXPORT void AddReferrerScheme(const char* new_scheme, 74 URL_EXPORT void AddReferrerScheme(const char* new_scheme,
77 SchemeType scheme_type); 75 SchemeType scheme_type);
78 76
77 // Adds an application-defined scheme to the list of schemes that do not trigger
78 // mixed content warnings.
79 URL_EXPORT void AddSecureScheme(const char* new_scheme);
80 URL_EXPORT const std::vector<std::string>& GetSecureSchemes();
81
82 // Adds an application-defined scheme to the list of schemes that normal pages
83 // cannot link to or access (i.e., with the same security rules as those applied
84 // to "file" URLs).
85 URL_EXPORT void AddLocalScheme(const char* new_scheme);
86 URL_EXPORT const std::vector<std::string>& GetLocalSchemes();
87
88 // Adds an application-defined scheme to the list of schemes that cause pages
89 // loaded with them to not have access to pages loaded with any other URL
90 // scheme.
91 URL_EXPORT void AddNoAccessScheme(const char* new_scheme);
92 URL_EXPORT const std::vector<std::string>& GetNoAccessSchemes();
93
94 // Adds an application-defined scheme to the list of schemes that can be sent
95 // CORS requests.
96 URL_EXPORT void AddCORSEnabledScheme(const char* new_scheme);
97 URL_EXPORT const std::vector<std::string>& GetCORSEnabledSchemes();
98
79 // Sets a flag to prevent future calls to Add*Scheme from succeeding. 99 // Sets a flag to prevent future calls to Add*Scheme from succeeding.
80 // 100 //
81 // This is designed to help prevent errors for multithreaded applications. 101 // This is designed to help prevent errors for multithreaded applications.
82 // Normal usage would be to call Add*Scheme for your custom schemes at 102 // Normal usage would be to call Add*Scheme for your custom schemes at
83 // the beginning of program initialization, and then LockSchemeRegistries. This 103 // the beginning of program initialization, and then LockSchemeRegistries. This
84 // prevents future callers from mistakenly calling Add*Scheme when the 104 // prevents future callers from mistakenly calling Add*Scheme when the
85 // program is running with multiple threads, where such usage would be 105 // program is running with multiple threads, where such usage would be
86 // dangerous. 106 // dangerous.
87 // 107 //
88 // We could have had Add*Scheme use a lock instead, but that would add 108 // We could have had Add*Scheme use a lock instead, but that would add
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 251
232 // Escapes the given string as defined by the JS method encodeURIComponent. See 252 // Escapes the given string as defined by the JS method encodeURIComponent. See
233 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeUR IComponent 253 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeUR IComponent
234 URL_EXPORT void EncodeURIComponent(const char* input, 254 URL_EXPORT void EncodeURIComponent(const char* input,
235 int length, 255 int length,
236 CanonOutput* output); 256 CanonOutput* output);
237 257
238 } // namespace url 258 } // namespace url
239 259
240 #endif // URL_URL_UTIL_H_ 260 #endif // URL_URL_UTIL_H_
OLDNEW
« no previous file with comments | « third_party/WebKit/public/web/WebSecurityPolicy.h ('k') | url/url_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698