Stringify bools consistently
This changes instances of `b ? "true" : "false"` to use `base::ToString(b)` instead, for consistency. This change applies to the following directories: ui This CL was uploaded by git cl split. Bug: 335797528 Change-Id: I43addf03cccb2892815d923230042bce33cf848c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6327587 Reviewed-by: Keren Zhu <kerenzhu@chromium.org> Reviewed-by: Xiyuan Xia <xiyuan@chromium.org> Auto-Submit: Devon Loehr <dloehr@google.com> Commit-Queue: Devon Loehr <dloehr@google.com> Cr-Commit-Position: refs/heads/main@{#1428453}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
5366bb722e
commit
7f0fff599c
ui
@ -16,6 +16,7 @@
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/to_string.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "ui/accessibility/ax_enum_util.h"
|
||||
#include "ui/accessibility/ax_enums.mojom-shared.h"
|
||||
@ -1737,7 +1738,7 @@ std::string AXNodeData::ToString(bool verbose) const {
|
||||
|
||||
for (const std::pair<ax::mojom::BoolAttribute, bool>& bool_attribute :
|
||||
bool_attributes) {
|
||||
std::string value = bool_attribute.second ? "true" : "false";
|
||||
std::string value = base::ToString(bool_attribute.second);
|
||||
switch (bool_attribute.first) {
|
||||
case ax::mojom::BoolAttribute::kNonAtomicTextFieldRoot:
|
||||
result += " non_atomic_text_field_root=" + value;
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/scoped_observation.h"
|
||||
#include "base/strings/to_string.h"
|
||||
#include "base/test/metrics/histogram_tester.h"
|
||||
#include "testing/gmock/include/gmock/gmock-matchers.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
@ -201,7 +202,7 @@ class TestAXTreeObserver final : public AXTreeObserver {
|
||||
bool is_ignored_new_value) override {
|
||||
attribute_change_log_.push_back(
|
||||
base::StringPrintf("IsIgnored changed on node ID %d to %s", node->id(),
|
||||
is_ignored_new_value ? "true" : "false"));
|
||||
base::ToString(is_ignored_new_value)));
|
||||
}
|
||||
|
||||
void OnStateChanged(AXTree* tree,
|
||||
@ -209,7 +210,7 @@ class TestAXTreeObserver final : public AXTreeObserver {
|
||||
ax::mojom::State state,
|
||||
bool new_value) override {
|
||||
attribute_change_log_.push_back(base::StringPrintf(
|
||||
"%s changed to %s", ToString(state), new_value ? "true" : "false"));
|
||||
"%s changed to %s", ToString(state), base::ToString(new_value)));
|
||||
}
|
||||
|
||||
void OnStringAttributeChanged(AXTree* tree,
|
||||
@ -247,7 +248,7 @@ class TestAXTreeObserver final : public AXTreeObserver {
|
||||
ax::mojom::BoolAttribute attr,
|
||||
bool new_value) override {
|
||||
attribute_change_log_.push_back(base::StringPrintf(
|
||||
"%s changed to %s", ToString(attr), new_value ? "true" : "false"));
|
||||
"%s changed to %s", ToString(attr), base::ToString(new_value)));
|
||||
}
|
||||
|
||||
void OnIntListAttributeChanged(
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "base/numerics/checked_math.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/to_string.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
#include "base/trace_event/memory_allocator_dump.h"
|
||||
@ -1664,7 +1665,7 @@ void AXPlatformNodeBase::AddAttributeToList(
|
||||
DCHECK(attributes);
|
||||
bool value;
|
||||
if (GetBoolAttribute(attribute, &value)) {
|
||||
AddAttributeToList(name, value ? "true" : "false", attributes);
|
||||
AddAttributeToList(name, base::ToString(value), attributes);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/to_string.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/values.h"
|
||||
#include "ui/accessibility/platform/ax_platform_node_auralinux.h"
|
||||
@ -439,7 +440,7 @@ void AXTreeFormatterAuraLinux::AddTableProperties(
|
||||
// Caption details.
|
||||
AtkObject* caption = atk_table_get_caption(table);
|
||||
table_properties.Append(
|
||||
base::StringPrintf("caption=%s;", caption ? "true" : "false"));
|
||||
base::StringPrintf("caption=%s;", base::ToString<bool>(caption)));
|
||||
|
||||
// Summarize information about the cells from the table's perspective here.
|
||||
std::vector<std::string> span_info;
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/to_string.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
#include "ui/color/color_mixer.h"
|
||||
#include "ui/color/color_provider_utils.h"
|
||||
@ -258,7 +259,7 @@ ColorTransform SelectBasedOnDarkInput(
|
||||
DVLOG(2) << "ColorTransform SelectBasedOnDarkInput:" << " Input Color: "
|
||||
<< SkColorName(input_color)
|
||||
<< " Input Transform: " << SkColorName(color)
|
||||
<< " IsDark: " << (color_utils::IsDark(color) ? "true" : "false")
|
||||
<< " IsDark: " << base::ToString(color_utils::IsDark(color))
|
||||
<< " Result Color: " << SkColorName(result_color);
|
||||
return result_color;
|
||||
};
|
||||
|
@ -5,16 +5,17 @@
|
||||
#ifndef UI_OZONE_PLATFORM_WAYLAND_HOST_DUMP_UTIL_H_
|
||||
#define UI_OZONE_PLATFORM_WAYLAND_HOST_DUMP_UTIL_H_
|
||||
|
||||
#include "base/containers/fixed_flat_map.h"
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
#include "base/containers/fixed_flat_map.h"
|
||||
#include "base/strings/to_string.h"
|
||||
|
||||
namespace ui {
|
||||
class WaylandWindow;
|
||||
|
||||
inline std::string ToBoolString(bool b) {
|
||||
return b ? "true" : "false";
|
||||
return base::ToString(b);
|
||||
}
|
||||
|
||||
inline std::string GetWindowName(const WaylandWindow* window) {
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/to_string.h"
|
||||
|
||||
namespace views::debug {
|
||||
|
||||
@ -23,7 +24,7 @@ constexpr int kElementIndent = 2;
|
||||
constexpr int kAttributeIndent = 4;
|
||||
|
||||
std::string ToString(bool val) {
|
||||
return val ? "true" : "false";
|
||||
return base::ToString(val);
|
||||
}
|
||||
|
||||
std::string ToString(int val) {
|
||||
|
Reference in New Issue
Block a user