OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include <string> | 10 #include <string> |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class Time; | 23 class Time; |
24 } | 24 } |
25 | 25 |
26 namespace net { | 26 namespace net { |
27 | 27 |
28 // Given the full path to a file name, creates a file: URL. The returned URL | 28 // Given the full path to a file name, creates a file: URL. The returned URL |
29 // may not be valid if the input is malformed. | 29 // may not be valid if the input is malformed. |
30 GURL FilePathToFileURL(const FilePath& path); | 30 GURL FilePathToFileURL(const FilePath& path); |
31 // Deprecated temporary compatibility function. | |
32 GURL FilePathToFileURL(const std::wstring& file_path); | |
33 | 31 |
34 // Converts a file: URL back to a filename that can be passed to the OS. The | 32 // Converts a file: URL back to a filename that can be passed to the OS. The |
35 // file URL must be well-formed (GURL::is_valid() must return true); we don't | 33 // file URL must be well-formed (GURL::is_valid() must return true); we don't |
36 // handle degenerate cases here. Returns true on success, false if it isn't a | 34 // handle degenerate cases here. Returns true on success, false if it isn't a |
37 // valid file URL. On failure, *file_path will be empty. | 35 // valid file URL. On failure, *file_path will be empty. |
38 bool FileURLToFilePath(const GURL& url, FilePath* file_path); | 36 bool FileURLToFilePath(const GURL& url, FilePath* file_path); |
39 // Deprecated temporary compatibility function. | |
40 bool FileURLToFilePath(const GURL& url, std::wstring* file_path); | |
41 | 37 |
42 // Split an input of the form <host>[":"<port>] into its consitituent parts. | 38 // Split an input of the form <host>[":"<port>] into its consitituent parts. |
43 // Saves the result into |*host| and |*port|. If the input did not have | 39 // Saves the result into |*host| and |*port|. If the input did not have |
44 // the optional port, sets |*port| to -1. | 40 // the optional port, sets |*port| to -1. |
45 // Returns true if the parsing was successful, false otherwise. | 41 // Returns true if the parsing was successful, false otherwise. |
46 // The returned host is NOT canonicalized, and may be invalid. | 42 // The returned host is NOT canonicalized, and may be invalid. |
47 bool GetHostAndPort(std::string::const_iterator host_and_port_begin, | 43 bool GetHostAndPort(std::string::const_iterator host_and_port_begin, |
48 std::string::const_iterator host_and_port_end, | 44 std::string::const_iterator host_and_port_end, |
49 std::string* host, | 45 std::string* host, |
50 int* port); | 46 int* port); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // FTP protocol. Returns true if the port is allowed, false if it is | 151 // FTP protocol. Returns true if the port is allowed, false if it is |
156 // restricted. | 152 // restricted. |
157 bool IsPortAllowedByFtp(int port); | 153 bool IsPortAllowedByFtp(int port); |
158 | 154 |
159 // Set socket to non-blocking mode | 155 // Set socket to non-blocking mode |
160 int SetNonBlocking(int fd); | 156 int SetNonBlocking(int fd); |
161 | 157 |
162 } // namespace net | 158 } // namespace net |
163 | 159 |
164 #endif // NET_BASE_NET_UTIL_H__ | 160 #endif // NET_BASE_NET_UTIL_H__ |
OLD | NEW |