Yafei Duan | 69ddcfd9 | 2018-02-02 00:03:42 | [diff] [blame] | 1 | // Copyright 2018 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. |
| 4 | |
| 5 | #include "components/filename_generation/filename_generation.h" |
| 6 | |
Hans Wennborg | df87046c | 2020-04-28 11:06:24 | [diff] [blame^] | 7 | #include "base/check.h" |
Yafei Duan | 69ddcfd9 | 2018-02-02 00:03:42 | [diff] [blame] | 8 | #include "base/files/file_path.h" |
| 9 | #include "base/files/file_util.h" |
| 10 | #include "base/i18n/file_util_icu.h" |
Yafei Duan | 69ddcfd9 | 2018-02-02 00:03:42 | [diff] [blame] | 11 | #include "base/strings/string_util.h" |
| 12 | #include "base/strings/sys_string_conversions.h" |
| 13 | #include "base/strings/utf_string_conversions.h" |
Yafei Duan | c9f95ec | 2018-02-08 02:35:31 | [diff] [blame] | 14 | #include "base/third_party/icu/icu_utf.h" |
Yafei Duan | c9f95ec | 2018-02-08 02:35:31 | [diff] [blame] | 15 | #include "build/build_config.h" |
Yafei Duan | 69ddcfd9 | 2018-02-02 00:03:42 | [diff] [blame] | 16 | #include "components/url_formatter/url_formatter.h" |
| 17 | #include "net/base/filename_util.h" |
| 18 | #include "net/base/mime_util.h" |
| 19 | #include "url/gurl.h" |
| 20 | |
| 21 | namespace filename_generation { |
| 22 | |
| 23 | namespace { |
| 24 | |
Yafei Duan | c9f95ec | 2018-02-08 02:35:31 | [diff] [blame] | 25 | // The lower bound for file name truncation. If the truncation results in a name |
| 26 | // shorter than this limit, we give up automatic truncation and prompt the user. |
| 27 | const size_t kTruncatedNameLengthLowerbound = 5; |
| 28 | |
Yafei Duan |
|