9a198e8ef4
* chore: bump chromium in DEPS to 0476932294da8809a19189b9f54cee11d50cc512 * update chromium patches (#20838) * chore: bump chromium in DEPS to 838863f5ec9e8a12132a10bb47be8382ad9756a7 * IsRendererTransferNeededForNavigation went away https://chromium-review.googlesource.com/c/chromium/src/+/1867031 * [arraybuffer] Move the ArrayBuffer implementation from wtf to core https://chromium-review.googlesource.com/c/chromium/src/+/1875731 * URLLoaderRequest new mojo types * context menu enums moved around https://chromium-review.googlesource.com/c/chromium/src/+/1872004 https://chromium-review.googlesource.com/c/chromium/src/+/1876088 https://chromium-review.googlesource.com/c/chromium/src/+/1866520 * chore: bump chromium in DEPS to dc9525d251bf30828899e4cd7161f6dc6507023f * update chromium patches * [WIP] Convert network hints IPC to Mojo https://chromium-review.googlesource.com/c/chromium/src/+/1881967 * jumbo build is no longer supported https://chromium-review.googlesource.com/c/chromium/src/+/1881967 * fix disable-color-correct-rendering * [FIXME] fix printing patch compiles but prob doesn't work * explicitly include ax_enums https://chromium-review.googlesource.com/c/chromium/src/+/1759821 * fixup! [WIP] Convert network hints IPC to Mojo * fix base::span * fix AsarURLLoader to not double-std::move * fix debug build * fix msstl patch * lint * more fix msstl * mooooore fix msstl * fix compile * update backport_fix_msstl_compat_in_ui_events.patch * update msstl compat patch * don't try to build chrome's prefetch predictor * build: fix compilation on windows * Fixup patches for MAS build * Free up disk space for mac debug builds * fix: apply custom site instance only for main frame * Fixup from rebase * Try not generating symbols for mac debug builds * Remove double entry of patch * FIx compile errors * Trigger CI * Set symbol_level to 1 for mac debug builds
48 lines
1.9 KiB
C++
48 lines
1.9 KiB
C++
// Copyright (c) 2019 Slack Technologies, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "shell/browser/network_hints_handler_impl.h"
|
|
|
|
#include <utility>
|
|
|
|
#include "content/public/browser/browser_context.h"
|
|
#include "content/public/browser/browser_thread.h"
|
|
#include "content/public/browser/render_frame_host.h"
|
|
#include "content/public/browser/render_process_host.h"
|
|
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
|
|
#include "shell/browser/api/atom_api_session.h"
|
|
#include "shell/browser/atom_browser_context.h"
|
|
#include "shell/common/gin_converters/gurl_converter.h"
|
|
#include "v8/include/v8.h"
|
|
|
|
NetworkHintsHandlerImpl::NetworkHintsHandlerImpl(int32_t render_process_id)
|
|
: network_hints::SimpleNetworkHintsHandlerImpl(render_process_id),
|
|
render_process_id_(render_process_id) {}
|
|
|
|
NetworkHintsHandlerImpl::~NetworkHintsHandlerImpl() = default;
|
|
|
|
void NetworkHintsHandlerImpl::Preconnect(int32_t render_frame_id,
|
|
const GURL& url,
|
|
bool allow_credentials) {
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
|
|
content::RenderFrameHost* render_frame_host =
|
|
content::RenderFrameHost::FromID(render_process_id_, render_frame_id);
|
|
content::BrowserContext* browser_context =
|
|
render_frame_host->GetProcess()->GetBrowserContext();
|
|
auto* session = electron::api::Session::FromWrappedClass(
|
|
v8::Isolate::GetCurrent(),
|
|
static_cast<electron::AtomBrowserContext*>(browser_context));
|
|
if (session) {
|
|
session->Emit("preconnect", url, allow_credentials);
|
|
}
|
|
}
|
|
|
|
void NetworkHintsHandlerImpl::Create(
|
|
int32_t render_process_id,
|
|
mojo::PendingReceiver<network_hints::mojom::NetworkHintsHandler> receiver) {
|
|
mojo::MakeSelfOwnedReceiver(
|
|
base::WrapUnique(new NetworkHintsHandlerImpl(render_process_id)),
|
|
std::move(receiver));
|
|
}
|