Disable navigating on drag/drop (#12655)

* Disable navigating on drag/drop

* Add a WebPreferences option to re-enable navigate on drag/drop
This commit is contained in:
Jeremy Apthorp 2018-04-26 08:23:27 -07:00 committed by Charles Kerr
parent 4fcd178c36
commit 1a64b9f0c2
3 changed files with 5 additions and 0 deletions

View file

@ -211,6 +211,7 @@ void AtomBrowserClient::OverrideWebkitPrefs(content::RenderViewHost* host,
prefs->webgl1_enabled = true; prefs->webgl1_enabled = true;
prefs->webgl2_enabled = true; prefs->webgl2_enabled = true;
prefs->allow_running_insecure_content = false; prefs->allow_running_insecure_content = false;
prefs->navigate_on_drag_drop = false;
// Custom preferences of guest page. // Custom preferences of guest page.
auto* web_contents = content::WebContents::FromRenderViewHost(host); auto* web_contents = content::WebContents::FromRenderViewHost(host);

View file

@ -284,6 +284,8 @@ void WebContentsPreferences::OverrideWebkitPrefs(
} }
if (dict_.GetBoolean("allowRunningInsecureContent", &b)) if (dict_.GetBoolean("allowRunningInsecureContent", &b))
prefs->allow_running_insecure_content = b; prefs->allow_running_insecure_content = b;
if (dict_.GetBoolean("navigateOnDragDrop", &b))
prefs->navigate_on_drag_drop = b;
const base::DictionaryValue* fonts = nullptr; const base::DictionaryValue* fonts = nullptr;
if (dict_.GetDictionary("defaultFontFamily", &fonts)) { if (dict_.GetDictionary("defaultFontFamily", &fonts)) {
base::string16 font; base::string16 font;

View file

@ -370,6 +370,8 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
consecutive dialog protection is triggered. If not defined the default consecutive dialog protection is triggered. If not defined the default
message would be used, note that currently the default message is in message would be used, note that currently the default message is in
English and not localized. English and not localized.
* `navigateOnDragDrop` Boolean (optional) - Whether dragging and dropping a
file or link onto the page causes a navigation. Default is `false`.
When setting minimum or maximum window size with `minWidth`/`maxWidth`/ When setting minimum or maximum window size with `minWidth`/`maxWidth`/
`minHeight`/`maxHeight`, it only constrains the users. It won't prevent you from `minHeight`/`maxHeight`, it only constrains the users. It won't prevent you from