OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_NET_UTIL_H_ | 5 #ifndef NET_BASE_NET_UTIL_H_ |
6 #define NET_BASE_NET_UTIL_H_ | 6 #define NET_BASE_NET_UTIL_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #ifdef OS_WIN | 10 #ifdef OS_WIN |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 const std::string& raw_bytes, | 189 const std::string& raw_bytes, |
190 bool is_dir, int64 size, | 190 bool is_dir, int64 size, |
191 base::Time modified); | 191 base::Time modified); |
192 | 192 |
193 // If text starts with "www." it is removed, otherwise text is returned | 193 // If text starts with "www." it is removed, otherwise text is returned |
194 // unmodified. | 194 // unmodified. |
195 std::wstring StripWWW(const std::wstring& text); | 195 std::wstring StripWWW(const std::wstring& text); |
196 | 196 |
197 // Gets the filename from the raw Content-Disposition header (as read from the | 197 // Gets the filename from the raw Content-Disposition header (as read from the |
198 // network). Otherwise uses the last path component name or hostname from | 198 // network). Otherwise uses the last path component name or hostname from |
199 // |url|. If there is no filename or it can't be used, the given default name | 199 // |url|. If there is no filename or it can't be used, the given |default_name|, |
200 // will be used if specified. | 200 // will be used unless it is empty. |
201 | 201 |
202 // Note: it's possible for the suggested filename to be empty (e.g., | 202 // Note: it's possible for the suggested filename to be empty (e.g., |
203 // file:///). referrer_charset is used as one of charsets | 203 // file:///). referrer_charset is used as one of charsets |
204 // to interpret a raw 8bit string in C-D header (after interpreting | 204 // to interpret a raw 8bit string in C-D header (after interpreting |
205 // as UTF-8 fails). See the comment for GetFilenameFromCD for more details. | 205 // as UTF-8 fails). See the comment for GetFilenameFromCD for more details. |
206 FilePath GetSuggestedFilename(const GURL& url, | 206 FilePath GetSuggestedFilename(const GURL& url, |
207 const std::string& content_disposition, | 207 const std::string& content_disposition, |
208 const std::string& referrer_charset, | 208 const std::string& referrer_charset, |
209 const char* default_name); | 209 const FilePath& default_name); |
210 | 210 |
211 // Checks the given port against a list of ports which are restricted by | 211 // Checks the given port against a list of ports which are restricted by |
212 // default. Returns true if the port is allowed, false if it is restricted. | 212 // default. Returns true if the port is allowed, false if it is restricted. |
213 bool IsPortAllowedByDefault(int port); | 213 bool IsPortAllowedByDefault(int port); |
214 | 214 |
215 // Checks the given port against a list of ports which are restricted by the | 215 // Checks the given port against a list of ports which are restricted by the |
216 // FTP protocol. Returns true if the port is allowed, false if it is | 216 // FTP protocol. Returns true if the port is allowed, false if it is |
217 // restricted. | 217 // restricted. |
218 bool IsPortAllowedByFtp(int port); | 218 bool IsPortAllowedByFtp(int port); |
219 | 219 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 // Strip the portions of |url| that aren't core to the network request. | 258 // Strip the portions of |url| that aren't core to the network request. |
259 // - user name / password | 259 // - user name / password |
260 // - reference section | 260 // - reference section |
261 GURL SimplifyUrlForRequest(const GURL& url); | 261 GURL SimplifyUrlForRequest(const GURL& url); |
262 | 262 |
263 void SetExplicitlyAllowedPorts(const std::wstring& allowed_ports); | 263 void SetExplicitlyAllowedPorts(const std::wstring& allowed_ports); |
264 | 264 |
265 } // namespace net | 265 } // namespace net |
266 | 266 |
267 #endif // NET_BASE_NET_UTIL_H_ | 267 #endif // NET_BASE_NET_UTIL_H_ |
OLD | NEW |