refactor: remove base::Value from WebContentsPreferences (#30193)

This commit is contained in:
Jeremy Rose 2021-07-26 09:04:09 -07:00 committed by GitHub
parent 64ba8feb93
commit 385d0f590f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 433 additions and 415 deletions

View file

@ -61,7 +61,7 @@ void ElectronJavaScriptDialogManager::RunJavaScriptDialog(
auto* web_preferences = WebContentsPreferences::From(web_contents);
if (web_preferences && web_preferences->IsEnabled("disableDialogs")) {
if (web_preferences && web_preferences->ShouldDisableDialogs()) {
return std::move(callback).Run(false, std::u16string());
}
@ -81,14 +81,14 @@ void ElectronJavaScriptDialogManager::RunJavaScriptDialog(
std::string checkbox;
if (origin_counts_[origin] > 1 && web_preferences &&
web_preferences->IsEnabled("safeDialogs") &&
!web_preferences->GetPreference("safeDialogsMessage", &checkbox)) {
web_preferences->ShouldUseSafeDialogs() &&
!web_preferences->GetSafeDialogsMessage(&checkbox)) {
checkbox = "Prevent this app from creating additional dialogs";
}
// Don't set parent for offscreen window.
NativeWindow* window = nullptr;
if (web_preferences && !web_preferences->IsEnabled(options::kOffscreen)) {
if (web_preferences && !web_preferences->IsOffscreen()) {
auto* relay = NativeWindowRelay::FromWebContents(web_contents);
if (relay)
window = relay->GetNativeWindow();