refactor: more inline constexpr string view (#44498)

* chore: remove unused electron::kHidProductIdKey

* refactor: make electron::kHidDeviceNameKey inline constexpr std::string_view

refactor: make electron::kHidGuidKey inline constexpr std::string_view

* refactor: make serial_chooser_context keys inline constexpr std::string_view

* refactor: make native_window keys inline constexpr std::string_view

* refactor: make electron::options keys inline constexpr std::string_view pt 1

* fixup! refactor: make electron::options keys inline constexpr std::string_view pt 1

chore: make kElectronNativeWindowKey a base::cstring_view

ui::Widget::GetNativeWindowProperty requires a const char*

* refactor: make electron::options keys inline constexpr std::string_view pt 2

* refactor: make electron::options keys inline constexpr std::string_view pt 3

* refactor: make electron::options keys inline constexpr std::string_view pt 4

* refactor: make electron::options keys inline constexpr std::string_view pt 5

* refactor: make electron::options keys inline constexpr std::string_view pt 6

* refactor: make electron::options keys inline constexpr std::string_view pt 7

* refactor: make electron::options keys inline constexpr std::string_view pt 8

* chore: remove unused file shell/common/options_switches.cc

* docs: add code comment explaining use of base::cstring_view

* fixup! fixup! refactor: make electron::options keys inline constexpr std::string_view pt 1

* chore: use consistent capitalization of the word 'fullscreen'
This commit is contained in:
Charles Kerr 2024-11-04 12:27:49 -06:00 committed by GitHub
parent 48801be8e9
commit f5bdbdb1e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 305 additions and 412 deletions

View file

@ -23,20 +23,6 @@
namespace electron {
constexpr char kPortNameKey[] = "name";
constexpr char kTokenKey[] = "token";
constexpr char kBluetoothDevicePathKey[] = "bluetooth_device_path";
#if BUILDFLAG(IS_WIN)
constexpr char kDeviceInstanceIdKey[] = "device_instance_id";
#else
constexpr char kVendorIdKey[] = "vendor_id";
constexpr char kProductIdKey[] = "product_id";
constexpr char kSerialNumberKey[] = "serial_number";
#if BUILDFLAG(IS_MAC)
constexpr char kUsbDriverKey[] = "usb_driver";
#endif // BUILDFLAG(IS_MAC)
#endif // BUILDFLAG(IS_WIN)
namespace {
std::string EncodeToken(const base::UnguessableToken& token) {

View file

@ -7,6 +7,7 @@
#include <map>
#include <set>
#include <string_view>
#include <vector>
#include "base/memory/raw_ptr.h"
@ -35,16 +36,20 @@ namespace electron {
class ElectronBrowserContext;
inline constexpr std::string_view kPortNameKey = "name";
inline constexpr std::string_view kTokenKey = "token";
inline constexpr std::string_view kBluetoothDevicePathKey =
"bluetooth_device_path";
#if BUILDFLAG(IS_WIN)
extern const char kDeviceInstanceIdKey[];
inline constexpr std::string_view kDeviceInstanceIdKey = "device_instance_id";
#else
extern const char kVendorIdKey[];
extern const char kProductIdKey[];
extern const char kSerialNumberKey[];
#if BUILDFLAG(IS_MAC)
extern const char kUsbDriverKey[];
#endif // BUILDFLAG(IS_MAC)
inline constexpr std::string_view kVendorIdKey = "vendor_id";
inline constexpr std::string_view kProductIdKey = "product_id";
inline constexpr std::string_view kSerialNumberKey = "serial_number";
#endif // BUILDFLAG(IS_WIN)
#if BUILDFLAG(IS_MAC)
inline constexpr std::string_view kUsbDriverKey = "usb_driver";
#endif // BUILDFLAG(IS_MAC)
class SerialChooserContext : public KeyedService,
public device::mojom::SerialPortManagerClient {