OLD | NEW |
---|---|
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_WIN) | 10 #if defined(OS_WIN) |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
291 | 291 |
292 // Similar to GetSuggestedFilename(), but returns a FilePath. | 292 // Similar to GetSuggestedFilename(), but returns a FilePath. |
293 NET_EXPORT base::FilePath GenerateFileName( | 293 NET_EXPORT base::FilePath GenerateFileName( |
294 const GURL& url, | 294 const GURL& url, |
295 const std::string& content_disposition, | 295 const std::string& content_disposition, |
296 const std::string& referrer_charset, | 296 const std::string& referrer_charset, |
297 const std::string& suggested_name, | 297 const std::string& suggested_name, |
298 const std::string& mime_type, | 298 const std::string& mime_type, |
299 const std::string& default_name); | 299 const std::string& default_name); |
300 | 300 |
301 // Valid basenames: | 301 // Valid components: |
302 // * are not empty | 302 // * are not empty |
303 // * are not Windows reserved names (CON, NUL.zip, etc.) | 303 // * are not Windows reserved names (CON, NUL.zip, etc.) |
304 // * are just basenames | |
305 // * do not have trailing separators | 304 // * do not have trailing separators |
306 // * do not equal kCurrentDirectory | 305 // * do not equal kCurrentDirectory |
307 // * do not reference the parent directory | 306 // * do not reference the parent directory |
308 // * are valid path components, which: | 307 // * are valid path components, which: |
asanka
2013/09/06 21:19:31
Nit: This line and the extra level of indent isn't
| |
309 // - * are not the empty string | 308 // - * are not the empty string |
310 // - * do not contain illegal characters | 309 // - * do not contain illegal characters |
311 // - * do not end with Windows shell-integrated extensions (even on posix) | 310 // - * do not end with Windows shell-integrated extensions (even on posix) |
312 // - * do not begin with '.' (which would hide them in most file managers) | 311 // - * do not begin with '.' (which would hide them in most file managers) |
313 // - * do not end with ' ' or '.' | 312 // - * do not end with ' ' or '.' |
314 NET_EXPORT bool IsSafePortableBasename(const base::FilePath& path); | 313 NET_EXPORT bool IsSafePortablePathComponent(const base::FilePath& component); |
315 | 314 |
316 // Basenames of valid relative paths are IsSafePortableBasename(), and internal | 315 // Basenames of valid relative paths are IsSafePortableBasename(), and internal |
317 // path components of valid relative paths are valid path components as | 316 // path components of valid relative paths are valid path components as |
318 // described above IsSafePortableBasename(). Valid relative paths are not | 317 // described above IsSafePortableBasename(). Valid relative paths are not |
319 // absolute paths. | 318 // absolute paths. |
320 NET_EXPORT bool IsSafePortableRelativePath(const base::FilePath& path); | 319 NET_EXPORT bool IsSafePortableRelativePath(const base::FilePath& path); |
321 | 320 |
322 // Ensures that the filename and extension is safe to use in the filesystem. | 321 // Ensures that the filename and extension is safe to use in the filesystem. |
323 // | 322 // |
324 // Assumes that |file_path| already contains a valid path or file name. On | 323 // Assumes that |file_path| already contains a valid path or file name. On |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
539 WIFI_PHY_LAYER_PROTOCOL_UNKNOWN | 538 WIFI_PHY_LAYER_PROTOCOL_UNKNOWN |
540 }; | 539 }; |
541 | 540 |
542 // Characterize the PHY mode of the currently associated access point. | 541 // Characterize the PHY mode of the currently associated access point. |
543 // Currently only available on OS_WIN. | 542 // Currently only available on OS_WIN. |
544 NET_EXPORT WifiPHYLayerProtocol GetWifiPHYLayerProtocol(); | 543 NET_EXPORT WifiPHYLayerProtocol GetWifiPHYLayerProtocol(); |
545 | 544 |
546 } // namespace net | 545 } // namespace net |
547 | 546 |
548 #endif // NET_BASE_NET_UTIL_H_ | 547 #endif // NET_BASE_NET_UTIL_H_ |
OLD | NEW |