refactor: replace base::StringPrintf() calls with absl::StrFormat() (#44552)

refactor: replace base::StringPrintf() calls with absl::StFormat()

The former is now a pass-through for the latter and is slated for removal

Xref: https://issues.chromium.org/issues/40241565

4907781

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2024-11-04 13:12:50 -08:00 committed by GitHub
parent 460fc9b452
commit c0b914f6a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 59 additions and 61 deletions

View file

@ -6,12 +6,12 @@
#include "base/i18n/rtl.h"
#include "base/no_destructor.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/browser_process.h"
#include "chrome/common/chrome_version.h"
#include "content/public/common/user_agent.h"
#include "electron/electron_version.h"
#include "shell/browser/browser.h"
#include "third_party/abseil-cpp/absl/strings/str_format.h"
namespace electron {
@ -42,7 +42,7 @@ std::string GetApplicationUserAgent() {
user_agent = "Chrome/" CHROME_VERSION_STRING " " ELECTRON_PRODUCT_NAME
"/" ELECTRON_VERSION_STRING;
} else {
user_agent = base::StringPrintf(
user_agent = absl::StrFormat(
"%s/%s Chrome/%s " ELECTRON_PRODUCT_NAME "/" ELECTRON_VERSION_STRING,
name.c_str(), browser->GetVersion().c_str(), CHROME_VERSION_STRING);
}

View file

@ -7,8 +7,8 @@
#include <algorithm>
#include <cmath>
#include "base/strings/stringprintf.h"
#include "content/public/common/color_parser.h"
#include "third_party/abseil-cpp/absl/strings/str_format.h"
namespace {
@ -48,12 +48,12 @@ SkColor ParseCSSColor(const std::string& color_string) {
}
std::string ToRGBHex(SkColor color) {
return base::StringPrintf("#%02X%02X%02X", SkColorGetR(color),
SkColorGetG(color), SkColorGetB(color));
return absl::StrFormat("#%02X%02X%02X", SkColorGetR(color),
SkColorGetG(color), SkColorGetB(color));
}
std::string ToRGBAHex(SkColor color, bool include_hash) {
std::string color_str = base::StringPrintf(
std::string color_str = absl::StrFormat(
"%02X%02X%02X%02X", SkColorGetR(color), SkColorGetG(color),
SkColorGetB(color), SkColorGetA(color));
if (include_hash) {

View file

@ -22,9 +22,9 @@ struct Converter<device::mojom::SerialPortInfoPtr> {
if (port->display_name && !port->display_name->empty())
dict.Set("displayName", *port->display_name);
if (port->has_vendor_id)
dict.Set("vendorId", base::StringPrintf("%u", port->vendor_id));
dict.Set("vendorId", absl::StrFormat("%u", port->vendor_id));
if (port->has_product_id)
dict.Set("productId", base::StringPrintf("%u", port->product_id));
dict.Set("productId", absl::StrFormat("%u", port->product_id));
if (port->serial_number && !port->serial_number->empty())
dict.Set("serialNumber", *port->serial_number);
#if BUILDFLAG(IS_MAC)