OLD | NEW |
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_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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 // Both |name| and |raw_bytes| are escaped internally. | 238 // Both |name| and |raw_bytes| are escaped internally. |
239 NET_API std::string GetDirectoryListingEntry(const string16& name, | 239 NET_API std::string GetDirectoryListingEntry(const string16& name, |
240 const std::string& raw_bytes, | 240 const std::string& raw_bytes, |
241 bool is_dir, int64 size, | 241 bool is_dir, int64 size, |
242 base::Time modified); | 242 base::Time modified); |
243 | 243 |
244 // If text starts with "www." it is removed, otherwise text is returned | 244 // If text starts with "www." it is removed, otherwise text is returned |
245 // unmodified. | 245 // unmodified. |
246 NET_API string16 StripWWW(const string16& text); | 246 NET_API string16 StripWWW(const string16& text); |
247 | 247 |
248 // Gets the filename from the raw Content-Disposition header (as read from the | 248 // Gets the filename in the following order: |
249 // network). Otherwise uses the last path component name or hostname from | 249 // 1) the raw Content-Disposition header (as read from the network). |
250 // |url|. If there is no filename or it can't be used, the given |default_name|, | 250 // |referrer_charset| is used as one of charsets to interpret a raw 8bit |
251 // will be used unless it is empty. | 251 // string in C-D header (after interpreting as UTF-8 fails). |
252 | 252 // See the comment for GetFilenameFromCD for more details. |
253 // Note: it's possible for the suggested filename to be empty (e.g., | 253 // 2) the suggested name |
254 // file:///). referrer_charset is used as one of charsets | 254 // 3) the last path component name or hostname from |url| |
255 // to interpret a raw 8bit string in C-D header (after interpreting | 255 // 4) the given |default_name| |
256 // as UTF-8 fails). See the comment for GetFilenameFromCD for more details. | 256 // 5) the hard-coded name "download", as the last resort |
257 NET_API string16 GetSuggestedFilename(const GURL& url, | 257 NET_API string16 GetSuggestedFilename(const GURL& url, |
258 const std::string& content_disposition, | 258 const std::string& content_disposition, |
259 const std::string& referrer_charset, | 259 const std::string& referrer_charset, |
| 260 const std::string& suggested_name, |
260 const string16& default_name); | 261 const string16& default_name); |
261 | 262 |
262 // Checks the given port against a list of ports which are restricted by | 263 // Checks the given port against a list of ports which are restricted by |
263 // default. Returns true if the port is allowed, false if it is restricted. | 264 // default. Returns true if the port is allowed, false if it is restricted. |
264 bool IsPortAllowedByDefault(int port); | 265 bool IsPortAllowedByDefault(int port); |
265 | 266 |
266 // Checks the given port against a list of ports which are restricted by the | 267 // Checks the given port against a list of ports which are restricted by the |
267 // FTP protocol. Returns true if the port is allowed, false if it is | 268 // FTP protocol. Returns true if the port is allowed, false if it is |
268 // restricted. | 269 // restricted. |
269 bool IsPortAllowedByFtp(int port); | 270 bool IsPortAllowedByFtp(int port); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 | 457 |
457 // Returns list of network interfaces except loopback interface. If an | 458 // Returns list of network interfaces except loopback interface. If an |
458 // interface has more than one address, a separate entry is added to | 459 // interface has more than one address, a separate entry is added to |
459 // the list for each address. | 460 // the list for each address. |
460 // Can be called only on a thread that allows IO. | 461 // Can be called only on a thread that allows IO. |
461 NET_API bool GetNetworkList(NetworkInterfaceList* networks); | 462 NET_API bool GetNetworkList(NetworkInterfaceList* networks); |
462 | 463 |
463 } // namespace net | 464 } // namespace net |
464 | 465 |
465 #endif // NET_BASE_NET_UTIL_H_ | 466 #endif // NET_BASE_NET_UTIL_H_ |
OLD | NEW |