electron/brightray/browser/inspectable_web_contents.h
Cheng Zhao 44b0245ac4 fix: use OOPIF for webview tag (#13869) (#14156)
* fix: use OOIF for webview tag

* fix: do not call GetNativeView for webview

* fix: OOIPF webview's WebContents is managed by embedder frame

* fix: guest view can not be focused

* fix: clear zoom controller when guest is destroyed

* fix: implement the webview resize event

The webview is no longer a browser plugin with the resize event, use
ResizeObserver instead.

* test: disable failed tests due to OOPIF webview

* fix: embedder can be destroyed earlier than guest

This happens when embedder is manually destroyed.

* fix: don't double attach

* fix: recreate iframe when webview is reattached

* fix: resize event may happen very early

* test: some tests are working after OOPIF webview

* chore: remove unused browser plugin webview code

* fix: get embedder via closure

When the "destroyed" event is emitted, the entry in guestInstances would be
cleared.

* chore: rename browserPluginNode to internalElement

* test: make the visibilityState test more robust

* chore: guestinstance can not work with OOPIF webview

* fix: element could be detached before got response from browser
2018-08-17 08:21:36 -07:00

56 lines
1.8 KiB
C++

#ifndef BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_H_
#define BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_H_
#include <string>
#include "content/public/browser/web_contents.h"
namespace base {
class Value;
}
namespace content {
class DevToolsAgentHost;
}
namespace brightray {
class InspectableWebContentsDelegate;
class InspectableWebContentsView;
class InspectableWebContents {
public:
// The returned InspectableWebContents takes ownership of the passed-in
// WebContents.
static InspectableWebContents* Create(content::WebContents* web_contents,
bool is_guest);
virtual ~InspectableWebContents() {}
virtual InspectableWebContentsView* GetView() const = 0;
virtual content::WebContents* GetWebContents() const = 0;
virtual content::WebContents* GetDevToolsWebContents() const = 0;
// The delegate manages its own life.
virtual void SetDelegate(InspectableWebContentsDelegate* delegate) = 0;
virtual InspectableWebContentsDelegate* GetDelegate() const = 0;
virtual bool IsGuest() const = 0;
virtual void ReleaseWebContents() = 0;
virtual void SetDevToolsWebContents(content::WebContents* devtools) = 0;
virtual void SetDockState(const std::string& state) = 0;
virtual void ShowDevTools() = 0;
virtual void CloseDevTools() = 0;
virtual bool IsDevToolsViewShowing() = 0;
virtual void AttachTo(scoped_refptr<content::DevToolsAgentHost>) = 0;
virtual void Detach() = 0;
virtual void CallClientFunction(const std::string& function_name,
const base::Value* arg1 = nullptr,
const base::Value* arg2 = nullptr,
const base::Value* arg3 = nullptr) = 0;
virtual void InspectElement(int x, int y) = 0;
};
} // namespace brightray
#endif // BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_H_