[go: nahoru, domu]

Reland "[base] Prepare //net for base::string16 switch"

This is a reland of ee99ff7f2e5b8a5d90a1c5fd3fe2e3eb5a8fb8f6

Original change's description:
> [base] Prepare //net for base::string16 switch
>
> This change prepares //net for the switch of base::string16 to
> std::u16string on all platforms. This was achieved by making
> net_unittests compile on Windows after the switch was made.
>
> Furthermore, it fixes small issues in //base and //sql.
>
> Bug: 911896
> Change-Id: I11fd80998e9f5e954a87870533685a3f77fa42d9
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2303431
> Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
> Reviewed-by: Matt Menke <mmenke@chromium.org>
> Reviewed-by: Victor Costan <pwnall@chromium.org>
> Reviewed-by: Will Harris <wfh@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Auto-Submit: Jan Wilken Dörrie <jdoerrie@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#790126}

TBR=wfh

Bug: 911896
Change-Id: Ibbd6cb6695b40149971186f05ffb6b859acd68f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2309689
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#790444}
diff --git a/base/i18n/file_util_icu_unittest.cc b/base/i18n/file_util_icu_unittest.cc
index 72e65f2..e1517df 100644
--- a/base/i18n/file_util_icu_unittest.cc
+++ b/base/i18n/file_util_icu_unittest.cc
@@ -7,6 +7,7 @@
 #include <stddef.h>
 
 #include "base/files/file_util.h"
+#include "base/logging.h"
 #include "base/stl_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "build/build_config.h"
diff --git a/base/i18n/rtl_unittest.cc b/base/i18n/rtl_unittest.cc
index 8722310..6846bac 100644
--- a/base/i18n/rtl_unittest.cc
+++ b/base/i18n/rtl_unittest.cc
@@ -9,6 +9,7 @@
 #include <algorithm>
 
 #include "base/files/file_path.h"
+#include "base/logging.h"
 #include "base/macros.h"
 #include "base/strings/string_util.h"
 #include "base/strings/sys_string_conversions.h"
diff --git a/base/strings/string_util_win.h b/base/strings/string_util_win.h
index cd4bb2f..0756608d 100644
--- a/base/strings/string_util_win.h
+++ b/base/strings/string_util_win.h
@@ -147,7 +147,7 @@
 
 BASE_EXPORT bool TrimString(WStringPiece input,
                             WStringPiece trim_chars,
-                            std::string* output);
+                            std::wstring* output);
 
 BASE_EXPORT WStringPiece TrimString(WStringPiece input,
                                     WStringPiece trim_chars,
diff --git a/content/public/test/url_loader_interceptor.cc b/content/public/test/url_loader_interceptor.cc
index 0dde003..ca21fac24 100644
--- a/content/public/test/url_loader_interceptor.cc
+++ b/content/public/test/url_loader_interceptor.cc
@@ -587,16 +587,8 @@
   if (headers) {
     headers_str = *headers;
   } else {
-    base::FilePath::StringPieceType mock_headers_extension;
-#if defined(OS_WIN)
-    base::string16 temp =
-        base::ASCIIToUTF16(net::test_server::kMockHttpHeadersExtension);
-    mock_headers_extension = temp;
-#else
-    mock_headers_extension = net::test_server::kMockHttpHeadersExtension;
-#endif
-
-    base::FilePath headers_path(file_path.AddExtension(mock_headers_extension));
+    base::FilePath headers_path(
+        file_path.AddExtension(net::test_server::kMockHttpHeadersExtension));
     if (base::PathExists(headers_path)) {
       headers_str = ReadFile(headers_path);
     } else {
diff --git a/net/base/filename_util.cc b/net/base/filename_util.cc
index a514c48..1471fb96 100644
--- a/net/base/filename_util.cc
+++ b/net/base/filename_util.cc
@@ -58,7 +58,7 @@
       &url_string, 0, FILE_PATH_LITERAL("\\"), FILE_PATH_LITERAL("%5C"));
 #endif
 
-  return GURL(url_string);
+  return GURL(base::AsCrossPlatformPiece(url_string));
 }
 
 bool FileURLToFilePath(const GURL& url, base::FilePath* file_path) {
@@ -132,7 +132,7 @@
 
 #if defined(OS_WIN)
   if (base::IsStringUTF8(path)) {
-    file_path_str.assign(base::UTF8ToUTF16(path));
+    file_path_str.assign(base::UTF8ToWide(path));
     // We used to try too hard and see if |path| made up entirely of
     // the 1st 256 characters in the Unicode was a zero-extended UTF-16.
     // If so, we converted it to 'Latin-1' and checked if the result was UTF-8.
@@ -144,7 +144,7 @@
     // are giving the conversion function a nonempty string, and it may fail if
     // the given string is not in the current encoding and give us an empty
     // string back. We detect this and report failure.
-    file_path_str = base::WideToUTF16(base::SysNativeMBToWide(path));
+    file_path_str = base::SysNativeMBToWide(path);
   }
 #else  // defined(OS_WIN)
   // Collapse multiple path slashes into a single path slash.
@@ -193,7 +193,7 @@
       "com5", "com6", "com7", "com8", "com9", "lpt1", "lpt2",  "lpt3",
       "lpt4", "lpt5", "lpt6", "lpt7", "lpt8", "lpt9", "clock$"};
 #if defined(OS_WIN)
-  std::string filename_lower = base::ToLowerASCII(base::UTF16ToUTF8(filename));
+  std::string filename_lower = base::ToLowerASCII(base::WideToUTF8(filename));
 #elif defined(OS_POSIX) || defined(OS_FUCHSIA)
   std::string filename_lower = base::ToLowerASCII(filename);
 #endif
diff --git a/net/base/filename_util_internal.cc b/net/base/filename_util_internal.cc
index 92db27ab..3cb42b5 100644
--- a/net/base/filename_util_internal.cc
+++ b/net/base/filename_util_internal.cc
@@ -207,7 +207,7 @@
 
 bool FilePathToString16(const base::FilePath& path, base::string16* converted) {
 #if defined(OS_WIN)
-  *converted = path.value();
+  converted->assign(path.value().begin(), path.value().end());
   return true;
 #elif defined(OS_POSIX) || defined(OS_FUCHSIA)
   std::string component8 = path.AsUTF8Unsafe();
@@ -266,8 +266,8 @@
   base::FilePath::StringType result_str, default_name_str;
 #if defined(OS_WIN)
   replace_trailing = true;
-  result_str = base::UTF8ToUTF16(filename);
-  default_name_str = base::UTF8ToUTF16(default_name);
+  result_str = base::UTF8ToWide(filename);
+  default_name_str = base::UTF8ToWide(default_name);
 #elif defined(OS_POSIX) || defined(OS_FUCHSIA)
   result_str = filename;
   default_name_str = default_name;
@@ -319,7 +319,7 @@
       replace_illegal_characters_function);
 
 #if defined(OS_WIN)
-  base::FilePath generated_name(file_name);
+  base::FilePath generated_name(base::AsWStringPiece(file_name));
 #elif defined(OS_POSIX) || defined(OS_FUCHSIA)
   base::FilePath generated_name(
       base::SysWideToNativeMB(base::UTF16ToWide(file_name)));
diff --git a/net/base/filename_util_unittest.cc b/net/base/filename_util_unittest.cc
index 9ad798c..8e3b6602 100644
--- a/net/base/filename_util_unittest.cc
+++ b/net/base/filename_util_unittest.cc
@@ -39,14 +39,14 @@
 // std::u16string.
 std::wstring FilePathAsWString(const base::FilePath& path) {
 #if defined(OS_WIN)
-  return base::UTF16ToWide(path.value());
+  return path.value();
 #elif defined(OS_POSIX) || defined(OS_FUCHSIA)
   return base::UTF8ToWide(path.value());
 #endif
 }
 base::FilePath WStringAsFilePath(const std::wstring& str) {
 #if defined(OS_WIN)
-  return base::FilePath(base::WideToUTF16(str));
+  return base::FilePath(str);
 #elif defined(OS_POSIX) || defined(OS_FUCHSIA)
   return base::FilePath(base::WideToUTF8(str));
 #endif
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc
index 357006b1..1abed03 100644
--- a/net/base/mime_util.cc
+++ b/net/base/mime_util.cc
@@ -245,7 +245,7 @@
 static base::FilePath::StringType StringToFilePathStringType(
     const base::StringPiece& string_piece) {
 #if defined(OS_WIN)
-  return base::UTF8ToUTF16(string_piece);
+  return base::UTF8ToWide(string_piece);
 #else
   return string_piece.as_string();
 #endif
diff --git a/net/base/network_interfaces_unittest.cc b/net/base/network_interfaces_unittest.cc
index b5c5a19..5543169 100644
--- a/net/base/network_interfaces_unittest.cc
+++ b/net/base/network_interfaces_unittest.cc
@@ -51,7 +51,7 @@
     EXPECT_EQ(static_cast<DWORD>(NO_ERROR),
               ConvertInterfaceLuidToGuid(&luid, &guid));
     auto name = base::win::String16FromGUID(guid);
-    EXPECT_EQ(base::as_u16cstr(base::UTF8ToWide(it->name)), name);
+    EXPECT_EQ(base::UTF8ToWide(it->name), name);
 
     if (it->type == NetworkChangeNotifier::CONNECTION_WIFI) {
       EXPECT_NE(WIFI_PHY_LAYER_PROTOCOL_NONE, GetWifiPHYLayerProtocol());
diff --git a/net/base/platform_mime_util_win.cc b/net/base/platform_mime_util_win.cc
index 47f61827..c2b843d26 100644
--- a/net/base/platform_mime_util_win.cc
+++ b/net/base/platform_mime_util_win.cc
@@ -20,9 +20,9 @@
   // names are not case-sensitive).
   base::FilePath::StringType value, key = FILE_PATH_LITERAL(".") + ext;
   base::win::RegKey(HKEY_CLASSES_ROOT, key.c_str(), KEY_READ)
-      .ReadValue(STRING16_LITERAL("Content Type"), &value);
+      .ReadValue(L"Content Type", &value);
   if (!value.empty()) {
-    *result = base::UTF16ToUTF8(value);
+    *result = base::WideToUTF8(value);
     return true;
   }
   return false;
@@ -32,10 +32,9 @@
     const std::string& mime_type,
     base::FilePath::StringType* ext) const {
   base::FilePath::StringType key =
-      STRING16_LITERAL("MIME\\Database\\Content Type\\") +
-      base::UTF8ToUTF16(mime_type);
+      L"MIME\\Database\\Content Type\\" + base::UTF8ToWide(mime_type);
   if (base::win::RegKey(HKEY_CLASSES_ROOT, key.c_str(), KEY_READ)
-          .ReadValue(STRING16_LITERAL("Extension"), ext) != ERROR_SUCCESS) {
+          .ReadValue(L"Extension", ext) != ERROR_SUCCESS) {
     return false;
   }
   // Strip off the leading dot, this should always be the case.
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc
index 3e98e97..ff17771 100644
--- a/net/disk_cache/backend_unittest.cc
+++ b/net/disk_cache/backend_unittest.cc
@@ -3919,13 +3919,13 @@
 #if defined(OS_WIN)
   DWORD sharing = FILE_SHARE_READ | FILE_SHARE_WRITE;
   DWORD access = GENERIC_READ | GENERIC_WRITE;
-  base::win::ScopedHandle file2(CreateFile(base::as_wcstr(name.value()), access,
+  base::win::ScopedHandle file2(CreateFile(name.value().c_str(), access,
                                            sharing, nullptr, OPEN_EXISTING, 0,
                                            nullptr));
   EXPECT_FALSE(file2.IsValid());
 
   sharing |= FILE_SHARE_DELETE;
-  file2.Set(CreateFile(base::as_wcstr(name.value()), access, sharing, nullptr,
+  file2.Set(CreateFile(name.value().c_str(), access, sharing, nullptr,
                        OPEN_EXISTING, 0, nullptr));
   EXPECT_TRUE(file2.IsValid());
 #endif
diff --git a/net/disk_cache/blockfile/file_win.cc b/net/disk_cache/blockfile/file_win.cc
index 9dfb629..6eebc48 100644
--- a/net/disk_cache/blockfile/file_win.cc
+++ b/net/disk_cache/blockfile/file_win.cc
@@ -115,9 +115,9 @@
 
   DWORD sharing = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
   DWORD access = GENERIC_READ | GENERIC_WRITE | DELETE;
-  base_file_ = base::File(CreateFile(base::as_wcstr(name.value()), access,
-                                     sharing, nullptr, OPEN_EXISTING,
-                                     FILE_FLAG_OVERLAPPED, nullptr));
+  base_file_ =
+      base::File(CreateFile(name.value().c_str(), access, sharing, nullptr,
+                            OPEN_EXISTING, FILE_FLAG_OVERLAPPED, nullptr));
 
   if (!base_file_.IsValid())
     return false;
@@ -126,9 +126,8 @@
                                                   CompletionHandler::Get());
 
   init_ = true;
-  sync_base_file_ =
-      base::File(CreateFile(base::as_wcstr(name.value()), access, sharing,
-                            nullptr, OPEN_EXISTING, 0, nullptr));
+  sync_base_file_ = base::File(CreateFile(name.value().c_str(), access, sharing,
+                                          nullptr, OPEN_EXISTING, 0, nullptr));
 
   if (!sync_base_file_.IsValid())
     return false;
diff --git a/net/disk_cache/cache_util.cc b/net/disk_cache/cache_util.cc
index 5512ae8f..79b260d 100644
--- a/net/disk_cache/cache_util.cc
+++ b/net/disk_cache/cache_util.cc
@@ -10,6 +10,7 @@
 #include "base/files/file_enumerator.h"
 #include "base/files/file_util.h"
 #include "base/location.h"
+#include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/task/post_task.h"
@@ -124,7 +125,7 @@
   base::FilePath name = current_path.BaseName();
 #if defined(OS_WIN)
   // We created this file so it should only contain ASCII.
-  std::string name_str = base::UTF16ToASCII(name.value());
+  std::string name_str = base::WideToASCII(name.value());
 #elif defined(OS_POSIX) || defined(OS_FUCHSIA)
   std::string name_str = name.value();
 #endif
diff --git a/net/disk_cache/cache_util_win.cc b/net/disk_cache/cache_util_win.cc
index f38e608..8b851d4 100644
--- a/net/disk_cache/cache_util_win.cc
+++ b/net/disk_cache/cache_util_win.cc
@@ -16,8 +16,7 @@
 bool MoveCache(const base::FilePath& from_path, const base::FilePath& to_path) {
   // I don't want to use the shell version of move because if something goes
   // wrong, that version will attempt to move file by file and fail at the end.
-  if (!MoveFileEx(base::as_wcstr(from_path.value()),
-                  base::as_wcstr(to_path.value()), 0)) {
+  if (!MoveFileEx(from_path.value().c_str(), to_path.value().c_str(), 0)) {
     PLOG(ERROR) << "Unable to move the cache";
     return false;
   }
@@ -27,16 +26,16 @@
 bool DeleteCacheFile(const base::FilePath& name) {
   // We do a simple delete, without ever falling back to SHFileOperation, as the
   // version from base does.
-  if (!DeleteFile(base::as_wcstr(name.value()))) {
+  if (!DeleteFile(name.value().c_str())) {
     // There is an error, but we share delete access so let's see if there is a
     // file to open. Note that this code assumes that we have a handle to the
     // file at all times (even now), so nobody can have a handle that prevents
     // us from opening the file again (unless it was deleted).
     DWORD sharing = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
     DWORD access = SYNCHRONIZE;
-    base::win::ScopedHandle file(CreateFile(base::as_wcstr(name.value()),
-                                            access, sharing, nullptr,
-                                            OPEN_EXISTING, 0, nullptr));
+    base::win::ScopedHandle file(CreateFile(name.value().c_str(), access,
+                                            sharing, nullptr, OPEN_EXISTING, 0,
+                                            nullptr));
     if (file.IsValid())
       return false;
 
diff --git a/net/disk_cache/simple/simple_util_win.cc b/net/disk_cache/simple/simple_util_win.cc
index 8b6c25ed..4622b2f 100644
--- a/net/disk_cache/simple/simple_util_win.cc
+++ b/net/disk_cache/simple/simple_util_win.cc
@@ -31,8 +31,8 @@
       path.DirName().AppendASCII(base::StringPrintf("todelete_%016" PRIx64,
                                                     base::RandUint64()));
 
-  bool rename_succeeded = !!MoveFile(base::as_wcstr(path.value()),
-                                     base::as_wcstr(rename_target.value()));
+  bool rename_succeeded =
+      !!MoveFile(path.value().c_str(), rename_target.value().c_str());
   if (rename_succeeded)
     return DeleteCacheFile(rename_target);
 
diff --git a/net/dns/dns_config_service_win.cc b/net/dns/dns_config_service_win.cc
index 9cd9d76..37fd844 100644
--- a/net/dns/dns_config_service_win.cc
+++ b/net/dns/dns_config_service_win.cc
@@ -20,6 +20,7 @@
 #include "base/metrics/histogram_macros.h"
 #include "base/sequence_checker.h"
 #include "base/single_thread_task_runner.h"
+#include "base/strings/string_piece.h"
 #include "base/strings/string_split.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
@@ -46,27 +47,27 @@
 const int kRetryIntervalSeconds = 5;
 
 // Registry key paths.
-const base::char16 kTcpipPath[] =
-    STRING16_LITERAL("SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters");
-const base::char16 kTcpip6Path[] =
-    STRING16_LITERAL("SYSTEM\\CurrentControlSet\\Services\\Tcpip6\\Parameters");
-const base::char16 kDnscachePath[] = STRING16_LITERAL(
-    "SYSTEM\\CurrentControlSet\\Services\\Dnscache\\Parameters");
-const base::char16 kPolicyPath[] =
-    STRING16_LITERAL("SOFTWARE\\Policies\\Microsoft\\Windows NT\\DNSClient");
-const base::char16 kPrimaryDnsSuffixPath[] =
-    STRING16_LITERAL("SOFTWARE\\Policies\\Microsoft\\System\\DNSClient");
-const base::char16 kNrptPath[] = STRING16_LITERAL(
-    "SOFTWARE\\Policies\\Microsoft\\Windows NT\\DNSClient\\DnsPolicyConfig");
-const base::char16 kControlSetNrptPath[] = STRING16_LITERAL(
-    "SYSTEM\\CurrentControlSet\\Services\\Dnscache\\Parameters"
-    "\\DnsPolicyConfig");
-const base::char16 kDnsConnectionsPath[] = STRING16_LITERAL(
-    "SYSTEM\\CurrentControlSet\\Services\\Dnscache\\Parameters"
-    "\\DnsConnections");
-const base::char16 kDnsConnectionsProxies[] = STRING16_LITERAL(
-    "SYSTEM\\CurrentControlSet\\Services\\Dnscache\\Parameters"
-    "\\DnsConnectionsProxies");
+const wchar_t kTcpipPath[] =
+    L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters";
+const wchar_t kTcpip6Path[] =
+    L"SYSTEM\\CurrentControlSet\\Services\\Tcpip6\\Parameters";
+const wchar_t kDnscachePath[] =
+    L"SYSTEM\\CurrentControlSet\\Services\\Dnscache\\Parameters";
+const wchar_t kPolicyPath[] =
+    L"SOFTWARE\\Policies\\Microsoft\\Windows NT\\DNSClient";
+const wchar_t kPrimaryDnsSuffixPath[] =
+    L"SOFTWARE\\Policies\\Microsoft\\System\\DNSClient";
+const wchar_t kNrptPath[] =
+    L"SOFTWARE\\Policies\\Microsoft\\Windows NT\\DNSClient\\DnsPolicyConfig";
+const wchar_t kControlSetNrptPath[] =
+    L"SYSTEM\\CurrentControlSet\\Services\\Dnscache\\Parameters\\"
+    L"DnsPolicyConfig";
+const wchar_t kDnsConnectionsPath[] =
+    L"SYSTEM\\CurrentControlSet\\Services\\Dnscache\\Parameters\\"
+    L"DnsConnections";
+const wchar_t kDnsConnectionsProxies[] =
+    L"SYSTEM\\CurrentControlSet\\Services\\Dnscache\\Parameters\\"
+    L"DnsConnectionsProxies";
 
 enum HostsParseWinResult {
   HOSTS_PARSE_WIN_OK = 0,
@@ -80,14 +81,14 @@
 // Convenience for reading values using RegKey.
 class RegistryReader {
  public:
-  explicit RegistryReader(const base::char16* key) {
+  explicit RegistryReader(const wchar_t* key) {
     // Ignoring the result. |key_.Valid()| will catch failures.
     key_.Open(HKEY_LOCAL_MACHINE, key, KEY_QUERY_VALUE);
   }
 
   ~RegistryReader() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); }
 
-  bool ReadString(const base::char16* name,
+  bool ReadString(const wchar_t* name,
                   DnsSystemSettings::RegString* out) const {
     DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
     out->set = false;
@@ -103,8 +104,7 @@
     return (result == ERROR_FILE_NOT_FOUND);
   }
 
-  bool ReadDword(const base::char16* name,
-                 DnsSystemSettings::RegDword* out) const {
+  bool ReadDword(const wchar_t* name, DnsSystemSettings::RegDword* out) const {
     DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
     out->set = false;
     if (!key_.Valid()) {
@@ -150,10 +150,8 @@
 
 bool ReadDevolutionSetting(const RegistryReader& reader,
                            DnsSystemSettings::DevolutionSetting* setting) {
-  return reader.ReadDword(STRING16_LITERAL("UseDomainNameDevolution"),
-                          &setting->enabled) &&
-         reader.ReadDword(STRING16_LITERAL("DomainNameDevolutionLevel"),
-                          &setting->level);
+  return reader.ReadDword(L"UseDomainNameDevolution", &setting->enabled) &&
+         reader.ReadDword(L"DomainNameDevolutionLevel", &setting->level);
 }
 
 // Reads DnsSystemSettings from IpHelper and registry.
@@ -173,17 +171,14 @@
   RegistryReader policy_reader(kPolicyPath);
   RegistryReader primary_dns_suffix_reader(kPrimaryDnsSuffixPath);
 
-  if (!policy_reader.ReadString(STRING16_LITERAL("SearchList"),
-                                &settings->policy_search_list)) {
+  if (!policy_reader.ReadString(L"SearchList", &settings->policy_search_list)) {
     return CONFIG_PARSE_WIN_READ_POLICY_SEARCHLIST;
   }
 
-  if (!tcpip_reader.ReadString(STRING16_LITERAL("SearchList"),
-                               &settings->tcpip_search_list))
+  if (!tcpip_reader.ReadString(L"SearchList", &settings->tcpip_search_list))
     return CONFIG_PARSE_WIN_READ_TCPIP_SEARCHLIST;
 
-  if (!tcpip_reader.ReadString(STRING16_LITERAL("Domain"),
-                               &settings->tcpip_domain))
+  if (!tcpip_reader.ReadString(L"Domain", &settings->tcpip_domain))
     return CONFIG_PARSE_WIN_READ_DOMAIN;
 
   if (!ReadDevolutionSetting(policy_reader, &settings->policy_devolution))
@@ -195,14 +190,13 @@
   if (!ReadDevolutionSetting(tcpip_reader, &settings->tcpip_devolution))
     return CONFIG_PARSE_WIN_READ_TCPIP_DEVOLUTION;
 
-  if (!policy_reader.ReadDword(STRING16_LITERAL("AppendToMultiLabelName"),
+  if (!policy_reader.ReadDword(L"AppendToMultiLabelName",
                                &settings->append_to_multi_label_name)) {
     return CONFIG_PARSE_WIN_READ_APPEND_MULTILABEL;
   }
 
-  if (!primary_dns_suffix_reader.ReadString(
-          STRING16_LITERAL("PrimaryDnsSuffix"),
-          &settings->primary_dns_suffix)) {
+  if (!primary_dns_suffix_reader.ReadString(L"PrimaryDnsSuffix",
+                                            &settings->primary_dns_suffix)) {
     return CONFIG_PARSE_WIN_READ_PRIMARY_SUFFIX;
   }
 
@@ -234,11 +228,10 @@
   hosts->insert(std::make_pair(DnsHostsKey("localhost", ADDRESS_FAMILY_IPV6),
                                loopback_ipv6));
 
-  base::char16 buffer[MAX_PATH];
+  wchar_t buffer[MAX_PATH];
   DWORD size = MAX_PATH;
   std::string localname;
-  if (!GetComputerNameExW(ComputerNameDnsHostname,
-                          base::as_writable_wcstr(buffer), &size) ||
+  if (!GetComputerNameExW(ComputerNameDnsHostname, buffer, &size) ||
       !ParseDomainASCII(buffer, &localname)) {
     return HOSTS_PARSE_WIN_COMPUTER_NAME_FAILED;
   }
@@ -296,7 +289,7 @@
 
   ~RegistryWatcher() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); }
 
-  bool Watch(const base::char16* key, const CallbackType& callback) {
+  bool Watch(const wchar_t* key, const CallbackType& callback) {
     DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
     DCHECK(!callback.is_null());
     DCHECK(callback_.is_null());
@@ -342,8 +335,8 @@
 
 // Returns the path to the HOSTS file.
 base::FilePath GetHostsPath() {
-  base::char16 buffer[MAX_PATH];
-  UINT rc = GetSystemDirectory(base::as_writable_wcstr(buffer), MAX_PATH);
+  wchar_t buffer[MAX_PATH];
+  UINT rc = GetSystemDirectory(buffer, MAX_PATH);
   DCHECK(0 < rc && rc < MAX_PATH);
   return base::FilePath(buffer).Append(
       FILE_PATH_LITERAL("drivers\\etc\\hosts"));
@@ -462,13 +455,13 @@
 DnsSystemSettings::~DnsSystemSettings() {
 }
 
-bool ParseDomainASCII(base::StringPiece16 widestr, std::string* domain) {
+bool ParseDomainASCII(base::WStringPiece widestr, std::string* domain) {
   DCHECK(domain);
   if (widestr.empty())
     return false;
 
   // Check if already ASCII.
-  if (base::IsStringASCII(widestr)) {
+  if (base::IsStringASCII(base::AsStringPiece16(widestr))) {
     domain->assign(widestr.begin(), widestr.end());
     return true;
   }
@@ -476,7 +469,7 @@
   // Otherwise try to convert it from IDN to punycode.
   const int kInitialBufferSize = 256;
   url::RawCanonOutputT<base::char16, kInitialBufferSize> punycode;
-  if (!url::IDNToASCII(widestr.data(), widestr.length(), &punycode))
+  if (!url::IDNToASCII(base::as_u16cstr(widestr), widestr.length(), &punycode))
     return false;
 
   // |punycode_output| should now be ASCII; convert it to a std::string.
@@ -488,7 +481,7 @@
   return success && !domain->empty();
 }
 
-bool ParseSearchList(const base::string16& value,
+bool ParseSearchList(const std::wstring& value,
                      std::vector<std::string>* output) {
   DCHECK(output);
   if (value.empty())
@@ -500,9 +493,8 @@
   // Although nslookup and network connection property tab ignore such
   // fragments ("a,b,,c" becomes ["a", "b", "c"]), our reference is getaddrinfo
   // (which sees ["a", "b"]). WMI queries also return a matching search list.
-  for (const base::StringPiece16& t :
-       base::SplitStringPiece(value, STRING16_LITERAL(","),
-                              base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
+  for (base::WStringPiece t : base::SplitStringPiece(
+           value, L",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
     // Convert non-ASCII to punycode, although getaddrinfo does not properly
     // handle such suffixes.
     std::string parsed;
@@ -561,7 +553,7 @@
     // obtained via DHCP (regkey: Tcpip\Parameters\Interfaces\{XXX}\DhcpDomain)
     // or specified by the user (regkey: Tcpip\Parameters\Domain).
     std::string dns_suffix;
-    if (ParseDomainASCII(base::as_u16cstr(adapter->DnsSuffix), &dns_suffix))
+    if (ParseDomainASCII(adapter->DnsSuffix, &dns_suffix))
       config->search.push_back(dns_suffix);
   }
 
diff --git a/net/dns/dns_config_service_win.h b/net/dns/dns_config_service_win.h
index 8b64504a..6c7e3df 100644
--- a/net/dns/dns_config_service_win.h
+++ b/net/dns/dns_config_service_win.h
@@ -19,6 +19,7 @@
 #include "base/memory/free_deleter.h"
 #include "base/memory/ref_counted.h"
 #include "base/strings/string16.h"
+#include "base/strings/string_piece_forward.h"
 #include "net/base/net_export.h"
 #include "net/dns/dns_config_service.h"
 
@@ -40,14 +41,14 @@
 // Converts a UTF-16 domain name to ASCII, possibly using punycode.
 // Returns true if the conversion succeeds and output is not empty. In case of
 // failure, |domain| might become dirty.
-bool NET_EXPORT_PRIVATE ParseDomainASCII(base::StringPiece16 widestr,
+bool NET_EXPORT_PRIVATE ParseDomainASCII(base::WStringPiece widestr,
                                          std::string* domain);
 
 // Parses |value| as search list (comma-delimited list of domain names) from
 // a registry key and stores it in |out|. Returns true on success. Empty
 // entries (e.g., "chromium.org,,org") terminate the list. Non-ascii hostnames
 // are converted to punycode.
-bool NET_EXPORT_PRIVATE ParseSearchList(const base::string16& value,
+bool NET_EXPORT_PRIVATE ParseSearchList(const std::wstring& value,
                                         std::vector<std::string>* out);
 
 // All relevant settings read from registry and IP Helper. This isolates our
@@ -57,7 +58,7 @@
   // The |set| flag distinguishes between empty and unset values.
   struct RegString {
     bool set;
-    base::string16 value;
+    std::wstring value;
   };
 
   struct RegDword {
diff --git a/net/dns/dns_config_service_win_unittest.cc b/net/dns/dns_config_service_win_unittest.cc
index cd34aa1..070df338 100644
--- a/net/dns/dns_config_service_win_unittest.cc
+++ b/net/dns/dns_config_service_win_unittest.cc
@@ -17,19 +17,19 @@
 
 TEST(DnsConfigServiceWinTest, ParseSearchList) {
   const struct TestCase {
-    const base::char16* input;
+    const wchar_t* input;
     const char* output[4];  // NULL-terminated, empty if expected false
   } cases[] = {
-      {STRING16_LITERAL("chromium.org"), {"chromium.org", nullptr}},
-      {STRING16_LITERAL("chromium.org,org"), {"chromium.org", "org", nullptr}},
+      {L"chromium.org", {"chromium.org", nullptr}},
+      {L"chromium.org,org", {"chromium.org", "org", nullptr}},
       // Empty suffixes terminate the list
-      {STRING16_LITERAL("crbug.com,com,,org"), {"crbug.com", "com", nullptr}},
+      {L"crbug.com,com,,org", {"crbug.com", "com", nullptr}},
       // IDN are converted to punycode
-      {STRING16_LITERAL("\u017c\xf3\u0142ta.pi\u0119\u015b\u0107.pl,pl"),
+      {L"\u017c\xf3\u0142ta.pi\u0119\u015b\u0107.pl,pl",
        {"xn--ta-4ja03asj.xn--pi-wla5e0q.pl", "pl", nullptr}},
       // Empty search list is invalid
-      {STRING16_LITERAL(""), {nullptr}},
-      {STRING16_LITERAL(",,"), {nullptr}},
+      {L"", {nullptr}},
+      {L",,", {nullptr}},
   };
 
   for (const auto& t : cases) {
@@ -219,11 +219,10 @@
       {
           // Policy SearchList override.
           {
-              {true,
-               STRING16_LITERAL("policy.searchlist.a,policy.searchlist.b")},
-              {true, STRING16_LITERAL("tcpip.searchlist.a,tcpip.searchlist.b")},
-              {true, STRING16_LITERAL("tcpip.domain")},
-              {true, STRING16_LITERAL("primary.dns.suffix")},
+              {true, L"policy.searchlist.a,policy.searchlist.b"},
+              {true, L"tcpip.searchlist.a,tcpip.searchlist.b"},
+              {true, L"tcpip.domain"},
+              {true, L"primary.dns.suffix"},
           },
           {"policy.searchlist.a", "policy.searchlist.b"},
       },
@@ -231,18 +230,18 @@
           // User-specified SearchList override.
           {
               {false},
-              {true, STRING16_LITERAL("tcpip.searchlist.a,tcpip.searchlist.b")},
-              {true, STRING16_LITERAL("tcpip.domain")},
-              {true, STRING16_LITERAL("primary.dns.suffix")},
+              {true, L"tcpip.searchlist.a,tcpip.searchlist.b"},
+              {true, L"tcpip.domain"},
+              {true, L"primary.dns.suffix"},
           },
           {"tcpip.searchlist.a", "tcpip.searchlist.b"},
       },
       {
           // Void SearchList. Using tcpip.domain
           {
-              {true, STRING16_LITERAL(",bad.searchlist,parsed.as.empty")},
-              {true, STRING16_LITERAL("tcpip.searchlist,good.but.overridden")},
-              {true, STRING16_LITERAL("tcpip.domain")},
+              {true, L",bad.searchlist,parsed.as.empty"},
+              {true, L"tcpip.searchlist,good.but.overridden"},
+              {true, L"tcpip.domain"},
               {false},
           },
           {"tcpip.domain", "connection.suffix"},
@@ -250,10 +249,10 @@
       {
           // Void SearchList. Using primary.dns.suffix
           {
-              {true, STRING16_LITERAL(",bad.searchlist,parsed.as.empty")},
-              {true, STRING16_LITERAL("tcpip.searchlist,good.but.overridden")},
-              {true, STRING16_LITERAL("tcpip.domain")},
-              {true, STRING16_LITERAL("primary.dns.suffix")},
+              {true, L",bad.searchlist,parsed.as.empty"},
+              {true, L"tcpip.searchlist,good.but.overridden"},
+              {true, L"tcpip.domain"},
+              {true, L"primary.dns.suffix"},
           },
           {"primary.dns.suffix", "connection.suffix"},
       },
@@ -261,19 +260,19 @@
           // Void SearchList. Using tcpip.domain when primary.dns.suffix is
           // empty
           {
-              {true, STRING16_LITERAL(",bad.searchlist,parsed.as.empty")},
-              {true, STRING16_LITERAL("tcpip.searchlist,good.but.overridden")},
-              {true, STRING16_LITERAL("tcpip.domain")},
-              {true, STRING16_LITERAL("")},
+              {true, L",bad.searchlist,parsed.as.empty"},
+              {true, L"tcpip.searchlist,good.but.overridden"},
+              {true, L"tcpip.domain"},
+              {true, L""},
           },
           {"tcpip.domain", "connection.suffix"},
       },
       {
           // Void SearchList. Using tcpip.domain when primary.dns.suffix is NULL
           {
-              {true, STRING16_LITERAL(",bad.searchlist,parsed.as.empty")},
-              {true, STRING16_LITERAL("tcpip.searchlist,good.but.overridden")},
-              {true, STRING16_LITERAL("tcpip.domain")},
+              {true, L",bad.searchlist,parsed.as.empty"},
+              {true, L"tcpip.searchlist,good.but.overridden"},
+              {true, L"tcpip.domain"},
               {true},
           },
           {"tcpip.domain", "connection.suffix"},
@@ -294,7 +293,7 @@
           {
               {false},
               {false},
-              {true, STRING16_LITERAL("a.b.c.d.e")},
+              {true, L"a.b.c.d.e"},
               {false},
               {{true, 1}, {false}},    // policy_devolution: enabled, level
               {{true, 0}, {true, 3}},  // dnscache_devolution
@@ -307,8 +306,8 @@
           {
               {false},
               {false},
-              {true, STRING16_LITERAL("a.b.c.d.e")},
-              {true, STRING16_LITERAL("f.g.i.l.j")},
+              {true, L"a.b.c.d.e"},
+              {true, L"f.g.i.l.j"},
               {{false}, {true, 4}},
               {{true, 1}, {false}},
               {{true, 0}, {true, 3}},
@@ -320,7 +319,7 @@
           {
               {false},
               {false},
-              {true, STRING16_LITERAL("a.b.c.d.e")},
+              {true, L"a.b.c.d.e"},
               {false},
               {{false}, {false}},
               {{false}, {true, 3}},
@@ -333,7 +332,7 @@
           {
               {false},
               {false},
-              {true, STRING16_LITERAL("a.b")},
+              {true, L"a.b"},
               {false},
               {{false}, {false}},
               {{false}, {true, 2}},
@@ -346,7 +345,7 @@
           {
               {false},
               {false},
-              {true, STRING16_LITERAL("a.b.c.d.e")},
+              {true, L"a.b.c.d.e"},
               {false},
               {{true, 1}, {false}},
               {{true, 1}, {false}},
@@ -359,7 +358,7 @@
           {
               {false},
               {false},
-              {true, STRING16_LITERAL("a.b.c.d.e")},
+              {true, L"a.b.c.d.e"},
               {false},
               {{false}, {true, 1}},
               {{true, 1}, {true, 3}},
@@ -372,7 +371,7 @@
           {
               {false},
               {false},
-              {true, STRING16_LITERAL("a.b.c.d.e")},
+              {true, L"a.b.c.d.e"},
               {false},
               {{false}, {true, 3}},
               {{false}, {true, 3}},
diff --git a/net/proxy_resolution/win/proxy_config_service_win.cc b/net/proxy_resolution/win/proxy_config_service_win.cc
index 04dd08d..5c7b72a 100644
--- a/net/proxy_resolution/win/proxy_config_service_win.cc
+++ b/net/proxy_resolution/win/proxy_config_service_win.cc
@@ -95,21 +95,19 @@
 
   AddKeyToWatchList(
       HKEY_CURRENT_USER,
-      STRING16_LITERAL("Software\\Microsoft\\Windows\\CurrentVersion\\")
-          STRING16_LITERAL("Internet Settings"));
+      L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings");
 
   AddKeyToWatchList(
       HKEY_LOCAL_MACHINE,
-      STRING16_LITERAL("Software\\Microsoft\\Windows\\CurrentVersion\\")
-          STRING16_LITERAL("Internet Settings"));
+      L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings");
 
   AddKeyToWatchList(HKEY_LOCAL_MACHINE,
-                    STRING16_LITERAL("SOFTWARE\\Policies\\Microsoft\\Windows\\")
-                        STRING16_LITERAL("CurrentVersion\\Internet Settings"));
+                    L"SOFTWARE\\Policies\\Microsoft\\Windows\\CurrentVersion\\"
+                    L"Internet Settings");
 }
 
 bool ProxyConfigServiceWin::AddKeyToWatchList(HKEY rootkey,
-                                              const base::char16* subkey) {
+                                              const wchar_t* subkey) {
   std::unique_ptr<base::win::RegKey> key =
       std::make_unique<base::win::RegKey>();
   if (key->Create(rootkey, subkey, KEY_NOTIFY) != ERROR_SUCCESS)
diff --git a/net/proxy_resolution/win/proxy_config_service_win.h b/net/proxy_resolution/win/proxy_config_service_win.h
index 937c2028..de54457 100644
--- a/net/proxy_resolution/win/proxy_config_service_win.h
+++ b/net/proxy_resolution/win/proxy_config_service_win.h
@@ -70,7 +70,7 @@
 
   // Creates a new key and appends it to |keys_to_watch_|. If the key fails to
   // be created, it is not appended to the list and we return false.
-  bool AddKeyToWatchList(HKEY rootkey, const base::char16* subkey);
+  bool AddKeyToWatchList(HKEY rootkey, const wchar_t* subkey);
 
   // This is called whenever one of the registry keys we are watching change.
   void OnObjectSignaled(base::win::RegKey* key);
diff --git a/net/quic/platform/impl/quic_default_proof_providers_impl.cc b/net/quic/platform/impl/quic_default_proof_providers_impl.cc
index 66817850..abae462 100644
--- a/net/quic/platform/impl/quic_default_proof_providers_impl.cc
+++ b/net/quic/platform/impl/quic_default_proof_providers_impl.cc
@@ -93,8 +93,8 @@
       std::make_unique<SimpleTicketCrypter>(QuicChromiumClock::GetInstance()));
   CHECK(proof_source->Initialize(
 #if defined(OS_WIN)
-      base::FilePath(base::UTF8ToUTF16(GetQuicFlag(FLAGS_certificate_file))),
-      base::FilePath(base::UTF8ToUTF16(GetQuicFlag(FLAGS_key_file))),
+      base::FilePath(base::UTF8ToWide(GetQuicFlag(FLAGS_certificate_file))),
+      base::FilePath(base::UTF8ToWide(GetQuicFlag(FLAGS_key_file))),
       base::FilePath()));
 #else
       base::FilePath(GetQuicFlag(FLAGS_certificate_file)),
diff --git a/net/quic/platform/impl/quic_flags_impl.cc b/net/quic/platform/impl/quic_flags_impl.cc
index ab50b42..f2c1542 100644
--- a/net/quic/platform/impl/quic_flags_impl.cc
+++ b/net/quic/platform/impl/quic_flags_impl.cc
@@ -18,6 +18,7 @@
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
+#include "build/build_config.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
 
 #define QUIC_FLAG(type, flag, value) type flag = value;
@@ -34,19 +35,21 @@
   return v;
 }
 
-// Overload for platforms where base::CommandLine::StringType == base::string16.
+#if defined(WCHAR_T_IS_UTF16)
+// Overload for platforms where base::CommandLine::StringType == std::wstring.
 std::vector<std::string> __attribute__((unused))
-ToQuicStringVector(const std::vector<base::string16>& v) {
+ToQuicStringVector(const std::vector<std::wstring>& v) {
   std::vector<std::string> qsv;
   for (const auto& s : v) {
     if (!base::IsStringASCII(s)) {
       QUIC_LOG(ERROR) << "Unable to convert to ASCII: " << s;
       continue;
     }
-    qsv.push_back(base::UTF16ToASCII(s));
+    qsv.push_back(base::WideToASCII(s));
   }
   return qsv;
 }
+#endif  // defined(WCHAR_T_IS_UTF16)
 
 size_t FindLineWrapPosition(const std::string& s, size_t desired_len) {
   if (s.length() <= desired_len) {
diff --git a/net/test/embedded_test_server/request_handler_util.cc b/net/test/embedded_test_server/request_handler_util.cc
index 2e20ab5..f779b33 100644
--- a/net/test/embedded_test_server/request_handler_util.cc
+++ b/net/test/embedded_test_server/request_handler_util.cc
@@ -11,6 +11,7 @@
 #include <utility>
 
 #include "base/base64.h"
+#include "base/files/file_path.h"
 #include "base/files/file_util.h"
 #include "base/format_macros.h"
 #include "base/strings/string_util.h"
@@ -27,7 +28,8 @@
 
 namespace net {
 namespace test_server {
-const char kMockHttpHeadersExtension[] = "mock-http-headers";
+constexpr base::FilePath::CharType kMockHttpHeadersExtension[] =
+    FILE_PATH_LITERAL("mock-http-headers");
 
 std::string GetContentType(const base::FilePath& path) {
   if (path.MatchesExtension(FILE_PATH_LITERAL(".crx")))
@@ -209,15 +211,8 @@
   if (!UpdateReplacedText(query, &file_contents))
     return failed_response;
 
-  base::FilePath::StringPieceType mock_headers_extension;
-#if defined(OS_WIN)
-  base::string16 temp = base::ASCIIToUTF16(kMockHttpHeadersExtension);
-  mock_headers_extension = temp;
-#else
-  mock_headers_extension = kMockHttpHeadersExtension;
-#endif
-
-  base::FilePath headers_path(file_path.AddExtension(mock_headers_extension));
+  base::FilePath headers_path(
+      file_path.AddExtension(kMockHttpHeadersExtension));
 
   if (base::PathExists(headers_path)) {
     std::string headers_contents;
diff --git a/net/test/embedded_test_server/request_handler_util.h b/net/test/embedded_test_server/request_handler_util.h
index 8e8370f..f81ac3b 100644
--- a/net/test/embedded_test_server/request_handler_util.h
+++ b/net/test/embedded_test_server/request_handler_util.h
@@ -30,7 +30,7 @@
 //   foo.html.mock-http-headers
 // When the test server serves foo.html, if it finds foo.html.mock-http-headers
 // it will use the contents of that file for the headers.
-extern const char kMockHttpHeadersExtension[];
+extern const base::FilePath::CharType kMockHttpHeadersExtension[];
 
 // Returns the Content-Type header value for a path based on its extension.
 std::string GetContentType(const base::FilePath& path);
diff --git a/net/test/spawned_test_server/base_test_server.cc b/net/test/spawned_test_server/base_test_server.cc
index 8330ccda5..9bda291 100644
--- a/net/test/spawned_test_server/base_test_server.cc
+++ b/net/test/spawned_test_server/base_test_server.cc
@@ -15,6 +15,7 @@
 #include "base/json/json_reader.h"
 #include "base/logging.h"
 #include "base/path_service.h"
+#include "base/strings/string_util.h"
 #include "base/values.h"
 #include "net/base/address_list.h"
 #include "net/base/host_port_pair.h"
@@ -419,7 +420,8 @@
 
   arguments->SetString("host", host_port_pair_.host());
   arguments->SetInteger("port", host_port_pair_.port());
-  arguments->SetString("data-dir", document_root_.value());
+  arguments->SetStringKey("data-dir",
+                          base::AsCrossPlatformPiece(document_root_.value()));
 
   if (VLOG_IS_ON(1) || log_to_console_)
     arguments->Set("log-to-console", std::make_unique<base::Value>());
@@ -452,7 +454,9 @@
                    << " doesn't exist. Can't launch https server.";
         return false;
       }
-      arguments->SetString("cert-and-key-file", certificate_path.value());
+      arguments->SetStringKey(
+          "cert-and-key-file",
+          base::AsCrossPlatformPiece(certificate_path.value()));
     }
 
     // Check the client certificate related arguments.
@@ -468,7 +472,7 @@
                    << " doesn't exist. Can't launch https server.";
         return false;
       }
-      ssl_client_certs->AppendString(it->value());
+      ssl_client_certs->Append(base::AsCrossPlatformPiece(it->value()));
     }
 
     if (ssl_client_certs->GetSize())
diff --git a/sandbox/win/src/sandbox_policy_diagnostic.cc b/sandbox/win/src/sandbox_policy_diagnostic.cc
index d0c6c67..ddaccf7 100644
--- a/sandbox/win/src/sandbox_policy_diagnostic.cc
+++ b/sandbox/win/src/sandbox_policy_diagnostic.cc
@@ -15,7 +15,9 @@
 #include "base/check.h"
 #include "base/json/json_string_value_serializer.h"
 #include "base/numerics/safe_conversions.h"
+#include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
+#include "base/strings/utf_string_conversions.h"
 #include "base/values.h"
 #include "sandbox/win/src/ipc_tags.h"
 #include "sandbox/win/src/policy_engine_opcodes.h"
@@ -98,8 +100,8 @@
   }
 }
 
-base::string16 GetSidAsString(const Sid* sid) {
-  base::string16 result;
+std::wstring GetSidAsString(const Sid* sid) {
+  std::wstring result;
   if (!sid->ToSddlString(&result))
     DCHECK(false) << "Failed to make sddl string";
   return result;
@@ -432,11 +434,14 @@
                base::Value(GetPlatformMitigationsAsHex(desired_mitigations_)));
 
   if (app_container_sid_)
-    value.SetKey(kAppContainerSid,
-                 base::Value(GetSidAsString(app_container_sid_.get())));
+    value.SetStringKey(
+        kAppContainerSid,
+        base::AsStringPiece16(GetSidAsString(app_container_sid_.get())));
 
-  if (lowbox_sid_)
-    value.SetKey(kLowboxSid, base::Value(GetSidAsString(lowbox_sid_.get())));
+  if (lowbox_sid_) {
+    value.SetStringKey(
+        kLowboxSid, base::AsStringPiece16(GetSidAsString(lowbox_sid_.get())));
+  }
 
   if (policy_rules_)
     value.SetKey(kPolicyRules, GetPolicyRules(policy_rules_.get()));
diff --git a/sql/database.cc b/sql/database.cc
index 64c7e9ce..05831c9 100644
--- a/sql/database.cc
+++ b/sql/database.cc
@@ -148,7 +148,7 @@
 
 std::string AsUTF8ForSQL(const base::FilePath& path) {
 #if defined(OS_WIN)
-  return base::UTF16ToUTF8(path.value());
+  return base::WideToUTF8(path.value());
 #elif defined(OS_POSIX) || defined(OS_FUCHSIA)
   return path.value();
 #endif
@@ -459,7 +459,7 @@
   const char* path = sqlite3_db_filename(db_, "main");
   const base::StringPiece db_path(path);
 #if defined(OS_WIN)
-  return base::FilePath(base::UTF8ToUTF16(db_path));
+  return base::FilePath(base::UTF8ToWide(db_path));
 #elif defined(OS_POSIX) || defined(OS_FUCHSIA)
   return base::FilePath(db_path);
 #else
@@ -1117,7 +1117,7 @@
 
   Statement s(GetUniqueStatement("ATTACH DATABASE ? AS ?"));
 #if OS_WIN
-  s.BindString16(0, other_db_path.value());
+  s.BindString16(0, base::AsStringPiece16(other_db_path.value()));
 #elif defined(OS_POSIX) || defined(OS_FUCHSIA)
   s.BindString(0, other_db_path.value());
 #else
diff --git a/sql/statement.cc b/sql/statement.cc
index b49e47b..aba466d 100644
--- a/sql/statement.cc
+++ b/sql/statement.cc
@@ -9,6 +9,7 @@
 
 #include "base/logging.h"
 #include "base/numerics/safe_conversions.h"
+#include "base/strings/string_piece_forward.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "third_party/sqlite/sqlite3.h"
@@ -145,7 +146,7 @@
                                    SQLITE_TRANSIENT));
 }
 
-bool Statement::BindString16(int col, const base::string16& value) {
+bool Statement::BindString16(int col, base::StringPiece16 value) {
   return BindString(col, base::UTF16ToUTF8(value));
 }
 
diff --git a/sql/statement.h b/sql/statement.h
index 6983e21..ba31163 100644
--- a/sql/statement.h
+++ b/sql/statement.h
@@ -14,6 +14,7 @@
 #include "base/memory/ref_counted.h"
 #include "base/sequence_checker.h"
 #include "base/strings/string16.h"
+#include "base/strings/string_piece_forward.h"
 #include "sql/database.h"
 
 namespace sql {
@@ -111,7 +112,7 @@
   bool BindDouble(int col, double val);
   bool BindCString(int col, const char* val);
   bool BindString(int col, const std::string& val);
-  bool BindString16(int col, const base::string16& value);
+  bool BindString16(int col, base::StringPiece16 value);
   bool BindBlob(int col, const void* value, int value_len);
 
   // Retrieving ----------------------------------------------------------------