Revert of Re-enabling webrtc Telemetry tests. (patchset #1 id:1 of https://codereview...
[chromium-blink-merge.git] / net / base / filename_util_internal.h
blobc1a73bb3a7e6835e683205f46ded548776672fa2
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 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
36 // characters.
37 base::string16 GetSuggestedFilenameImpl(
38 const GURL& url,
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
47 // characters.
48 base::FilePath GenerateFileNameImpl(
49 const GURL& url,
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);
57 } // namespace net
59 #endif // NET_BASE_FILENAME_UTIL_INTERNAL_H_