| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_FILENAME_UTIL_H_ | 5 #ifndef NET_BASE_FILENAME_UTIL_H_ |
| 6 #define NET_BASE_FILENAME_UTIL_H_ | 6 #define NET_BASE_FILENAME_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
| 12 | 12 |
| 13 class GURL; | 13 class GURL; |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class FilePath; | 16 class FilePath; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace net { | 19 namespace net { |
| 20 | 20 |
| 21 // Given the full path to a file name, creates a file: URL. The returned URL | 21 // Given the full path to a file name, creates a file: URL. The returned URL |
| 22 // may not be valid if the input is malformed. | 22 // may not be valid if the input is malformed. |
| 23 NET_EXPORT GURL FilePathToFileURL(const base::FilePath& path); | 23 NET_EXPORT GURL FilePathToFileURL(const base::FilePath& path); |
| 24 | 24 |
| 25 // Converts a file: URL back to a filename that can be passed to the OS. The | 25 // Converts a file: URL back to a filename that can be passed to the OS. The |
| 26 // file URL must be well-formed (GURL::is_valid() must return true); we don't | 26 // file URL must be well-formed (GURL::is_valid() must return true); we don't |
| 27 // handle degenerate cases here. Returns true on success, false if it isn't a | 27 // handle degenerate cases here. Returns true on success, false if it isn't a |
| 28 // valid file URL. On failure, *file_path will be empty. | 28 // valid file URL. On failure, *file_path will be empty. |
| 29 NET_EXPORT bool FileURLToFilePath(const GURL& url, base::FilePath* file_path); | 29 NET_EXPORT bool FileURLToFilePath(const GURL& url, base::FilePath* file_path); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // | 107 // |
| 108 // Note: |mime_type| should only be non-empty if this function is called from a | 108 // Note: |mime_type| should only be non-empty if this function is called from a |
| 109 // thread that allows IO. | 109 // thread that allows IO. |
| 110 NET_EXPORT void GenerateSafeFileName(const std::string& mime_type, | 110 NET_EXPORT void GenerateSafeFileName(const std::string& mime_type, |
| 111 bool ignore_extension, | 111 bool ignore_extension, |
| 112 base::FilePath* file_path); | 112 base::FilePath* file_path); |
| 113 | 113 |
| 114 } // namespace net | 114 } // namespace net |
| 115 | 115 |
| 116 #endif // NET_BASE_FILENAME_UTIL_H_ | 116 #endif // NET_BASE_FILENAME_UTIL_H_ |
| OLD | NEW |