PlzNavigate: Improvements to RFHM commit logic.
[chromium-blink-merge.git] / net / base / filename_util_internal.h
blobd2e5dadc2c8b66c6c051c4db34cc37a71d9ba8a9
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
3 // found in the LICENSE file.
5 // Functions used internally by filename_util, and filename_util_icu.
7 #ifndef NET_BASE_FILENAME_UTIL_INTERNAL_H_
8 #define NET_BASE_FILENAME_UTIL_INTERNAL_H_
10 #include <string>
12 #include "base/callback.h"
13 #include "base/files/file_path.h"
14 #include "base/strings/string16.h"
16 class GURL;
18 namespace net {
20 typedef base::Callback<
21 void(base::FilePath::StringType* file_name, char replace_char)>
22 ReplaceIllegalCharactersCallback;
24 void SanitizeGeneratedFileName(base::FilePath::StringType* filename,
25 bool replace_trailing);
27 bool IsShellIntegratedExtension(const base::FilePath::StringType& extension);
29 bool IsReservedName(const base::FilePath::StringType& filename);
31 void EnsureSafeExtension(const std::string& mime_type,
32 bool ignore_extension,
33 base::FilePath* file_name);
35 bool FilePathToString16(const base::FilePath& path, base::string16* converted);
37 // Similar to GetSuggestedFilename(), but takes callback to replace illegal
38 // characters.
39 base::string16 GetSuggestedFilenameImpl(
40 const GURL& url,
41 const std::string& content_disposition,
42 const std::string& referrer_charset,
43 const std::string& suggested_name,
44 const std::string& mime_type,
45 const std::string& default_name,
46 ReplaceIllegalCharactersCallback replace_illegal_characters_callback);
48 // Similar to GenerateFileName(), but takes callback to replace illegal
49 // characters.
50 base::FilePath GenerateFileNameImpl(
51 const GURL& url,
52 const std::string& content_disposition,
53 const std::string& referrer_charset,
54 const std::string& suggested_name,
55 const std::string& mime_type,
56 const std::string& default_name,
57 ReplaceIllegalCharactersCallback replace_illegal_characters_callback);
59 } // namespace net
61 #endif // NET_BASE_FILENAME_UTIL_INTERNAL_H_