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_
12 #include "base/callback.h"
13 #include "base/files/file_path.h"
14 #include "base/strings/string16.h"
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 void EnsureSafeExtension(const std::string
& mime_type
,
30 bool ignore_extension
,
31 base::FilePath
* file_name
);
33 bool FilePathToString16(const base::FilePath
& path
, base::string16
* converted
);
35 // Similar to GetSuggestedFilename(), but takes callback to replace illegal
37 base::string16
GetSuggestedFilenameImpl(
39 const std::string
& content_disposition
,
40 const std::string
& referrer_charset
,
41 const std::string
& suggested_name
,
42 const std::string
& mime_type
,
43 const std::string
& default_name
,
44 ReplaceIllegalCharactersCallback replace_illegal_characters_callback
);
46 // Similar to GenerateFileName(), but takes callback to replace illegal
48 base::FilePath
GenerateFileNameImpl(
50 const std::string
& content_disposition
,
51 const std::string
& referrer_charset
,
52 const std::string
& suggested_name
,
53 const std::string
& mime_type
,
54 const std::string
& default_name
,
55 ReplaceIllegalCharactersCallback replace_illegal_characters_callback
);
59 #endif // NET_BASE_FILENAME_UTIL_INTERNAL_H_