mirror of
https://github.com/atom/atom.git
synced 2026-01-15 01:48:15 -05:00
Add atom.showDevTools and replace calls to $native.showDevTools
This commit is contained in:
@@ -23,7 +23,7 @@ keymap.bindKeys '*',
|
||||
'meta-w': 'close'
|
||||
'alt-meta-i': 'show-console'
|
||||
$(document).on 'close', -> window.close()
|
||||
$(document).on 'show-console', -> $native.showDevTools()
|
||||
$(document).on 'show-console', -> atom.toggleDevTools()
|
||||
|
||||
defaultCount = 100
|
||||
window.pbenchmark = (args...) -> window.benchmark(args..., profile: true)
|
||||
@@ -42,7 +42,7 @@ window.benchmark = (args...) ->
|
||||
[fn, options] = args
|
||||
{ profile, focused } = (options ? {})
|
||||
|
||||
$native.showDevTools() if profile
|
||||
atom.showDevTools() if profile
|
||||
method = if focused then fit else it
|
||||
method description, ->
|
||||
total = measure ->
|
||||
|
||||
@@ -35,6 +35,9 @@ bool AtomCefClient::OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
||||
else if (name == "toggleDevTools") {
|
||||
ToggleDevTools(browser);
|
||||
}
|
||||
else if (name == "showDevTools") {
|
||||
ShowDevTools(browser);
|
||||
}
|
||||
else if (name == "confirm") {
|
||||
std::string message = argumentList->GetString(1).ToString();
|
||||
std::string detailedMessage = argumentList->GetString(2).ToString();
|
||||
|
||||
@@ -99,12 +99,13 @@ class AtomCefClient : public CefClient,
|
||||
void Open(std::string path);
|
||||
void Open();
|
||||
void NewWindow();
|
||||
void ToggleDevTools(CefRefPtr<CefBrowser> browser);
|
||||
void ShowDevTools(CefRefPtr<CefBrowser> browser);
|
||||
void Confirm(int replyId,
|
||||
std::string message,
|
||||
std::string detailedMessage,
|
||||
std::vector<std::string> buttonLabels,
|
||||
CefRefPtr<CefBrowser> browser);
|
||||
void ToggleDevTools(CefRefPtr<CefBrowser> browser);
|
||||
void ShowSaveDialog(int replyId, CefRefPtr<CefBrowser> browser);
|
||||
CefRefPtr<CefListValue> CreateReplyDescriptor(int replyId, int callbackIndex);
|
||||
|
||||
|
||||
@@ -52,6 +52,11 @@ void AtomCefClient::ToggleDevTools(CefRefPtr<CefBrowser> browser) {
|
||||
[windowController toggleDevTools];
|
||||
}
|
||||
|
||||
void AtomCefClient::ShowDevTools(CefRefPtr<CefBrowser> browser) {
|
||||
AtomWindowController *windowController = [[browser->GetHost()->GetWindowHandle() window] windowController];
|
||||
[windowController showDevTools];
|
||||
}
|
||||
|
||||
void AtomCefClient::ShowSaveDialog(int replyId, CefRefPtr<CefBrowser> browser) {
|
||||
CefRefPtr<CefProcessMessage> replyMessage = CefProcessMessage::Create("reply");
|
||||
CefRefPtr<CefListValue> replyArguments = replyMessage->GetArgumentList();
|
||||
|
||||
@@ -26,5 +26,6 @@ class AtomCefClient;
|
||||
- (id)initBenchmarks;
|
||||
|
||||
- (void)toggleDevTools;
|
||||
- (void)showDevTools;
|
||||
|
||||
@end
|
||||
|
||||
@@ -80,6 +80,8 @@
|
||||
}
|
||||
|
||||
- (void)showDevTools {
|
||||
if (_devToolsView) return;
|
||||
|
||||
if (_cefClient && _cefClient->GetBrowser()) {
|
||||
_devToolsView = [[NSView alloc] initWithFrame:_splitView.bounds];
|
||||
[_splitView addSubview:_devToolsView];
|
||||
|
||||
@@ -11,7 +11,7 @@ TextMateBundle = require 'text-mate-bundle'
|
||||
TextMateTheme = require 'text-mate-theme'
|
||||
fs = require 'fs'
|
||||
require 'window'
|
||||
$native.showDevTools()
|
||||
atom.showDevTools()
|
||||
|
||||
requireStylesheet "jasmine.css"
|
||||
TextMateBundle.loadAll()
|
||||
|
||||
@@ -8,7 +8,7 @@ originalSendMessageToBrowserProcess = atom.sendMessageToBrowserProcess
|
||||
|
||||
atom.pendingBrowserProcessCallbacks = {}
|
||||
|
||||
atom.sendMessageToBrowserProcess = (name, data, callbacks) ->
|
||||
atom.sendMessageToBrowserProcess = (name, data=[], callbacks) ->
|
||||
messageId = messageIdCounter++
|
||||
data.unshift(messageId)
|
||||
callbacks = [callbacks] if typeof callbacks is 'function'
|
||||
@@ -37,8 +37,11 @@ atom.confirm = (message, detailedMessage, buttonLabelsAndCallbacks...) ->
|
||||
atom.showSaveDialog = (callback) ->
|
||||
@sendMessageToBrowserProcess('showSaveDialog', [], callback)
|
||||
|
||||
atom.toggleDevTools = (args...)->
|
||||
@sendMessageToBrowserProcess('toggleDevTools', args)
|
||||
atom.toggleDevTools = ->
|
||||
@sendMessageToBrowserProcess('toggleDevTools')
|
||||
|
||||
atom.showDevTools = ->
|
||||
@sendMessageToBrowserProcess('showDevTools')
|
||||
|
||||
atom.getRootViewStateForPath = (path) ->
|
||||
if json = localStorage[path]
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
if (bootstrapScript) require(bootstrapScript);
|
||||
}
|
||||
catch (error) {
|
||||
//$native.showDevTools();
|
||||
atom.showDevTools();
|
||||
console.error(error.stack || error);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user