![electron-roller[bot]](/assets/img/avatar_default.png)
* chore: bump chromium in DEPS to 138.0.7180.0 * 6546797: Add a metric for the overall success of the "safe storage" item retrieval. Refs6546797
* 6548078: extensions: Fix TODO in ScriptInjectionTracker for desktop Android Refs6548078
* 6544950: Revert "FSA: Only normalize the hardcoded rules once during initialization" Refs6544950
* chore: bump chromium in DEPS to 138.0.7181.0 * chore: update patches * fix: correctly clamp HSL shift values between 0 and 1 * chore: bump DEPS to 138.0.7183.0 * 6553142: Remove SelectFileDialogLinuxKde |6553142
* chore: update patches * chore: bump chromium in DEPS to 138.0.7184.0 * chore: bump chromium in DEPS to 138.0.7186.0 * chore: bump chromium in DEPS to 138.0.7190.0 * chore: update patches * 6547778: Remove some superfluous //ui/gfx includes from //chrome headers |6547778
* 6556022: Reland FSA: Only normalize the hardcoded rules once during initialization |6556022
* fix: remove pdf_extension_util::AddAdditionalData4099130
This was removed 2 years ago in Chrome. * fix: provide BrowserContext to pdf_extension_util::AddAdditionalData6558173
* fixup! 6556022: Reland FSA: Only normalize the hardcoded rules once during initialization |6556022
* fix: pass in navigation throttle registry6536175
* fixup! 6556022: Reland "FSA: Only normalize the hardcoded rules once during initialization" |6556022
This partially reverts commit 20d709dd15ba0ff332e24ee314149d642dc5d47c. * 6545984: corner-shape: render dashed & dotted borders Refs6545984
* Update corner smoothing expected images * Apply "future" revert commit to fix windows build > Reason for revert: Multiple eng reporting that this is causing build failures due to too-long pathnames, with no immediate feasible workaround This issue also affects our CI builds. Problematic CL in current roll: 6494836: [webgl] Add stub WebGL[2]RenderingContextWebGPU |6494836
"Future" revert CL: 6565622: Revert "[webgl] Add stub WebGL[2]RenderingContextWebGPU" |6565622
This patch should automatically disappear when we roll the revert. * 6533919: win: don't add WS_CAPTION style to popup windows6533919
This mirrors the change made earlier to the code ours is based on: 6374074: [headless] Provide headless aware window metrics on Windows |6374074
--------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: Samuel Maddock <smaddock@slack-corp.com> Co-authored-by: clavin <clavin@electronjs.org>
87 lines
2.9 KiB
C++
87 lines
2.9 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.
|
|
|
|
#include "shell/browser/electron_navigation_throttle.h"
|
|
|
|
#include "content/browser/renderer_host/render_frame_host_impl.h" // nogncheck
|
|
#include "content/public/browser/navigation_handle.h"
|
|
#include "shell/browser/api/electron_api_web_contents.h"
|
|
#include "shell/browser/javascript_environment.h"
|
|
#include "ui/base/page_transition_types.h"
|
|
|
|
namespace electron {
|
|
|
|
ElectronNavigationThrottle::ElectronNavigationThrottle(
|
|
content::NavigationThrottleRegistry& registry)
|
|
: content::NavigationThrottle(registry) {}
|
|
|
|
ElectronNavigationThrottle::~ElectronNavigationThrottle() = default;
|
|
|
|
const char* ElectronNavigationThrottle::GetNameForLogging() {
|
|
return "ElectronNavigationThrottle";
|
|
}
|
|
|
|
content::NavigationThrottle::ThrottleCheckResult
|
|
ElectronNavigationThrottle::WillStartRequest() {
|
|
auto* handle = navigation_handle();
|
|
auto* contents = handle->GetWebContents();
|
|
if (!contents) {
|
|
NOTREACHED();
|
|
}
|
|
|
|
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
|
v8::HandleScope scope(isolate);
|
|
api::WebContents* api_contents = api::WebContents::From(contents);
|
|
if (!api_contents) {
|
|
// No need to emit any event if the WebContents is not available in JS.
|
|
return PROCEED;
|
|
}
|
|
|
|
bool is_renderer_initiated = handle->IsRendererInitiated();
|
|
|
|
// Chrome's internal pages always mark navigation as browser-initiated. Let's
|
|
// ignore that.
|
|
// https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/navigator.cc;l=883-892;drc=0c8ffbe78dc0ef2047849e45cefb3f621043e956
|
|
if (!is_renderer_initiated &&
|
|
ui::PageTransitionIsWebTriggerable(handle->GetPageTransition())) {
|
|
auto* render_frame_host = contents->GetPrimaryMainFrame();
|
|
auto* rfh_impl =
|
|
static_cast<content::RenderFrameHostImpl*>(render_frame_host);
|
|
is_renderer_initiated = rfh_impl && rfh_impl->web_ui();
|
|
}
|
|
|
|
if (is_renderer_initiated &&
|
|
api_contents->EmitNavigationEvent("will-frame-navigate", handle)) {
|
|
return CANCEL;
|
|
}
|
|
if (is_renderer_initiated && handle->IsInMainFrame() &&
|
|
api_contents->EmitNavigationEvent("will-navigate", handle)) {
|
|
return CANCEL;
|
|
}
|
|
return PROCEED;
|
|
}
|
|
|
|
content::NavigationThrottle::ThrottleCheckResult
|
|
ElectronNavigationThrottle::WillRedirectRequest() {
|
|
auto* handle = navigation_handle();
|
|
auto* contents = handle->GetWebContents();
|
|
if (!contents) {
|
|
NOTREACHED();
|
|
}
|
|
|
|
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
|
v8::HandleScope scope(isolate);
|
|
api::WebContents* api_contents = api::WebContents::From(contents);
|
|
if (!api_contents) {
|
|
// No need to emit any event if the WebContents is not available in JS.
|
|
return PROCEED;
|
|
}
|
|
|
|
if (api_contents->EmitNavigationEvent("will-redirect", handle)) {
|
|
return CANCEL;
|
|
}
|
|
return PROCEED;
|
|
}
|
|
|
|
} // namespace electron
|