refactor: replace base::StringPrintf() calls with absl::StrFormat() (#44515)
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
This commit is contained in:
parent
c63d0d61e7
commit
726d439399
15 changed files with 59 additions and 61 deletions
|
@ -16,7 +16,6 @@
|
|||
#include "base/metrics/histogram.h"
|
||||
#include "base/strings/pattern.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/timer/timer.h"
|
||||
#include "base/uuid.h"
|
||||
|
@ -52,6 +51,7 @@
|
|||
#include "shell/browser/ui/inspectable_web_contents_view_delegate.h"
|
||||
#include "shell/common/application_info.h"
|
||||
#include "shell/common/platform_util.h"
|
||||
#include "third_party/abseil-cpp/absl/strings/str_format.h"
|
||||
#include "third_party/blink/public/common/logging/logging_utils.h"
|
||||
#include "third_party/blink/public/common/page/page_zoom.h"
|
||||
#include "ui/display/display.h"
|
||||
|
@ -137,16 +137,15 @@ double GetNextZoomLevel(double level, bool out) {
|
|||
}
|
||||
|
||||
GURL GetRemoteBaseURL() {
|
||||
return GURL(base::StringPrintf("%s%s/%s/",
|
||||
kChromeUIDevToolsRemoteFrontendBase,
|
||||
kChromeUIDevToolsRemoteFrontendPath,
|
||||
content::GetChromiumGitRevision().c_str()));
|
||||
return GURL(absl::StrFormat("%s%s/%s/", kChromeUIDevToolsRemoteFrontendBase,
|
||||
kChromeUIDevToolsRemoteFrontendPath,
|
||||
content::GetChromiumGitRevision().c_str()));
|
||||
}
|
||||
|
||||
GURL GetDevToolsURL(bool can_dock) {
|
||||
auto url_string = base::StringPrintf(kChromeUIDevToolsURL,
|
||||
GetRemoteBaseURL().spec().c_str(),
|
||||
can_dock ? "true" : "");
|
||||
auto url_string =
|
||||
absl::StrFormat(kChromeUIDevToolsURL, GetRemoteBaseURL().spec().c_str(),
|
||||
can_dock ? "true" : "");
|
||||
return GURL(url_string);
|
||||
}
|
||||
|
||||
|
@ -632,7 +631,7 @@ void InspectableWebContents::InspectedURLChanged(const std::string& url) {
|
|||
if (managed_devtools_web_contents_) {
|
||||
if (devtools_title_.empty()) {
|
||||
view_->SetTitle(
|
||||
base::UTF8ToUTF16(base::StringPrintf(kTitleFormat, url.c_str())));
|
||||
base::UTF8ToUTF16(absl::StrFormat(kTitleFormat, url.c_str())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1032,7 +1031,7 @@ void InspectableWebContents::DidFinishNavigation(
|
|||
// most likely bug in chromium.
|
||||
base::ReplaceFirstSubstringAfterOffset(&it->second, 0, "var chrome",
|
||||
"var chrome = window.chrome ");
|
||||
auto script = base::StringPrintf(
|
||||
auto script = absl::StrFormat(
|
||||
"%s(\"%s\")", it->second.c_str(),
|
||||
base::Uuid::GenerateRandomV4().AsLowercaseString().c_str());
|
||||
// Invoking content::DevToolsFrontendHost::SetupExtensionsAPI(frame, script);
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
#include <glib-object.h>
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "shell/browser/native_window_views.h"
|
||||
#include "shell/browser/ui/electron_menu_model.h"
|
||||
#include "shell/browser/ui/views/global_menu_bar_registrar_x11.h"
|
||||
#include "third_party/abseil-cpp/absl/strings/str_format.h"
|
||||
#include "ui/aura/window.h"
|
||||
#include "ui/aura/window_tree_host.h"
|
||||
#include "ui/base/accelerators/menu_label_accelerator_util_linux.h"
|
||||
|
@ -166,7 +166,7 @@ std::string GetMenuModelStatus(ElectronMenuModel* model) {
|
|||
int status = model->GetTypeAt(i) | (model->IsVisibleAt(i) << 3) |
|
||||
(model->IsEnabledAt(i) << 4) |
|
||||
(model->IsItemCheckedAt(i) << 5);
|
||||
ret += base::StringPrintf(
|
||||
ret += absl::StrFormat(
|
||||
"%s-%X\n", base::UTF16ToUTF8(model->GetLabelAt(i)).c_str(), status);
|
||||
}
|
||||
return ret;
|
||||
|
@ -194,8 +194,7 @@ GlobalMenuBarX11::~GlobalMenuBarX11() {
|
|||
|
||||
// static
|
||||
std::string GlobalMenuBarX11::GetPathForWindow(x11::Window window) {
|
||||
return base::StringPrintf("/com/canonical/menu/%X",
|
||||
static_cast<uint>(window));
|
||||
return absl::StrFormat("/com/canonical/menu/%X", static_cast<uint>(window));
|
||||
}
|
||||
|
||||
void GlobalMenuBarX11::SetMenu(ElectronMenuModel* menu_model) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue