fix: modernize-avoid-c-arrays (#44834)

use string_view for constants used in methods that take string_view args

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-25 13:55:19 -05:00 committed by GitHub
parent d8a7c57506
commit 5a0e1ccf73
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 69 additions and 62 deletions

View file

@ -6,6 +6,7 @@
#include <memory>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
@ -50,49 +51,49 @@
namespace {
static const char kTargetsDataFile[] = "targets-data.json";
constexpr std::string_view kTargetsDataFile = "targets-data.json";
static const char kAccessibilityModeField[] = "a11yMode";
static const char kBrowsersField[] = "browsers";
static const char kErrorField[] = "error";
static const char kFaviconUrlField[] = "faviconUrl";
static const char kNameField[] = "name";
static const char kPagesField[] = "pages";
static const char kPidField[] = "pid";
static const char kProcessIdField[] = "processId";
static const char kRequestTypeField[] = "requestType";
static const char kRoutingIdField[] = "routingId";
static const char kSessionIdField[] = "sessionId";
static const char kSupportedApiTypesField[] = "supportedApiTypes";
static const char kTreeField[] = "tree";
static const char kTypeField[] = "type";
static const char kUrlField[] = "url";
static const char kWidgetsField[] = "widgets";
static const char kApiTypeField[] = "apiType";
constexpr std::string_view kAccessibilityModeField = "a11yMode";
constexpr std::string_view kBrowsersField = "browsers";
constexpr std::string_view kErrorField = "error";
constexpr std::string_view kFaviconUrlField = "faviconUrl";
constexpr std::string_view kNameField = "name";
constexpr std::string_view kPagesField = "pages";
constexpr std::string_view kPidField = "pid";
constexpr std::string_view kProcessIdField = "processId";
constexpr std::string_view kRequestTypeField = "requestType";
constexpr std::string_view kRoutingIdField = "routingId";
constexpr std::string_view kSessionIdField = "sessionId";
constexpr std::string_view kSupportedApiTypesField = "supportedApiTypes";
constexpr std::string_view kTreeField = "tree";
constexpr std::string_view kTypeField = "type";
constexpr std::string_view kUrlField = "url";
constexpr std::string_view kWidgetsField = "widgets";
constexpr std::string_view kApiTypeField = "apiType";
#if defined(USE_AURA)
static const char kWidgetIdField[] = "widgetId";
static const char kWidget[] = "widget";
constexpr std::string_view kWidgetIdField = "widgetId";
constexpr std::string_view kWidget = "widget";
#endif
// Global flags
static const char kBrowser[] = "browser";
static const char kCopyTree[] = "copyTree";
static const char kHTML[] = "html";
static const char kLocked[] = "locked";
static const char kNative[] = "native";
static const char kPage[] = "page";
static const char kPDFPrinting[] = "pdfPrinting";
static const char kScreenReader[] = "screenreader";
static const char kShowOrRefreshTree[] = "showOrRefreshTree";
static const char kText[] = "text";
static const char kViewsAccessibility[] = "viewsAccessibility";
static const char kWeb[] = "web";
constexpr std::string_view kBrowser = "browser";
constexpr std::string_view kCopyTree = "copyTree";
constexpr std::string_view kHTML = "html";
constexpr std::string_view kLocked = "locked";
constexpr std::string_view kNative = "native";
constexpr std::string_view kPage = "page";
constexpr std::string_view kPDFPrinting = "pdfPrinting";
constexpr std::string_view kScreenReader = "screenreader";
constexpr std::string_view kShowOrRefreshTree = "showOrRefreshTree";
constexpr std::string_view kText = "text";
constexpr std::string_view kViewsAccessibility = "viewsAccessibility";
constexpr std::string_view kWeb = "web";
// Possible global flag values
static const char kDisabled[] = "disabled";
static const char kOff[] = "off";
static const char kOn[] = "on";
constexpr std::string_view kDisabled = "disabled";
constexpr std::string_view kOff = "off";
constexpr std::string_view kOn = "on";
base::Value::Dict BuildTargetDescriptor(
const GURL& url,