Merge pull request #5580 from electron/annoymous-web-contents
Add support for anonymous WebContents
This commit is contained in:
commit
49cca0978d
13 changed files with 120 additions and 86 deletions
|
@ -274,7 +274,7 @@ WebContents::WebContents(v8::Isolate* isolate,
|
||||||
}
|
}
|
||||||
|
|
||||||
Observe(web_contents);
|
Observe(web_contents);
|
||||||
InitWithWebContents(web_contents);
|
InitWithWebContents(web_contents, session->browser_context());
|
||||||
|
|
||||||
managed_web_contents()->GetView()->SetDelegate(this);
|
managed_web_contents()->GetView()->SetDelegate(this);
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ void WebContents::MoveContents(content::WebContents* source,
|
||||||
|
|
||||||
void WebContents::CloseContents(content::WebContents* source) {
|
void WebContents::CloseContents(content::WebContents* source) {
|
||||||
Emit("close");
|
Emit("close");
|
||||||
if (type_ == BROWSER_WINDOW)
|
if (type_ == BROWSER_WINDOW && owner_window())
|
||||||
owner_window()->CloseContents(source);
|
owner_window()->CloseContents(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,14 +394,12 @@ bool WebContents::IsPopupOrPanel(const content::WebContents* source) const {
|
||||||
void WebContents::HandleKeyboardEvent(
|
void WebContents::HandleKeyboardEvent(
|
||||||
content::WebContents* source,
|
content::WebContents* source,
|
||||||
const content::NativeWebKeyboardEvent& event) {
|
const content::NativeWebKeyboardEvent& event) {
|
||||||
if (event.windowsKeyCode == ui::VKEY_ESCAPE && is_html_fullscreen()) {
|
if (type_ == WEB_VIEW && embedder_) {
|
||||||
// Escape exits tabbed fullscreen mode.
|
|
||||||
ExitFullscreenModeForTab(source);
|
|
||||||
} else if (type_ == BROWSER_WINDOW) {
|
|
||||||
owner_window()->HandleKeyboardEvent(source, event);
|
|
||||||
} else if (type_ == WEB_VIEW && guest_delegate_) {
|
|
||||||
// Send the unhandled keyboard events back to the embedder.
|
// Send the unhandled keyboard events back to the embedder.
|
||||||
guest_delegate_->HandleKeyboardEvent(source, event);
|
embedder_->HandleKeyboardEvent(source, event);
|
||||||
|
} else {
|
||||||
|
// Go to the default keyboard handling.
|
||||||
|
CommonWebContentsDelegate::HandleKeyboardEvent(source, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,13 +428,13 @@ void WebContents::ExitFullscreenModeForTab(content::WebContents* source) {
|
||||||
|
|
||||||
void WebContents::RendererUnresponsive(content::WebContents* source) {
|
void WebContents::RendererUnresponsive(content::WebContents* source) {
|
||||||
Emit("unresponsive");
|
Emit("unresponsive");
|
||||||
if (type_ == BROWSER_WINDOW)
|
if (type_ == BROWSER_WINDOW && owner_window())
|
||||||
owner_window()->RendererUnresponsive(source);
|
owner_window()->RendererUnresponsive(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::RendererResponsive(content::WebContents* source) {
|
void WebContents::RendererResponsive(content::WebContents* source) {
|
||||||
Emit("responsive");
|
Emit("responsive");
|
||||||
if (type_ == BROWSER_WINDOW)
|
if (type_ == BROWSER_WINDOW && owner_window())
|
||||||
owner_window()->RendererResponsive(source);
|
owner_window()->RendererResponsive(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -866,7 +864,7 @@ void WebContents::OpenDevTools(mate::Arguments* args) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::string state;
|
std::string state;
|
||||||
if (type_ == WEB_VIEW) {
|
if (type_ == WEB_VIEW || !owner_window()) {
|
||||||
state = "detach";
|
state = "detach";
|
||||||
} else if (args && args->Length() == 1) {
|
} else if (args && args->Length() == 1) {
|
||||||
bool detach = false;
|
bool detach = false;
|
||||||
|
@ -1174,6 +1172,10 @@ v8::Local<v8::Value> WebContents::GetOwnerBrowserWindow() {
|
||||||
return v8::Null(isolate());
|
return v8::Null(isolate());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t WebContents::ID() const {
|
||||||
|
return weak_map_id();
|
||||||
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> WebContents::Session(v8::Isolate* isolate) {
|
v8::Local<v8::Value> WebContents::Session(v8::Isolate* isolate) {
|
||||||
return v8::Local<v8::Value>::New(isolate, session_);
|
return v8::Local<v8::Value>::New(isolate, session_);
|
||||||
}
|
}
|
||||||
|
@ -1266,6 +1268,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
|
||||||
.SetMethod("_printToPDF", &WebContents::PrintToPDF)
|
.SetMethod("_printToPDF", &WebContents::PrintToPDF)
|
||||||
.SetMethod("addWorkSpace", &WebContents::AddWorkSpace)
|
.SetMethod("addWorkSpace", &WebContents::AddWorkSpace)
|
||||||
.SetMethod("removeWorkSpace", &WebContents::RemoveWorkSpace)
|
.SetMethod("removeWorkSpace", &WebContents::RemoveWorkSpace)
|
||||||
|
.SetProperty("id", &WebContents::ID)
|
||||||
.SetProperty("session", &WebContents::Session)
|
.SetProperty("session", &WebContents::Session)
|
||||||
.SetProperty("hostWebContents", &WebContents::HostWebContents)
|
.SetProperty("hostWebContents", &WebContents::HostWebContents)
|
||||||
.SetProperty("devToolsWebContents", &WebContents::DevToolsWebContents)
|
.SetProperty("devToolsWebContents", &WebContents::DevToolsWebContents)
|
||||||
|
|
|
@ -154,6 +154,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
v8::Local<v8::Value> GetOwnerBrowserWindow();
|
v8::Local<v8::Value> GetOwnerBrowserWindow();
|
||||||
|
|
||||||
// Properties.
|
// Properties.
|
||||||
|
int32_t ID() const;
|
||||||
v8::Local<v8::Value> Session(v8::Isolate* isolate);
|
v8::Local<v8::Value> Session(v8::Isolate* isolate);
|
||||||
content::WebContents* HostWebContents();
|
content::WebContents* HostWebContents();
|
||||||
v8::Local<v8::Value> DevToolsWebContents(v8::Isolate* isolate);
|
v8::Local<v8::Value> DevToolsWebContents(v8::Isolate* isolate);
|
||||||
|
|
|
@ -31,14 +31,6 @@
|
||||||
#include "content/public/browser/security_style_explanations.h"
|
#include "content/public/browser/security_style_explanations.h"
|
||||||
#include "storage/browser/fileapi/isolated_context.h"
|
#include "storage/browser/fileapi/isolated_context.h"
|
||||||
|
|
||||||
#if defined(TOOLKIT_VIEWS)
|
|
||||||
#include "atom/browser/native_window_views.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(USE_X11)
|
|
||||||
#include "atom/browser/browser.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using content::BrowserThread;
|
using content::BrowserThread;
|
||||||
using security_state::SecurityStateModel;
|
using security_state::SecurityStateModel;
|
||||||
|
|
||||||
|
@ -182,7 +174,9 @@ CommonWebContentsDelegate::~CommonWebContentsDelegate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonWebContentsDelegate::InitWithWebContents(
|
void CommonWebContentsDelegate::InitWithWebContents(
|
||||||
content::WebContents* web_contents) {
|
content::WebContents* web_contents,
|
||||||
|
AtomBrowserContext* browser_context) {
|
||||||
|
browser_context_ = browser_context;
|
||||||
web_contents->SetDelegate(this);
|
web_contents->SetDelegate(this);
|
||||||
|
|
||||||
printing::PrintViewManagerBasic::CreateForWebContents(web_contents);
|
printing::PrintViewManagerBasic::CreateForWebContents(web_contents);
|
||||||
|
@ -628,23 +622,6 @@ void CommonWebContentsDelegate::OnDevToolsSearchCompleted(
|
||||||
&file_paths_value);
|
&file_paths_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(TOOLKIT_VIEWS)
|
|
||||||
gfx::ImageSkia CommonWebContentsDelegate::GetDevToolsWindowIcon() {
|
|
||||||
if (!owner_window())
|
|
||||||
return gfx::ImageSkia();
|
|
||||||
return static_cast<views::WidgetDelegate*>(static_cast<NativeWindowViews*>(
|
|
||||||
owner_window()))->GetWindowAppIcon();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(USE_X11)
|
|
||||||
void CommonWebContentsDelegate::GetDevToolsWindowWMClass(
|
|
||||||
std::string* name, std::string* class_name) {
|
|
||||||
*class_name = Browser::Get()->GetName();
|
|
||||||
*name = base::ToLowerASCII(*class_name);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void CommonWebContentsDelegate::SetHtmlApiFullscreen(bool enter_fullscreen) {
|
void CommonWebContentsDelegate::SetHtmlApiFullscreen(bool enter_fullscreen) {
|
||||||
// Window is already in fullscreen mode, save the state.
|
// Window is already in fullscreen mode, save the state.
|
||||||
if (enter_fullscreen && owner_window_->IsFullscreen()) {
|
if (enter_fullscreen && owner_window_->IsFullscreen()) {
|
||||||
|
|
|
@ -19,6 +19,7 @@ using brightray::DevToolsFileSystemIndexer;
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
class AtomBrowserContext;
|
||||||
class AtomJavaScriptDialogManager;
|
class AtomJavaScriptDialogManager;
|
||||||
class NativeWindow;
|
class NativeWindow;
|
||||||
class WebDialogHelper;
|
class WebDialogHelper;
|
||||||
|
@ -33,7 +34,8 @@ class CommonWebContentsDelegate
|
||||||
|
|
||||||
// Creates a InspectableWebContents object and takes onwership of
|
// Creates a InspectableWebContents object and takes onwership of
|
||||||
// |web_contents|.
|
// |web_contents|.
|
||||||
void InitWithWebContents(content::WebContents* web_contents);
|
void InitWithWebContents(content::WebContents* web_contents,
|
||||||
|
AtomBrowserContext* browser_context);
|
||||||
|
|
||||||
// Set the window as owner window.
|
// Set the window as owner window.
|
||||||
void SetOwnerWindow(NativeWindow* owner_window);
|
void SetOwnerWindow(NativeWindow* owner_window);
|
||||||
|
@ -82,6 +84,9 @@ class CommonWebContentsDelegate
|
||||||
content::SecurityStyle GetSecurityStyle(
|
content::SecurityStyle GetSecurityStyle(
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
content::SecurityStyleExplanations* explanations) override;
|
content::SecurityStyleExplanations* explanations) override;
|
||||||
|
void HandleKeyboardEvent(
|
||||||
|
content::WebContents* source,
|
||||||
|
const content::NativeWebKeyboardEvent& event) override;
|
||||||
|
|
||||||
// brightray::InspectableWebContentsDelegate:
|
// brightray::InspectableWebContentsDelegate:
|
||||||
void DevToolsSaveToFile(const std::string& url,
|
void DevToolsSaveToFile(const std::string& url,
|
||||||
|
@ -145,6 +150,9 @@ class CommonWebContentsDelegate
|
||||||
scoped_ptr<AtomJavaScriptDialogManager> dialog_manager_;
|
scoped_ptr<AtomJavaScriptDialogManager> dialog_manager_;
|
||||||
scoped_refptr<DevToolsFileSystemIndexer> devtools_file_system_indexer_;
|
scoped_refptr<DevToolsFileSystemIndexer> devtools_file_system_indexer_;
|
||||||
|
|
||||||
|
// Make sure BrowserContext is alwasys destroyed after WebContents.
|
||||||
|
scoped_refptr<AtomBrowserContext> browser_context_;
|
||||||
|
|
||||||
// The stored InspectableWebContents object.
|
// The stored InspectableWebContents object.
|
||||||
// Notice that web_contents_ must be placed after dialog_manager_, so we can
|
// Notice that web_contents_ must be placed after dialog_manager_, so we can
|
||||||
// make sure web_contents_ is destroyed before dialog_manager_, otherwise a
|
// make sure web_contents_ is destroyed before dialog_manager_, otherwise a
|
||||||
|
|
39
atom/browser/common_web_contents_delegate_mac.mm
Normal file
39
atom/browser/common_web_contents_delegate_mac.mm
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
// Copyright (c) 2016 GitHub, Inc.
|
||||||
|
// Use of this source code is governed by the MIT license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "atom/browser/common_web_contents_delegate.h"
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
#include "content/public/browser/native_web_keyboard_event.h"
|
||||||
|
#include "ui/events/keycodes/keyboard_codes.h"
|
||||||
|
|
||||||
|
namespace atom {
|
||||||
|
|
||||||
|
void CommonWebContentsDelegate::HandleKeyboardEvent(
|
||||||
|
content::WebContents* source,
|
||||||
|
const content::NativeWebKeyboardEvent& event) {
|
||||||
|
if (event.skip_in_browser ||
|
||||||
|
event.type == content::NativeWebKeyboardEvent::Char)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Escape exits tabbed fullscreen mode.
|
||||||
|
if (event.windowsKeyCode == ui::VKEY_ESCAPE && is_html_fullscreen())
|
||||||
|
ExitFullscreenModeForTab(source);
|
||||||
|
|
||||||
|
BOOL handled = [[NSApp mainMenu] performKeyEquivalent:event.os_event];
|
||||||
|
if (!handled && event.os_event.window) {
|
||||||
|
// Handle the cmd+~ shortcut.
|
||||||
|
if ((event.os_event.modifierFlags & NSCommandKeyMask) /* cmd */ &&
|
||||||
|
(event.os_event.keyCode == 50 /* ~ */)) {
|
||||||
|
if (event.os_event.modifierFlags & NSShiftKeyMask) {
|
||||||
|
[NSApp sendAction:@selector(_cycleWindowsReversed:) to:nil from:nil];
|
||||||
|
} else {
|
||||||
|
[NSApp sendAction:@selector(_cycleWindows:) to:nil from:nil];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace atom
|
45
atom/browser/common_web_contents_delegate_views.cc
Normal file
45
atom/browser/common_web_contents_delegate_views.cc
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
// Copyright (c) 2016 GitHub, Inc.
|
||||||
|
// Use of this source code is governed by the MIT license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "atom/browser/common_web_contents_delegate.h"
|
||||||
|
|
||||||
|
#include "atom/browser/native_window_views.h"
|
||||||
|
#include "base/strings/string_util.h"
|
||||||
|
#include "content/public/browser/native_web_keyboard_event.h"
|
||||||
|
#include "ui/events/keycodes/keyboard_codes.h"
|
||||||
|
|
||||||
|
#if defined(USE_X11)
|
||||||
|
#include "atom/browser/browser.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace atom {
|
||||||
|
|
||||||
|
void CommonWebContentsDelegate::HandleKeyboardEvent(
|
||||||
|
content::WebContents* source,
|
||||||
|
const content::NativeWebKeyboardEvent& event) {
|
||||||
|
// Escape exits tabbed fullscreen mode.
|
||||||
|
if (event.windowsKeyCode == ui::VKEY_ESCAPE && is_html_fullscreen())
|
||||||
|
ExitFullscreenModeForTab(source);
|
||||||
|
|
||||||
|
// Let the NativeWindow handle other parts.
|
||||||
|
if (owner_window())
|
||||||
|
owner_window()->HandleKeyboardEvent(source, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
gfx::ImageSkia CommonWebContentsDelegate::GetDevToolsWindowIcon() {
|
||||||
|
if (!owner_window())
|
||||||
|
return gfx::ImageSkia();
|
||||||
|
return static_cast<views::WidgetDelegate*>(static_cast<NativeWindowViews*>(
|
||||||
|
owner_window()))->GetWindowAppIcon();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(USE_X11)
|
||||||
|
void CommonWebContentsDelegate::GetDevToolsWindowWMClass(
|
||||||
|
std::string* name, std::string* class_name) {
|
||||||
|
*class_name = Browser::Get()->GetName();
|
||||||
|
*name = base::ToLowerASCII(*class_name);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace atom
|
|
@ -100,11 +100,6 @@ class NativeWindowMac : public NativeWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// NativeWindow:
|
|
||||||
void HandleKeyboardEvent(
|
|
||||||
content::WebContents*,
|
|
||||||
const content::NativeWebKeyboardEvent&) override;
|
|
||||||
|
|
||||||
// Return a vector of non-draggable regions that fill a window of size
|
// Return a vector of non-draggable regions that fill a window of size
|
||||||
// |width| by |height|, but leave gaps where the window should be draggable.
|
// |width| by |height|, but leave gaps where the window should be draggable.
|
||||||
std::vector<gfx::Rect> CalculateNonDraggableRegions(
|
std::vector<gfx::Rect> CalculateNonDraggableRegions(
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include "brightray/browser/inspectable_web_contents.h"
|
#include "brightray/browser/inspectable_web_contents.h"
|
||||||
#include "brightray/browser/inspectable_web_contents_view.h"
|
#include "brightray/browser/inspectable_web_contents_view.h"
|
||||||
#include "content/public/browser/browser_accessibility_state.h"
|
#include "content/public/browser/browser_accessibility_state.h"
|
||||||
#include "content/public/browser/native_web_keyboard_event.h"
|
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "content/public/browser/render_view_host.h"
|
#include "content/public/browser/render_view_host.h"
|
||||||
#include "content/public/browser/render_widget_host_view.h"
|
#include "content/public/browser/render_widget_host_view.h"
|
||||||
|
@ -935,27 +934,6 @@ bool NativeWindowMac::IsVisibleOnAllWorkspaces() {
|
||||||
return collectionBehavior & NSWindowCollectionBehaviorCanJoinAllSpaces;
|
return collectionBehavior & NSWindowCollectionBehaviorCanJoinAllSpaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::HandleKeyboardEvent(
|
|
||||||
content::WebContents*,
|
|
||||||
const content::NativeWebKeyboardEvent& event) {
|
|
||||||
if (event.skip_in_browser ||
|
|
||||||
event.type == content::NativeWebKeyboardEvent::Char)
|
|
||||||
return;
|
|
||||||
|
|
||||||
BOOL handled = [[NSApp mainMenu] performKeyEquivalent:event.os_event];
|
|
||||||
if (!handled && event.os_event.window) {
|
|
||||||
// Handle the cmd+~ shortcut.
|
|
||||||
if ((event.os_event.modifierFlags & NSCommandKeyMask) /* cmd */ &&
|
|
||||||
(event.os_event.keyCode == 50 /* ~ */)) {
|
|
||||||
if (event.os_event.modifierFlags & NSShiftKeyMask) {
|
|
||||||
[NSApp sendAction:@selector(_cycleWindowsReversed:) to:nil from:nil];
|
|
||||||
} else {
|
|
||||||
[NSApp sendAction:@selector(_cycleWindows:) to:nil from:nil];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<gfx::Rect> NativeWindowMac::CalculateNonDraggableRegions(
|
std::vector<gfx::Rect> NativeWindowMac::CalculateNonDraggableRegions(
|
||||||
const std::vector<DraggableRegion>& regions, int width, int height) {
|
const std::vector<DraggableRegion>& regions, int width, int height) {
|
||||||
std::vector<gfx::Rect> result;
|
std::vector<gfx::Rect> result;
|
||||||
|
|
|
@ -95,13 +95,6 @@ void WebViewGuestDelegate::SetSize(const SetSizeParams& params) {
|
||||||
auto_size_enabled_ = enable_auto_size;
|
auto_size_enabled_ = enable_auto_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebViewGuestDelegate::HandleKeyboardEvent(
|
|
||||||
content::WebContents* source,
|
|
||||||
const content::NativeWebKeyboardEvent& event) {
|
|
||||||
if (embedder_web_contents_)
|
|
||||||
embedder_web_contents_->GetDelegate()->HandleKeyboardEvent(source, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebViewGuestDelegate::DidCommitProvisionalLoadForFrame(
|
void WebViewGuestDelegate::DidCommitProvisionalLoadForFrame(
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
const GURL& url, ui::PageTransition transition_type) {
|
const GURL& url, ui::PageTransition transition_type) {
|
||||||
|
|
|
@ -8,10 +8,6 @@
|
||||||
#include "content/public/browser/browser_plugin_guest_delegate.h"
|
#include "content/public/browser/browser_plugin_guest_delegate.h"
|
||||||
#include "content/public/browser/web_contents_observer.h"
|
#include "content/public/browser/web_contents_observer.h"
|
||||||
|
|
||||||
namespace content {
|
|
||||||
struct NativeWebKeyboardEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
namespace api {
|
namespace api {
|
||||||
|
@ -49,10 +45,6 @@ class WebViewGuestDelegate : public content::BrowserPluginGuestDelegate,
|
||||||
// and normal sizes.
|
// and normal sizes.
|
||||||
void SetSize(const SetSizeParams& params);
|
void SetSize(const SetSizeParams& params);
|
||||||
|
|
||||||
// Transfer the keyboard event to embedder.
|
|
||||||
void HandleKeyboardEvent(content::WebContents* source,
|
|
||||||
const content::NativeWebKeyboardEvent& event);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// content::WebContentsObserver:
|
// content::WebContentsObserver:
|
||||||
void DidCommitProvisionalLoadForFrame(
|
void DidCommitProvisionalLoadForFrame(
|
||||||
|
|
|
@ -913,6 +913,10 @@ win.webContents.on('did-finish-load', () => {
|
||||||
|
|
||||||
`WebContents` objects also have the following properties:
|
`WebContents` objects also have the following properties:
|
||||||
|
|
||||||
|
### `webContents.id`
|
||||||
|
|
||||||
|
The unique ID of this WebContents.
|
||||||
|
|
||||||
### `webContents.session`
|
### `webContents.session`
|
||||||
|
|
||||||
Returns the [session](session.md) object used by this webContents.
|
Returns the [session](session.md) object used by this webContents.
|
||||||
|
|
|
@ -171,6 +171,8 @@
|
||||||
'atom/browser/browser_mac.mm',
|
'atom/browser/browser_mac.mm',
|
||||||
'atom/browser/browser_win.cc',
|
'atom/browser/browser_win.cc',
|
||||||
'atom/browser/browser_observer.h',
|
'atom/browser/browser_observer.h',
|
||||||
|
'atom/browser/common_web_contents_delegate_mac.mm',
|
||||||
|
'atom/browser/common_web_contents_delegate_views.cc',
|
||||||
'atom/browser/common_web_contents_delegate.cc',
|
'atom/browser/common_web_contents_delegate.cc',
|
||||||
'atom/browser/common_web_contents_delegate.h',
|
'atom/browser/common_web_contents_delegate.h',
|
||||||
'atom/browser/javascript_environment.cc',
|
'atom/browser/javascript_environment.cc',
|
||||||
|
|
|
@ -250,16 +250,13 @@ ipcRenderer.on('ELECTRON_RENDERER_RELEASE_CALLBACK', function (event, id) {
|
||||||
const browserModules = require('../../browser/api/exports/electron')
|
const browserModules = require('../../browser/api/exports/electron')
|
||||||
|
|
||||||
// And add a helper receiver for each one.
|
// And add a helper receiver for each one.
|
||||||
var fn = function (name) {
|
for (let name of Object.getOwnPropertyNames(browserModules)) {
|
||||||
return Object.defineProperty(exports, name, {
|
Object.defineProperty(exports, name, {
|
||||||
get: function () {
|
get: function () {
|
||||||
return exports.getBuiltin(name)
|
return exports.getBuiltin(name)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
for (var name in browserModules) {
|
|
||||||
fn(name)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get remote module.
|
// Get remote module.
|
||||||
exports.require = function (module) {
|
exports.require = function (module) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue