Implement IsDevToolsOpened for Linux.

This commit is contained in:
Cheng Zhao 2013-12-08 23:11:29 -08:00
parent de7892cd6e
commit a8c5911094
2 changed files with 16 additions and 0 deletions

View file

@ -10,6 +10,17 @@
namespace brightray {
namespace {
bool IsWidgetAncestryVisible(GtkWidget* widget) {
GtkWidget* parent = widget;
while (parent && gtk_widget_get_visible(parent))
parent = gtk_widget_get_parent(parent);
return !parent;
}
}
InspectableWebContentsView* CreateInspectableContentsView(
InspectableWebContentsImpl* inspectable_web_contents) {
return new InspectableWebContentsViewLinux(inspectable_web_contents);
@ -155,6 +166,10 @@ void InspectableWebContentsViewLinux::CloseDevTools() {
}
}
bool InspectableWebContentsViewLinux::IsDevToolsOpened() {
return devtools_window_ && IsWidgetAncestryVisible(devtools_window_);
}
bool InspectableWebContentsViewLinux::SetDockSide(const std::string& side) {
DLOG(INFO) <<
"InspectableWebContentsViewLinux::SetDockSide: \"" << side << "\"";

View file

@ -18,6 +18,7 @@ class InspectableWebContentsViewLinux : 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() {