providing option to undock devtools from browser-window
This commit is contained in:
parent
ae5586408f
commit
69d958b94e
7 changed files with 16 additions and 10 deletions
|
@ -322,8 +322,8 @@ bool Window::IsKiosk() {
|
|||
return window_->IsKiosk();
|
||||
}
|
||||
|
||||
void Window::OpenDevTools() {
|
||||
window_->OpenDevTools();
|
||||
void Window::OpenDevTools(bool dock) {
|
||||
window_->OpenDevTools(!dock);
|
||||
}
|
||||
|
||||
void Window::CloseDevTools() {
|
||||
|
|
|
@ -105,7 +105,7 @@ class Window : public mate::EventEmitter,
|
|||
void SetSkipTaskbar(bool skip);
|
||||
void SetKiosk(bool kiosk);
|
||||
bool IsKiosk();
|
||||
void OpenDevTools();
|
||||
void OpenDevTools(bool dock);
|
||||
void CloseDevTools();
|
||||
bool IsDevToolsOpened();
|
||||
void InspectElement(int x, int y);
|
||||
|
|
|
@ -40,8 +40,9 @@ BrowserWindow::_init = ->
|
|||
@once 'closed', =>
|
||||
BrowserWindow.windows.remove @id if BrowserWindow.windows.has @id
|
||||
|
||||
BrowserWindow::openDevTools = ->
|
||||
@_openDevTools()
|
||||
BrowserWindow::openDevTools = (options={}) ->
|
||||
options.detach ?= false
|
||||
@_openDevTools(options.detach)
|
||||
|
||||
# Force devToolsWebContents to be created.
|
||||
@devToolsWebContents = @getDevToolsWebContents()
|
||||
|
|
|
@ -284,7 +284,9 @@ bool NativeWindow::HasModalDialog() {
|
|||
return has_dialog_attached_;
|
||||
}
|
||||
|
||||
void NativeWindow::OpenDevTools() {
|
||||
void NativeWindow::OpenDevTools(bool dock) {
|
||||
if (!dock)
|
||||
inspectable_web_contents()->SetCanDock(false);
|
||||
inspectable_web_contents()->ShowDevTools();
|
||||
}
|
||||
|
||||
|
@ -297,7 +299,7 @@ bool NativeWindow::IsDevToolsOpened() {
|
|||
}
|
||||
|
||||
void NativeWindow::InspectElement(int x, int y) {
|
||||
OpenDevTools();
|
||||
OpenDevTools(true);
|
||||
scoped_refptr<content::DevToolsAgentHost> agent(
|
||||
content::DevToolsAgentHost::GetOrCreateFor(GetWebContents()));
|
||||
agent->InspectElement(x, y);
|
||||
|
|
|
@ -146,7 +146,7 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
|||
const std::string& description) = 0;
|
||||
|
||||
virtual bool IsClosed() const { return is_closed_; }
|
||||
virtual void OpenDevTools();
|
||||
virtual void OpenDevTools(bool dock);
|
||||
virtual void CloseDevTools();
|
||||
virtual bool IsDevToolsOpened();
|
||||
virtual void InspectElement(int x, int y);
|
||||
|
|
|
@ -190,7 +190,7 @@ static const CGFloat kAtomWindowCornerRadius = 4.0;
|
|||
}
|
||||
|
||||
- (IBAction)showDevTools:(id)sender {
|
||||
shell_->OpenDevTools();
|
||||
shell_->OpenDevTools(true);
|
||||
}
|
||||
|
||||
// Returns an empty array for AXChildren attribute, this will force the
|
||||
|
|
|
@ -457,7 +457,10 @@ Whether the window's document has been edited.
|
|||
|
||||
__Note__: This API is available only on OS X.
|
||||
|
||||
### BrowserWindow.openDevTools()
|
||||
### BrowserWindow.openDevTools([options])
|
||||
|
||||
* `options` Object
|
||||
* `detach` Boolean - opens devtools in a new window
|
||||
|
||||
Opens the developer tools.
|
||||
|
||||
|
|
Loading…
Reference in a new issue