Fix context menu in devtools.

This commit is contained in:
Cheng Zhao 2014-07-09 15:41:16 +08:00
parent 2312f84ec9
commit 7b93a19e9b
3 changed files with 10 additions and 13 deletions

View file

@ -531,8 +531,11 @@ void NativeWindow::DevToolsSaveToFile(const std::string& url,
path = it->second; path = it->second;
} else { } else {
base::FilePath default_path(base::FilePath::FromUTF8Unsafe(url)); 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; return;
}
} }
saved_files_[url] = path; saved_files_[url] = path;
@ -541,9 +544,6 @@ void NativeWindow::DevToolsSaveToFile(const std::string& url,
// Notify devtools. // Notify devtools.
base::StringValue url_value(url); base::StringValue url_value(url);
CallDevToolsFunction("InspectorFrontendAPI.savedURL", &url_value); 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, void NativeWindow::DevToolsAppendToFile(const std::string& url,
@ -607,8 +607,9 @@ void NativeWindow::CallDevToolsFunction(const std::string& function_name,
} }
} }
} }
GetDevToolsWebContents()->GetRenderViewHost()->ExecuteJavascriptInWebFrame( base::string16 javascript =
base::string16(), base::UTF8ToUTF16(function_name + "(" + params + ");")); base::UTF8ToUTF16(function_name + "(" + params + ");");
GetDevToolsWebContents()->GetMainFrame()->ExecuteJavaScript(javascript);
} }
} // namespace atom } // namespace atom

View file

@ -1,11 +1,7 @@
window.onload = -> window.onload = ->
# Use menu API to show context menu. # Use menu API to show context menu.
WebInspector.ContextMenu.prototype.show = -> InspectorFrontendHost.showContextMenu = (event, items) ->
menuObject = @_buildDescriptor() createMenu items, event
if menuObject.length
WebInspector._contextMenu = this
createMenu(menuObject, @_event)
@_event.consume()
# Use dialog API to override file chooser dialog. # Use dialog API to override file chooser dialog.
WebInspector.createFileSelectorElement = (callback) -> WebInspector.createFileSelectorElement = (callback) ->

2
vendor/brightray vendored

@ -1 +1 @@
Subproject commit 389fb3bd7d6cabf84b0208810de1e7a0e5bedd7b Subproject commit 842b674b6afa26ffc9d3d97f2ff96f0bb8498d74