Add type for WebContents
This commit is contained in:
parent
87f44c42df
commit
2532318bee
2 changed files with 13 additions and 1 deletions
|
@ -144,6 +144,7 @@ content::ServiceWorkerContext* GetServiceWorkerContext(
|
||||||
|
|
||||||
WebContents::WebContents(brightray::InspectableWebContents* web_contents)
|
WebContents::WebContents(brightray::InspectableWebContents* web_contents)
|
||||||
: WebContents(web_contents->GetWebContents()) {
|
: WebContents(web_contents->GetWebContents()) {
|
||||||
|
type_ = BROWSER_WINDOW;
|
||||||
inspectable_web_contents_ = web_contents;
|
inspectable_web_contents_ = web_contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,6 +155,7 @@ WebContents::WebContents(content::WebContents* web_contents)
|
||||||
guest_host_(nullptr),
|
guest_host_(nullptr),
|
||||||
auto_size_enabled_(false),
|
auto_size_enabled_(false),
|
||||||
is_full_page_plugin_(false),
|
is_full_page_plugin_(false),
|
||||||
|
type_(REMOTE),
|
||||||
inspectable_web_contents_(nullptr) {
|
inspectable_web_contents_(nullptr) {
|
||||||
AttachAsUserData(web_contents);
|
AttachAsUserData(web_contents);
|
||||||
}
|
}
|
||||||
|
@ -163,7 +165,8 @@ WebContents::WebContents(const mate::Dictionary& options)
|
||||||
guest_opaque_(true),
|
guest_opaque_(true),
|
||||||
guest_host_(nullptr),
|
guest_host_(nullptr),
|
||||||
auto_size_enabled_(false),
|
auto_size_enabled_(false),
|
||||||
is_full_page_plugin_(false) {
|
is_full_page_plugin_(false),
|
||||||
|
type_(WEB_VIEW) {
|
||||||
auto browser_context = AtomBrowserMainParts::Get()->browser_context();
|
auto browser_context = AtomBrowserMainParts::Get()->browser_context();
|
||||||
content::SiteInstance* site_instance = content::SiteInstance::CreateForURL(
|
content::SiteInstance* site_instance = content::SiteInstance::CreateForURL(
|
||||||
browser_context, GURL("chrome-guest://fake-host"));
|
browser_context, GURL("chrome-guest://fake-host"));
|
||||||
|
|
|
@ -220,6 +220,12 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
void OnGpuProcessCrashed(base::TerminationStatus exit_code) override;
|
void OnGpuProcessCrashed(base::TerminationStatus exit_code) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
enum Type {
|
||||||
|
BROWSER_WINDOW, // Used by BrowserWindow.
|
||||||
|
WEB_VIEW, // Used by <webview>.
|
||||||
|
REMOTE, // Thin wrap around an existing WebContents.
|
||||||
|
};
|
||||||
|
|
||||||
// Called when received a message from renderer.
|
// Called when received a message from renderer.
|
||||||
void OnRendererMessage(const base::string16& channel,
|
void OnRendererMessage(const base::string16& channel,
|
||||||
const base::ListValue& args);
|
const base::ListValue& args);
|
||||||
|
@ -273,6 +279,9 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
// Whether the guest view is inside a plugin document.
|
// Whether the guest view is inside a plugin document.
|
||||||
bool is_full_page_plugin_;
|
bool is_full_page_plugin_;
|
||||||
|
|
||||||
|
// The type of current WebContents.
|
||||||
|
Type type_;
|
||||||
|
|
||||||
// Current InspectableWebContents object, can be nullptr for WebContents of
|
// Current InspectableWebContents object, can be nullptr for WebContents of
|
||||||
// devtools. It is a weak reference.
|
// devtools. It is a weak reference.
|
||||||
brightray::InspectableWebContents* inspectable_web_contents_;
|
brightray::InspectableWebContents* inspectable_web_contents_;
|
||||||
|
|
Loading…
Reference in a new issue