From b751afaf3dc7fd15ec344148777eb9048f35a7b0 Mon Sep 17 00:00:00 2001 From: Claudio DeSouza Date: Sun, 5 Oct 2025 23:40:45 +0100 Subject: [PATCH] [cr143] `Extension::Create` taking a `u16string` arg This used to be a `std::string`. Chromium changes: https://chromium.googlesource.com/chromium/src/+/79167e224d3cd322af1031bb0124212580e7cde8 commit 79167e224d3cd322af1031bb0124212580e7cde8 Author: Jaewon Jung Date: Thu Oct 2 19:04:02 2025 -0700 Use std::u16string for Extension::Create() error parameter The `Extension::Create()` method and its callers used `std::string` for the error output parameter, leading to unnecessary conversions between UTF-8 and UTF-16. This change migrates the error parameter to `std::u16string` across the call stack. This eliminates string conversions, simplifying the code and improving consistency. In a few places where a `std::string` is still required, a temporary conversion is performed. Signed-off-by: Jaewon Jung Bug: 41317803 Change-Id: Ia660ca60834f233eca82e8f2b65961cce48230d6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6975452 Reviewed-by: Devlin Cronin Reviewed-by: Hidehiko Abe Cr-Commit-Position: refs/heads/main@{#1524554} --- browser/brave_wallet/external_wallets_importer.cc | 2 +- browser/extensions/mv2_warning_unittest.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/browser/brave_wallet/external_wallets_importer.cc b/browser/brave_wallet/external_wallets_importer.cc index 85187e09e1b..25ff164c272 100644 --- a/browser/brave_wallet/external_wallets_importer.cc +++ b/browser/brave_wallet/external_wallets_importer.cc @@ -226,7 +226,7 @@ void ExternalWalletsImporter::GetLocalStorage( const extensions::Extension& extension, InitCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - std::string error; + std::u16string error; extension_ = Extension::Create( extension.path(), ManifestLocation::kExternalPref, *extension.manifest()->value(), extension.creation_flags(), &error); diff --git a/browser/extensions/mv2_warning_unittest.cc b/browser/extensions/mv2_warning_unittest.cc index 595046fb4bb..8e90abe133f 100644 --- a/browser/extensions/mv2_warning_unittest.cc +++ b/browser/extensions/mv2_warning_unittest.cc @@ -32,7 +32,7 @@ TEST(Mv2WarningTest, ExtensionManifestVersions) { return dict; }; - std::string error; + std::u16string error; scoped_refptr extension = extensions::Extension::Create( base::FilePath(), extensions::mojom::ManifestLocation::kUnpacked,