WebContents::WebContents(content::WebContents* web_contents)
: content::WebContentsObserver(web_contents),
- type_(REMOTE),
- inspectable_web_contents_(nullptr) {
+ type_(REMOTE) {
AttachAsUserData(web_contents);
}
Observe(web_contents);
AttachAsUserData(web_contents);
InitWithWebContents(web_contents);
- inspectable_web_contents_ = managed_web_contents();
if (is_guest) {
guest_delegate_->Initialize(this);
mate::Dictionary options;
args->GetNext(&options) && options.Get("detach", &detach);
}
- inspectable_web_contents()->SetCanDock(!detach);
- inspectable_web_contents()->ShowDevTools();
+ managed_web_contents()->SetCanDock(!detach);
+ managed_web_contents()->ShowDevTools();
}
void WebContents::CloseDevTools() {
if (type_ == REMOTE)
return;
- inspectable_web_contents()->CloseDevTools();
+ managed_web_contents()->CloseDevTools();
}
bool WebContents::IsDevToolsOpened() {
if (type_ == REMOTE)
return false;
- return inspectable_web_contents()->IsDevToolsViewShowing();
+
+ return managed_web_contents()->IsDevToolsViewShowing();
}
void WebContents::ToggleDevTools() {
if (agent_host->GetType() ==
content::DevToolsAgentHost::TYPE_SERVICE_WORKER) {
OpenDevTools(nullptr);
- inspectable_web_contents()->AttachTo(agent_host);
+ managed_web_contents()->AttachTo(agent_host);
break;
}
}
void SetAllowTransparency(bool allow);
bool IsGuest() const;
- // Returns the current InspectableWebContents object, nullptr will be returned
- // if current WebContents can not beinspected, e.g. it is the devtools.
- brightray::InspectableWebContents* inspectable_web_contents() const {
- return inspectable_web_contents_;
- }
-
protected:
explicit WebContents(content::WebContents* web_contents);
explicit WebContents(const mate::Dictionary& options);
// The type of current WebContents.
Type type_;
- // Current InspectableWebContents object, can be nullptr for WebContents of
- // devtools. It is a weak reference.
- brightray::InspectableWebContents* inspectable_web_contents_;
-
DISALLOW_COPY_AND_ASSIGN(WebContents);
};