From 9e4602b61c76945961766aa5351c6f941dd5f59b Mon Sep 17 00:00:00 2001 From: klzgrad Date: Thu, 25 Jan 2018 05:02:13 -0500 Subject: [PATCH] net, url: Remove icu --- src/net/BUILD.gn | 11 +++-- src/net/base/filename_util_icu_dummy.cc | 44 +++++++++++++++++++ .../net_string_util_icu_alternatives_dummy.cc | 44 +++++++++++++++++++ src/url/BUILD.gn | 6 +-- src/url/url_canon_icu_alternatives_dummy.cc | 15 +++++++ 5 files changed, 113 insertions(+), 7 deletions(-) create mode 100644 src/net/base/filename_util_icu_dummy.cc create mode 100644 src/net/base/net_string_util_icu_alternatives_dummy.cc create mode 100644 src/url/url_canon_icu_alternatives_dummy.cc diff --git a/src/net/BUILD.gn b/src/net/BUILD.gn index 1e09e9a079..24be09e0d1 100644 --- a/src/net/BUILD.gn +++ b/src/net/BUILD.gn @@ -1599,13 +1599,18 @@ component("net") { if (use_platform_icu_alternatives) { if (is_android) { # Use ICU alternative on Android. - sources += [ "base/net_string_util_icu_alternatives_android.cc" ] + sources += [ + "base/filename_util_icu_dummy.cc", + "base/net_string_util_icu_alternatives_dummy.cc", + ] } else if (is_ios) { # Use ICU alternative on iOS. sources += [ "base/net_string_util_icu_alternatives_ios.mm" ] } else { - assert(false, - "ICU alternative is not implemented for platform: " + target_os) + sources += [ + "base/filename_util_icu_dummy.cc", + "base/net_string_util_icu_alternatives_dummy.cc", + ] } } else { # Use ICU. diff --git a/src/net/base/filename_util_icu_dummy.cc b/src/net/base/filename_util_icu_dummy.cc new file mode 100644 index 0000000000..4c12b707f4 --- /dev/null +++ b/src/net/base/filename_util_icu_dummy.cc @@ -0,0 +1,44 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "net/base/filename_util.h" + +#include "base/files/file_path.h" +#include "base/notreached.h" + +class GURL; + +namespace net { + +bool IsSafePortablePathComponent(const base::FilePath& component) { + NOTIMPLEMENTED(); + return false; +} + +bool IsSafePortableRelativePath(const base::FilePath& path) { + NOTIMPLEMENTED(); + return false; +} + +std::u16string GetSuggestedFilename(const GURL& url, + const std::string& content_disposition, + const std::string& referrer_charset, + const std::string& suggested_name, + const std::string& mime_type, + const std::string& default_name) { + NOTIMPLEMENTED(); + return {}; +} + +base::FilePath GenerateFileName(const GURL& url, + const std::string& content_disposition, + const std::string& referrer_charset, + const std::string& suggested_name, + const std::string& mime_type, + const std::string& default_file_name) { + NOTIMPLEMENTED(); + return {}; +} + +} // namespace net diff --git a/src/net/base/net_string_util_icu_alternatives_dummy.cc b/src/net/base/net_string_util_icu_alternatives_dummy.cc new file mode 100644 index 0000000000..c1cbd972e6 --- /dev/null +++ b/src/net/base/net_string_util_icu_alternatives_dummy.cc @@ -0,0 +1,44 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "net/base/net_string_util.h" + +#include "base/notreached.h" +#include "base/strings/string_piece.h" + +namespace net { + +const char* const kCharsetLatin1 = ""; + +bool ConvertToUtf8(base::StringPiece text, const char* charset, + std::string* output) { + NOTIMPLEMENTED(); + return false; +} + +bool ConvertToUtf8AndNormalize(base::StringPiece text, const char* charset, + std::string* output) { + NOTIMPLEMENTED(); + return false; +} + +bool ConvertToUTF16(base::StringPiece text, const char* charset, + std::u16string* output) { + NOTIMPLEMENTED(); + return false; +} + +bool ConvertToUTF16WithSubstitutions(base::StringPiece text, + const char* charset, + std::u16string* output) { + NOTIMPLEMENTED(); + return false; +} + +bool ToUpper(base::StringPiece16 str, std::u16string* output) { + NOTIMPLEMENTED(); + return false; +} + +} // namespace net diff --git a/src/url/BUILD.gn b/src/url/BUILD.gn index d36d4dca71..fe3d0dbf4d 100644 --- a/src/url/BUILD.gn +++ b/src/url/BUILD.gn @@ -77,13 +77,11 @@ component("url") { # ICU support. if (use_platform_icu_alternatives) { if (is_android) { - sources += [ "url_idna_icu_alternatives_android.cc" ] - deps += [ ":buildflags" ] + sources += [ "url_canon_icu_alternatives_dummy.cc" ] } else if (is_ios) { sources += [ "url_idna_icu_alternatives_ios.mm" ] } else { - assert(false, - "ICU alternative is not implemented for platform: " + target_os) + sources += [ "url_canon_icu_alternatives_dummy.cc" ] } } else { # Use ICU. diff --git a/src/url/url_canon_icu_alternatives_dummy.cc b/src/url/url_canon_icu_alternatives_dummy.cc new file mode 100644 index 0000000000..2d74a3a1c8 --- /dev/null +++ b/src/url/url_canon_icu_alternatives_dummy.cc @@ -0,0 +1,15 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/notreached.h" +#include "url/url_canon.h" + +namespace url { + +bool IDNToASCII(std::u16string_view src, CanonOutputW* output) { + NOTIMPLEMENTED(); + return false; +} + +} // namespace url