Open ConstRico opened 2 days ago
By inconsistent I assume you mean it performs the native action rather than (what it sounds like you want) of not doing anything.
You say OnKeyEvent / OnPreKeyEvent you are returning false but if you want to be fake 'handling' them you would want true: https://github.com/cefsharp/CefSharp/blob/2ebad4d7688950642be8761003a6515115036bda/CefSharp/Handler/IKeyboardHandler.cs#L56
as for why 128 breaks things? That is when the alloy boostrap was first removed this was an upstream change likely this is the cause.
@mitchcapper So is there any solution now that will work the same way as the alloy boostrap? such as password manager won't be displayed when we entered a password
Well setting CefSharpSettings.RuntimeStyle = CefRuntimeStyle.Alloy
will ensure you use alloy style for as long as cef supports it. In terms of getting the old behavior, to start, you need to update your keyboard handler. I don't think they changed but I could be wrong, either way returning false seems wrong if you are saying the shortcuts are handled.
As for other features, like the password manager, some things you can disable using preferences ie:
.To find the exact name use the cefclient.exe under the other tests their prefs you can export the changed only settings as json. Do that, change something, export again and you can see the exact pref name. This is a greatly expanded set of things one can set. I am pretty positive the password manager disabling by prefs would be the way to go.
You can also disable several features by command line ie:
Actually think I did have password manager specifically disabled by:
Note these pref commands are not what you would use, you would want requestcontext.SetPreference or contextHandler.SetPreferenceOnContextInitialized
@mitchcapper Hi Mitch, I have implemented the solutions you suggested. However, it seems that CefSharpSettings.RuntimeStyle = CefRuntimeStyle.Alloy
has been deprecated in Cef, and maintaining the alloy style now requires additional configuration. Additionally, the password manager cannot be disabled after integrating your code. Thank you very much for your assistance!
I dont think the window styling is deprecated but assuming you are using WPF and not WPF.HwndHost then it currently always is alloy style: https://github.com/cefsharp/CefSharp/blob/2ebad4d7688950642be8761003a6515115036bda/CefSharp/IWindowInfo.cs#L75-L77
I don't know what code you did to try above. Using
browser.RequestContext = new RequestContextBuilder().WithPreference("autofill.enabled", false).WithPreference("credentials_enable_service", false).Create();
when creating the browser doesn't quite work as I expected.
Once the window is fully loaded if I do: It correctly works without issue. You can visit: chrome://password-manager/settings to verify.
Hi @mitchcapper , since upgrading to v128.4.90 makes some Chrome behaviors show up, can I find what prefs and command lines Alloy Bootstrap used to set some where? I want to make all behaviors(not UI styles, just functionalities like password manage) same as Alloy Bootstrap ones.
I searched but not find what Allow Bootstrap does about the pref and commands, could you offer some help on it?
I should mention above I only tested on 130 as well so I don't know for 128 if it all works as expected.
can I find what prefs and command lines Alloy Bootstrap used to set some where?
It doesn't work like that. Under the covers CEF had a massive switch from the aging and limited alloy bootstrap runtime to the chromium bootstrap runtime. Essentially this is building CEF on top of a higher level of chromium bringing a massive slew of features that CEF could never do, and handed of many things that CEF had to essentially re-implement.
It isn't that CEF was turning off the password manager before, it is that CEF was much lower so the password manager code did not exist. Think of it like a car and before CEF was directly on top of an engine. You didn't need to disable the radio or say remove the windows in the passenger car doors as you were from-scratch on top of the engine. This also means if you wanted an infotainment system for your car you basically had to build it from scratch. Now with the Chrome runtime essentially CEF is taking an entire car and modding it from there to allow the same low level control but still have the capability of all those high level chromium features. The car comes with many bells and whistles we may not want though so we need to disable them to get something similar to the bare bones base from before.
There are many things one would need to tweak to get it to be as limited as the old CEF, and I don't think anyone has a list of prefs to help do that. Your choice is limited. Stick with an older version that will never update or accept their runtime change and change the prefs to function as you like.
@mitchcapper Great answer, thanks a lot.
By the way RequestContext
disables password works fine on 128.
Thanks for you clarification, we'll choose one from the limited choice.
Is there an existing issue for this?
CefSharp Version
128.4.90
Operating System
Windows 10
Architecture
x64
.Net Version
.Net4.8
Implementation
WPF
Reproduction Steps
We implemented the IKeyboardHandler interface, where its methods (OnKeyEvent and OnPreKeyEvent) consistently return false and press any shortcut keys like ctrl+s
Expected behavior
In version 127.3.50, regardless of the shortcut keys pressed, they do not function as intended.
Actual behavior
After upgrading to version 128.4.90, all shortcut keys operate correctly.
Regression?
No response
Known Workarounds
No response
Does this problem also occur in the CEF Sample Application
Yes using WPF/OffScreen command line args
Other information
We are interested in understanding why the behavior has changed and What modifications do we need to make in the code to ensure it functions as it did previously?