mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Fix context menu in devtools.
This commit is contained in:
@@ -531,8 +531,11 @@ void NativeWindow::DevToolsSaveToFile(const std::string& url,
|
||||
path = it->second;
|
||||
} else {
|
||||
base::FilePath default_path(base::FilePath::FromUTF8Unsafe(url));
|
||||
if (!file_dialog::ShowSaveDialog(this, url, default_path, &path))
|
||||
if (!file_dialog::ShowSaveDialog(this, url, default_path, &path)) {
|
||||
base::StringValue url_value(url);
|
||||
CallDevToolsFunction("InspectorFrontendAPI.canceledSaveURL", &url_value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
saved_files_[url] = path;
|
||||
@@ -541,9 +544,6 @@ void NativeWindow::DevToolsSaveToFile(const std::string& url,
|
||||
// Notify devtools.
|
||||
base::StringValue url_value(url);
|
||||
CallDevToolsFunction("InspectorFrontendAPI.savedURL", &url_value);
|
||||
|
||||
// TODO(zcbenz): In later Chrome we need to call canceledSaveURL when the save
|
||||
// failed.
|
||||
}
|
||||
|
||||
void NativeWindow::DevToolsAppendToFile(const std::string& url,
|
||||
@@ -607,8 +607,9 @@ void NativeWindow::CallDevToolsFunction(const std::string& function_name,
|
||||
}
|
||||
}
|
||||
}
|
||||
GetDevToolsWebContents()->GetRenderViewHost()->ExecuteJavascriptInWebFrame(
|
||||
base::string16(), base::UTF8ToUTF16(function_name + "(" + params + ");"));
|
||||
base::string16 javascript =
|
||||
base::UTF8ToUTF16(function_name + "(" + params + ");");
|
||||
GetDevToolsWebContents()->GetMainFrame()->ExecuteJavaScript(javascript);
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
window.onload = ->
|
||||
# Use menu API to show context menu.
|
||||
WebInspector.ContextMenu.prototype.show = ->
|
||||
menuObject = @_buildDescriptor()
|
||||
if menuObject.length
|
||||
WebInspector._contextMenu = this
|
||||
createMenu(menuObject, @_event)
|
||||
@_event.consume()
|
||||
InspectorFrontendHost.showContextMenu = (event, items) ->
|
||||
createMenu items, event
|
||||
|
||||
# Use dialog API to override file chooser dialog.
|
||||
WebInspector.createFileSelectorElement = (callback) ->
|
||||
|
||||
2
vendor/brightray
vendored
2
vendor/brightray
vendored
Submodule vendor/brightray updated: 389fb3bd7d...842b674b6a
Reference in New Issue
Block a user