refactor: move impl functions into private namespace (#43410)
* refactor: move into unnamed namespace: IsKillURL() refactor: move into unnamed namespace: ResolvePossiblyRelativeURL() refactor: move into unnamed namespace: AllowFileAccess() refactor: move into unnamed namespace: PrepareURLForNavigation() Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: move into unnamed namespace: GetMonitors() refactor: move into unnamed namespace: GetEDIDProperty() refactor: move into unnamed namespace: MonitorAtomIdToDisplayId() Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: move into unnamed namespace: GetPermissionInfos() } refactor: move into unnamed namespace: GetPermissionAliases() Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: move into unnamed namespace: OnOpenExternal() refactor: move into unnamed namespace: HandleExternalProtocolInUI() Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: move into unnamed namespace: BindMimeHandlerService() refactor: move into unnamed namespace: BindBeforeUnloadControl() refactor: move into unnamed namespace: BindBadgeServiceForServiceWorker() Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: move into unnamed namespace: GetClientIdPath() refactor: move into unnamed namespace: ReadClientId() refactor: move into unnamed namespace: WriteClientId() Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: move into unnamed namespace: HasExplicitLogFile() refactor: move into unnamed namespace: DetermineLoggingDestination() Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: move into unnamed namespace: GetArchiveCache() refactor: move into unnamed namespace: GetArchiveCacheLock() Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: move into unnamed namespace: GetParameters() Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: move into unnamed namespace: GetDoomed() Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: move into unnamed namespace: EncodeToken() refactor: move into unnamed namespace: PortInfoToValue() Co-authored-by: Charles Kerr <charles@charleskerr.com> --------- 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:
parent
5080b647c8
commit
a7459bc93b
10 changed files with 40 additions and 8 deletions
|
@ -83,6 +83,8 @@ const std::map<std::string, std::string>& GetGlobalCrashKeys() {
|
|||
return GetGlobalCrashKeysMutable();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
bool GetClientIdPath(base::FilePath* path) {
|
||||
if (base::PathService::Get(electron::DIR_CRASH_DUMPS, path)) {
|
||||
*path = path->Append("client_id");
|
||||
|
@ -111,6 +113,8 @@ void WriteClientId(const std::string& client_id) {
|
|||
base::WriteFile(client_id_path, client_id);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
std::string GetClientId() {
|
||||
static base::NoDestructor<std::string> client_id;
|
||||
if (!client_id->empty())
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "ui/base/cocoa/permissions_utils.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
// Private function in ui/base/x/x11_display_util.cc
|
||||
base::flat_map<x11::RandR::Output, int> GetMonitors(
|
||||
|
@ -141,8 +142,6 @@ base::flat_map<int32_t, uint32_t> MonitorAtomIdToDisplayId() {
|
|||
}
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
std::unique_ptr<ThumbnailCapturer> MakeWindowCapturer() {
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
if (ShouldUseThumbnailCapturerMac(DesktopMediaList::Type::kWindow)) {
|
||||
|
|
|
@ -869,6 +869,8 @@ void ElectronBrowserClient::RenderProcessExited(
|
|||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
void OnOpenExternal(const GURL& escaped_url, bool allowed) {
|
||||
if (allowed) {
|
||||
platform_util::OpenExternal(
|
||||
|
@ -905,6 +907,8 @@ void HandleExternalProtocolInUI(
|
|||
has_user_gesture, url);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
bool ElectronBrowserClient::HandleExternalProtocol(
|
||||
const GURL& url,
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
|
@ -1523,6 +1527,7 @@ void ElectronBrowserClient::BindHostReceiverForRenderer(
|
|||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
namespace {
|
||||
void BindMimeHandlerService(
|
||||
content::RenderFrameHost* frame_host,
|
||||
mojo::PendingReceiver<extensions::mime_handler::MimeHandlerService>
|
||||
|
@ -1551,6 +1556,7 @@ void BindBeforeUnloadControl(
|
|||
return;
|
||||
guest_view->FuseBeforeUnloadControl(std::move(receiver));
|
||||
}
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
void ElectronBrowserClient::ExposeInterfacesToRenderer(
|
||||
|
@ -1690,6 +1696,8 @@ content::UsbDelegate* ElectronBrowserClient::GetUsbDelegate() {
|
|||
return usb_delegate_.get();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
void BindBadgeServiceForServiceWorker(
|
||||
const content::ServiceWorkerVersionBaseInfo& info,
|
||||
mojo::PendingReceiver<blink::mojom::BadgeService> receiver) {
|
||||
|
@ -1704,6 +1712,8 @@ void BindBadgeServiceForServiceWorker(
|
|||
render_process_host, info.scope, std::move(receiver));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void ElectronBrowserClient::RegisterBrowserInterfaceBindersForServiceWorker(
|
||||
content::BrowserContext* browser_context,
|
||||
const content::ServiceWorkerVersionBaseInfo& service_worker_version_info,
|
||||
|
|
|
@ -466,6 +466,8 @@ ExtensionFunction::ResponseAction TabsSetZoomSettingsFunction::Run() {
|
|||
return RespondNow(NoArguments());
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
bool IsKillURL(const GURL& url) {
|
||||
#if DCHECK_IS_ON()
|
||||
// Caller should ensure that |url| is already "fixed up" by
|
||||
|
@ -585,6 +587,8 @@ base::expected<GURL, std::string> PrepareURLForNavigation(
|
|||
return url;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
TabsUpdateFunction::TabsUpdateFunction() : web_contents_(nullptr) {}
|
||||
|
||||
ExtensionFunction::ResponseAction TabsUpdateFunction::Run() {
|
||||
|
|
|
@ -36,6 +36,8 @@ constexpr char kUsbDriverKey[] = "usb_driver";
|
|||
#endif // BUILDFLAG(IS_MAC)
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
namespace {
|
||||
|
||||
std::string EncodeToken(const base::UnguessableToken& token) {
|
||||
const uint64_t data[2] = {token.GetHighForSerialization(),
|
||||
token.GetLowForSerialization()};
|
||||
|
@ -80,6 +82,8 @@ base::Value PortInfoToValue(const device::mojom::SerialPortInfo& port) {
|
|||
return base::Value(std::move(value));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
SerialChooserContext::SerialChooserContext(ElectronBrowserContext* context)
|
||||
: browser_context_(context) {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue