Skip to content

Commit

Permalink
chore: follow Google C++ brace style
Browse files Browse the repository at this point in the history
chore: use same variable names as in main
  • Loading branch information
ckerr committed May 9, 2024
1 parent 421925b commit 7acf7b6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
5 changes: 3 additions & 2 deletions shell/browser/ui/inspectable_web_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -683,11 +683,12 @@ void InspectableWebContents::LoadNetworkResource(DispatchCallback callback,
url_loader_factory = network::SharedURLLoaderFactory::Create(
std::make_unique<network::WrapperPendingSharedURLLoaderFactory>(
std::move(pending_remote)));
} else if (const auto* const handler =
} else if (const auto* const protocol_handler =
protocol_registry->FindRegistered(gurl.scheme())) {
url_loader_factory = network::SharedURLLoaderFactory::Create(
std::make_unique<network::WrapperPendingSharedURLLoaderFactory>(
ElectronURLLoaderFactory::Create(handler->first, handler->second)));
ElectronURLLoaderFactory::Create(protocol_handler->first,
protocol_handler->second)));
} else {
auto* partition = GetDevToolsWebContents()
->GetBrowserContext()
Expand Down
22 changes: 14 additions & 8 deletions shell/common/api/electron_api_url_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -483,25 +483,31 @@ SimpleURLLoaderWrapper::GetURLLoaderFactoryForURL(const GURL& url) {
if (const bool bypass = request_options_ & kBypassCustomProtocolHandlers;
!bypass) {
const auto scheme = url.scheme();
const auto* reg = ProtocolRegistry::FromBrowserContext(browser_context_);
const auto* const protocol_registry =
ProtocolRegistry::FromBrowserContext(browser_context_);

if (const auto* handler = reg->FindIntercepted(scheme))
if (const auto* const protocol_handler =
protocol_registry->FindIntercepted(scheme)) {
return network::SharedURLLoaderFactory::Create(
std::make_unique<network::WrapperPendingSharedURLLoaderFactory>(
ElectronURLLoaderFactory::Create(handler->first,
handler->second)));
ElectronURLLoaderFactory::Create(protocol_handler->first,
protocol_handler->second)));
}

if (const auto* handler = reg->FindRegistered(scheme))
if (const auto* const protocol_handler =
protocol_registry->FindRegistered(scheme)) {
return network::SharedURLLoaderFactory::Create(
std::make_unique<network::WrapperPendingSharedURLLoaderFactory>(
ElectronURLLoaderFactory::Create(handler->first,
handler->second)));
ElectronURLLoaderFactory::Create(protocol_handler->first,
protocol_handler->second)));
}
}

if (url.SchemeIsFile())
if (url.SchemeIsFile()) {
return network::SharedURLLoaderFactory::Create(
std::make_unique<network::WrapperPendingSharedURLLoaderFactory>(
AsarURLLoaderFactory::Create()));
}

return browser_context_->GetURLLoaderFactory();
}
Expand Down

0 comments on commit 7acf7b6

Please sign in to comment.