electron/shell/common/electron_constants.h
Charles Kerr b3c2e83243
refactor: prefer inline constexpr string_view for string constants (#44405)
* refactor: BaseWindow::OnExecuteAppCommand() now takes a std::string_view

* refactor: NativeWindow::NotifyWindowExecuteAppCommand() takes a std::string_view

* refactor: AppCommandToString() returns a std::string_view, is now constexpr

* refactor: make kBrowserBackward, kBrowserForward inline constexpr std::string_view

Xref: https://abseil.io/tips/140

https://groups.google.com/a/chromium.org/g/chromium-dev/c/jROTxMo_m2Q/m/HgciN2KsAgAJ

* refactor: use inline constexpr string_view for kDevice*Key constants

Xref: https://abseil.io/tips/140

https://groups.google.com/a/chromium.org/g/chromium-dev/c/jROTxMo_m2Q/m/HgciN2KsAgAJ

* refactor: IsEnvSet now takes a base::cstring_view

* refactor: use inline constexpr cstring_view for kRunAsNode

* refactor: use inline constexpr string_view for kPDF*PluginName

* refactor: use base::FilePath::FromASCII() since "internal-pdf-viewer" is ascii

* chore: remove unused shell/common/electron_constants.cc

* fixup! refactor: IsEnvSet now takes a base::cstring_view
2024-10-29 10:30:12 +01:00

35 lines
1.2 KiB
C++

// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_COMMON_ELECTRON_CONSTANTS_H_
#define ELECTRON_SHELL_COMMON_ELECTRON_CONSTANTS_H_
#include <string_view>
#include "base/strings/cstring_view.h"
#include "electron/buildflags/buildflags.h"
namespace electron {
// The app-command in NativeWindow.
inline constexpr std::string_view kBrowserForward = "browser-forward";
inline constexpr std::string_view kBrowserBackward = "browser-backward";
// Keys for Device APIs
inline constexpr std::string_view kDeviceVendorIdKey = "vendorId";
inline constexpr std::string_view kDeviceProductIdKey = "productId";
inline constexpr std::string_view kDeviceSerialNumberKey = "serialNumber";
inline constexpr base::cstring_view kRunAsNode = "ELECTRON_RUN_AS_NODE";
#if BUILDFLAG(ENABLE_PDF_VIEWER)
inline constexpr std::string_view kPDFExtensionPluginName =
"Chromium PDF Viewer";
inline constexpr std::string_view kPDFInternalPluginName =
"Chromium PDF Plugin";
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
} // namespace electron
#endif // ELECTRON_SHELL_COMMON_ELECTRON_CONSTANTS_H_