blob: 33c59f261154de44f13905951339a5a5ed40b3df [file] [log] [blame]
Yafei Duan69ddcfd92018-02-02 00:03:421// 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 Wennborgdf87046c2020-04-28 11:06:247#include "base/check.h"
Yafei Duan69ddcfd92018-02-02 00:03:428#include "base/files/file_path.h"
9#include "base/files/file_util.h"
10#include "base/i18n/file_util_icu.h"
Yafei Duan69ddcfd92018-02-02 00:03:4211#include "base/strings/string_util.h"
12#include "base/strings/sys_string_conversions.h"
13#include "base/strings/utf_string_conversions.h"
Yafei Duanc9f95ec2018-02-08 02:35:3114#include "base/third_party/icu/icu_utf.h"
Yafei Duanc9f95ec2018-02-08 02:35:3115#include "build/build_config.h"
Yafei Duan69ddcfd92018-02-02 00:03:4216#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
21namespace filename_generation {
22
23namespace {
24
Yafei Duanc9f95ec2018-02-08 02:35:3125// 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.
27const size_t kTruncatedNameLengthLowerbound = 5;
28
Yafei Duan