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

Side by Side Diff: net/base/net_util.h

Issue 1548503002: net: extract GetDirectoryListingXXX functions into directory_listing.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #if defined(OS_POSIX) 10 #if defined(OS_POSIX)
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // The rules are: 128 // The rules are:
129 // * One or more components separated by '.' 129 // * One or more components separated by '.'
130 // * Each component contains only alphanumeric characters and '-' or '_' 130 // * Each component contains only alphanumeric characters and '-' or '_'
131 // * The last component begins with an alphanumeric character 131 // * The last component begins with an alphanumeric character
132 // * Optional trailing dot after last component (means "treat as FQDN") 132 // * Optional trailing dot after last component (means "treat as FQDN")
133 // 133 //
134 // NOTE: You should only pass in hosts that have been returned from 134 // NOTE: You should only pass in hosts that have been returned from
135 // CanonicalizeHost(), or you may not get accurate results. 135 // CanonicalizeHost(), or you may not get accurate results.
136 NET_EXPORT bool IsCanonicalizedHostCompliant(const std::string& host); 136 NET_EXPORT bool IsCanonicalizedHostCompliant(const std::string& host);
137 137
138 // Call these functions to get the html snippet for a directory listing.
139 // The return values of both functions are in UTF-8.
140 NET_EXPORT std::string GetDirectoryListingHeader(const base::string16& title);
141
142 // Given the name of a file in a directory (ftp or local) and
143 // other information (is_dir, size, modification time), it returns
144 // the html snippet to add the entry for the file to the directory listing.
145 // Currently, it's a script tag containing a call to a Javascript function
146 // |addRow|.
147 //
148 // |name| is the file name to be displayed. |raw_bytes| will be used
149 // as the actual target of the link (so for example, ftp links should use
150 // server's encoding). If |raw_bytes| is an empty string, UTF-8 encoded |name|
151 // will be used.
152 //
153 // Both |name| and |raw_bytes| are escaped internally.
154 NET_EXPORT std::string GetDirectoryListingEntry(const base::string16& name,
155 const std::string& raw_bytes,
156 bool is_dir,
157 int64_t size,
158 base::Time modified);
159
160 // Strip the portions of |url| that aren't core to the network request. 138 // Strip the portions of |url| that aren't core to the network request.
161 // - user name / password 139 // - user name / password
162 // - reference section 140 // - reference section
163 NET_EXPORT_PRIVATE GURL SimplifyUrlForRequest(const GURL& url); 141 NET_EXPORT_PRIVATE GURL SimplifyUrlForRequest(const GURL& url);
164 142
165 // Retuns the port field of the |sockaddr|. 143 // Retuns the port field of the |sockaddr|.
166 const uint16_t* GetPortFieldFromSockaddr(const struct sockaddr* address, 144 const uint16_t* GetPortFieldFromSockaddr(const struct sockaddr* address,
167 socklen_t address_len); 145 socklen_t address_len);
168 // Returns the value of port in |sockaddr| (in host byte ordering). 146 // Returns the value of port in |sockaddr| (in host byte ordering).
169 NET_EXPORT_PRIVATE int GetPortFromSockaddr(const struct sockaddr* address, 147 NET_EXPORT_PRIVATE int GetPortFromSockaddr(const struct sockaddr* address,
(...skipping 16 matching lines...) Expand all
186 // machine. 164 // machine.
187 NET_EXPORT_PRIVATE bool IsLocalhost(base::StringPiece host); 165 NET_EXPORT_PRIVATE bool IsLocalhost(base::StringPiece host);
188 166
189 // Returns true if the url's host is a Google server. This should only be used 167 // Returns true if the url's host is a Google server. This should only be used
190 // for histograms and shouldn't be used to affect behavior. 168 // for histograms and shouldn't be used to affect behavior.
191 NET_EXPORT_PRIVATE bool HasGoogleHost(const GURL& url); 169 NET_EXPORT_PRIVATE bool HasGoogleHost(const GURL& url);
192 170
193 } // namespace net 171 } // namespace net
194 172
195 #endif // NET_BASE_NET_UTIL_H_ 173 #endif // NET_BASE_NET_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698