Add API to get whether the devtools is opened.
This commit is contained in:
parent
afc627aae1
commit
de7892cd6e
10 changed files with 24 additions and 2 deletions
|
@ -22,6 +22,7 @@ class InspectableWebContents {
|
|||
virtual content::WebContents* GetWebContents() const = 0;
|
||||
|
||||
virtual void ShowDevTools() = 0;
|
||||
virtual bool IsDevToolsOpened() = 0;
|
||||
};
|
||||
|
||||
} // namespace brightray
|
||||
|
|
|
@ -96,6 +96,10 @@ void InspectableWebContentsImpl::ShowDevTools() {
|
|||
view_->ShowDevTools();
|
||||
}
|
||||
|
||||
bool InspectableWebContentsImpl::IsDevToolsOpened() {
|
||||
return devtools_web_contents_ && view_->IsDevToolsOpened();
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::UpdateFrontendDockSide() {
|
||||
auto javascript = base::StringPrintf(
|
||||
"InspectorFrontendAPI.setDockSide(\"%s\")", dock_side_.c_str());
|
||||
|
|
|
@ -41,6 +41,7 @@ class InspectableWebContentsImpl :
|
|||
virtual content::WebContents* GetWebContents() const OVERRIDE;
|
||||
|
||||
virtual void ShowDevTools() OVERRIDE;
|
||||
virtual bool IsDevToolsOpened() OVERRIDE;
|
||||
|
||||
content::WebContents* devtools_web_contents() {
|
||||
return devtools_web_contents_.get();
|
||||
|
|
|
@ -13,6 +13,7 @@ class InspectableWebContentsView {
|
|||
|
||||
virtual void ShowDevTools() = 0;
|
||||
virtual void CloseDevTools() = 0;
|
||||
virtual bool IsDevToolsOpened() = 0;
|
||||
virtual bool SetDockSide(const std::string& side) = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ class InspectableWebContentsViewMac : public InspectableWebContentsView {
|
|||
virtual gfx::NativeView GetNativeView() const OVERRIDE;
|
||||
virtual void ShowDevTools() OVERRIDE;
|
||||
virtual void CloseDevTools() OVERRIDE;
|
||||
virtual bool IsDevToolsOpened() OVERRIDE;
|
||||
virtual bool SetDockSide(const std::string& side) OVERRIDE;
|
||||
|
||||
InspectableWebContentsImpl* inspectable_web_contents() {
|
||||
|
|
|
@ -29,6 +29,10 @@ void InspectableWebContentsViewMac::CloseDevTools() {
|
|||
[view_ setDevToolsVisible:NO];
|
||||
}
|
||||
|
||||
bool InspectableWebContentsViewMac::IsDevToolsOpened() {
|
||||
return [view_ isDevToolsVisible];
|
||||
}
|
||||
|
||||
bool InspectableWebContentsViewMac::SetDockSide(const std::string& side) {
|
||||
return [view_ setDockSide:side];
|
||||
}
|
||||
|
|
|
@ -112,6 +112,10 @@ void SetActive(content::WebContents* web_contents, bool active) {
|
|||
[_private->splitView adjustSubviews];
|
||||
}
|
||||
|
||||
- (BOOL)isDevToolsVisible {
|
||||
return _private->visible;
|
||||
}
|
||||
|
||||
- (BOOL)setDockSide:(const std::string&)side {
|
||||
if (side == "right") {
|
||||
_private->splitView.vertical = YES;
|
||||
|
@ -221,4 +225,4 @@ void SetActive(content::WebContents* web_contents, bool active) {
|
|||
@end
|
||||
|
||||
@implementation BRYInspectableWebContentsViewPrivate
|
||||
@end
|
||||
@end
|
||||
|
|
|
@ -8,6 +8,7 @@ class InspectableWebContentsViewMac;
|
|||
|
||||
- (instancetype)initWithInspectableWebContentsViewMac:(brightray::InspectableWebContentsViewMac *)inspectableWebContentsView;
|
||||
- (void)setDevToolsVisible:(BOOL)visible;
|
||||
- (BOOL)isDevToolsVisible;
|
||||
- (BOOL)setDockSide:(const std::string&)side;
|
||||
|
||||
@end
|
||||
@end
|
||||
|
|
|
@ -57,6 +57,10 @@ void InspectableWebContentsViewWin::CloseDevTools() {
|
|||
SendMessage(devtools_window_->hwnd(), WM_CLOSE, 0, 0);
|
||||
}
|
||||
|
||||
bool InspectableWebContentsViewWin::IsDevToolsOpened() {
|
||||
return devtools_window_;
|
||||
}
|
||||
|
||||
bool InspectableWebContentsViewWin::SetDockSide(const std::string& side) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ class InspectableWebContentsViewWin : public InspectableWebContentsView {
|
|||
virtual gfx::NativeView GetNativeView() const OVERRIDE;
|
||||
virtual void ShowDevTools() OVERRIDE;
|
||||
virtual void CloseDevTools() OVERRIDE;
|
||||
virtual bool IsDevToolsOpened() OVERRIDE;
|
||||
virtual bool SetDockSide(const std::string& side) OVERRIDE;
|
||||
|
||||
InspectableWebContentsImpl* inspectable_web_contents() {
|
||||
|
|
Loading…
Add table
Reference in a new issue