Merge remote-tracking branch 'refs/remotes/atom/master'
This commit is contained in:
commit
78542ab54c
27 changed files with 304 additions and 149 deletions
|
@ -74,10 +74,26 @@ void Tray::OnBalloonClosed() {
|
|||
Emit("balloon-closed");
|
||||
}
|
||||
|
||||
void Tray::OnDrop() {
|
||||
Emit("drop");
|
||||
}
|
||||
|
||||
void Tray::OnDropFiles(const std::vector<std::string>& files) {
|
||||
Emit("drop-files", files);
|
||||
}
|
||||
|
||||
void Tray::OnDragEntered() {
|
||||
Emit("drag-enter");
|
||||
}
|
||||
|
||||
void Tray::OnDragExited() {
|
||||
Emit("drag-leave");
|
||||
}
|
||||
|
||||
void Tray::OnDragEnded() {
|
||||
Emit("drag-end");
|
||||
}
|
||||
|
||||
bool Tray::IsDestroyed() const {
|
||||
return !tray_icon_;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,11 @@ class Tray : public mate::TrackableObject<Tray>,
|
|||
void OnBalloonShow() override;
|
||||
void OnBalloonClicked() override;
|
||||
void OnBalloonClosed() override;
|
||||
void OnDrop() override;
|
||||
void OnDropFiles(const std::vector<std::string>& files) override;
|
||||
void OnDragEntered() override;
|
||||
void OnDragExited() override;
|
||||
void OnDragEnded() override;
|
||||
|
||||
// mate::Wrappable:
|
||||
bool IsDestroyed() const override;
|
||||
|
|
|
@ -269,9 +269,7 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|||
managed_web_contents()->GetView()->SetDelegate(this);
|
||||
|
||||
// Save the preferences in C++.
|
||||
base::DictionaryValue web_preferences;
|
||||
mate::ConvertFromV8(isolate, options.GetHandle(), &web_preferences);
|
||||
new WebContentsPreferences(web_contents, &web_preferences);
|
||||
new WebContentsPreferences(web_contents, options);
|
||||
|
||||
web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent());
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// found in the LICENSE file.
|
||||
|
||||
#include "atom/browser/api/atom_api_window.h"
|
||||
#include "atom/common/native_mate_converters/value_converter.h"
|
||||
|
||||
#include "atom/browser/api/atom_api_menu.h"
|
||||
#include "atom/browser/api/atom_api_web_contents.h"
|
||||
|
@ -60,7 +61,54 @@ void OnCapturePageDone(
|
|||
callback.Run(gfx::Image::CreateFrom1xBitmap(bitmap));
|
||||
}
|
||||
|
||||
// Converts min-width to minWidth, returns false if no conversion is needed.
|
||||
bool TranslateOldKey(const std::string& key, std::string* new_key) {
|
||||
if (key.find('-') == std::string::npos)
|
||||
return false;
|
||||
new_key->reserve(key.size());
|
||||
bool next_upper_case = false;
|
||||
for (char c : key) {
|
||||
if (c == '-') {
|
||||
next_upper_case = true;
|
||||
} else if (next_upper_case) {
|
||||
new_key->push_back(base::ToUpperASCII(c));
|
||||
next_upper_case = false;
|
||||
} else {
|
||||
new_key->push_back(c);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Converts min-width to minWidth recursively in the dictionary.
|
||||
void TranslateOldOptions(v8::Isolate* isolate, v8::Local<v8::Object> options) {
|
||||
auto context = isolate->GetCurrentContext();
|
||||
auto maybe_keys = options->GetOwnPropertyNames(context);
|
||||
if (maybe_keys.IsEmpty())
|
||||
return;
|
||||
std::vector<std::string> keys;
|
||||
if (!mate::ConvertFromV8(isolate, maybe_keys.ToLocalChecked(), &keys))
|
||||
return;
|
||||
mate::Dictionary dict(isolate, options);
|
||||
for (const auto& key : keys) {
|
||||
v8::Local<v8::Value> value;
|
||||
if (!dict.Get(key, &value)) // Shouldn't happen, but guard it anyway.
|
||||
continue;
|
||||
// Go recursively.
|
||||
v8::Local<v8::Object> sub_options;
|
||||
if (mate::ConvertFromV8(isolate, value, &sub_options))
|
||||
TranslateOldOptions(isolate, sub_options);
|
||||
// Translate key.
|
||||
std::string new_key;
|
||||
if (TranslateOldKey(key, &new_key)) {
|
||||
dict.Set(new_key, value);
|
||||
dict.Delete(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// Converts binary data to Buffer.
|
||||
v8::Local<v8::Value> ToBuffer(v8::Isolate* isolate, void* val, int size) {
|
||||
auto buffer = node::Buffer::New(isolate, static_cast<char*>(val), size);
|
||||
if (buffer.IsEmpty())
|
||||
|
@ -74,7 +122,10 @@ v8::Local<v8::Value> ToBuffer(v8::Isolate* isolate, void* val, int size) {
|
|||
|
||||
|
||||
Window::Window(v8::Isolate* isolate, const mate::Dictionary& options) {
|
||||
// Use options['web-preferences'] to create WebContents.
|
||||
// Be compatible with old style field names like min-width.
|
||||
TranslateOldOptions(isolate, options.GetHandle());
|
||||
|
||||
// Use options.webPreferences to create WebContents.
|
||||
mate::Dictionary web_preferences = mate::Dictionary::CreateEmpty(isolate);
|
||||
options.Get(switches::kWebPreferences, &web_preferences);
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ app.on('ready', function() {
|
|||
mainWindow = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
'auto-hide-menu-bar': true,
|
||||
'use-content-size': true,
|
||||
autoHideMenuBar: true,
|
||||
useContentSize: true,
|
||||
});
|
||||
mainWindow.loadUrl('file://' + __dirname + '/index.html');
|
||||
mainWindow.focus();
|
||||
|
|
|
@ -118,11 +118,11 @@ attachGuest = (embedder, elementInstanceId, guestInstanceId, params) ->
|
|||
destroyGuest embedder, oldGuestInstanceId
|
||||
|
||||
webPreferences =
|
||||
'guest-instance-id': guestInstanceId
|
||||
'node-integration': params.nodeintegration ? false
|
||||
'plugins': params.plugins
|
||||
'web-security': !params.disablewebsecurity
|
||||
webPreferences['preload-url'] = params.preload if params.preload
|
||||
guestInstanceId: guestInstanceId
|
||||
nodeIntegration: params.nodeintegration ? false
|
||||
plugins: params.plugins
|
||||
webSecurity: !params.disablewebsecurity
|
||||
webPreferences.preloadUrl = params.preload if params.preload
|
||||
webViewManager.addGuest guestInstanceId, elementInstanceId, embedder, guest, webPreferences
|
||||
|
||||
guest.attachParams = params
|
||||
|
|
|
@ -4,15 +4,24 @@ BrowserWindow = require 'browser-window'
|
|||
|
||||
frameToGuest = {}
|
||||
|
||||
# Copy attribute of |parent| to |child| if it is not defined in |child|.
|
||||
mergeOptions = (child, parent) ->
|
||||
for own key, value of parent when key not in child
|
||||
if typeof value is 'object'
|
||||
child[key] = mergeOptions {}, value
|
||||
else
|
||||
child[key] = value
|
||||
child
|
||||
|
||||
# Merge |options| with the |embedder|'s window's options.
|
||||
mergeBrowserWindowOptions = (embedder, options) ->
|
||||
if embedder.browserWindowOptions?
|
||||
# Inherit the original options if it is a BrowserWindow.
|
||||
options.__proto__ = embedder.browserWindowOptions
|
||||
mergeOptions options, embedder.browserWindowOptions
|
||||
else
|
||||
# Or only inherit web-preferences if it is a webview.
|
||||
options['web-preferences'] ?= {}
|
||||
options['web-preferences'].__proto__ = embedder.getWebPreferences()
|
||||
options.webPreferences ?= {}
|
||||
mergeOptions options.webPreferences, embedder.getWebPreferences()
|
||||
options
|
||||
|
||||
# Create a new guest created by |embedder| with |options|.
|
||||
|
|
|
@ -55,8 +55,24 @@ void TrayIcon::NotifyRightClicked(const gfx::Rect& bounds, int modifiers) {
|
|||
OnRightClicked(bounds, modifiers));
|
||||
}
|
||||
|
||||
void TrayIcon::NotifyDrop() {
|
||||
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnDrop());
|
||||
}
|
||||
|
||||
void TrayIcon::NotifyDropFiles(const std::vector<std::string>& files) {
|
||||
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnDropFiles(files));
|
||||
}
|
||||
|
||||
void TrayIcon::NotifyDragEntered() {
|
||||
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnDragEntered());
|
||||
}
|
||||
|
||||
void TrayIcon::NotifyDragExited() {
|
||||
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnDragExited());
|
||||
}
|
||||
|
||||
void TrayIcon::NotifyDragEnded() {
|
||||
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnDragEnded());
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
|
@ -61,7 +61,11 @@ class TrayIcon {
|
|||
void NotifyBalloonClosed();
|
||||
void NotifyRightClicked(const gfx::Rect& bounds = gfx::Rect(),
|
||||
int modifiers = 0);
|
||||
void NotifyDrop();
|
||||
void NotifyDropFiles(const std::vector<std::string>& files);
|
||||
void NotifyDragEntered();
|
||||
void NotifyDragExited();
|
||||
void NotifyDragEnded();
|
||||
|
||||
protected:
|
||||
TrayIcon();
|
||||
|
|
|
@ -254,9 +254,23 @@ const CGFloat kVerticalTitleMargin = 2;
|
|||
}
|
||||
|
||||
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender {
|
||||
trayIcon_->NotifyDragEntered();
|
||||
return NSDragOperationCopy;
|
||||
}
|
||||
|
||||
- (void)draggingExited:(id <NSDraggingInfo>)sender {
|
||||
trayIcon_->NotifyDragExited();
|
||||
}
|
||||
|
||||
- (void)draggingEnded:(id <NSDraggingInfo>)sender {
|
||||
trayIcon_->NotifyDragEnded();
|
||||
}
|
||||
|
||||
- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender {
|
||||
trayIcon_->NotifyDrop();
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
|
||||
NSPasteboard* pboard = [sender draggingPasteboard];
|
||||
|
||||
|
|
|
@ -22,7 +22,11 @@ class TrayIconObserver {
|
|||
virtual void OnBalloonClicked() {}
|
||||
virtual void OnBalloonClosed() {}
|
||||
virtual void OnRightClicked(const gfx::Rect& bounds, int modifiers) {}
|
||||
virtual void OnDrop() {}
|
||||
virtual void OnDropFiles(const std::vector<std::string>& files) {}
|
||||
virtual void OnDragEntered() {}
|
||||
virtual void OnDragExited() {}
|
||||
virtual void OnDragEnded() {}
|
||||
|
||||
protected:
|
||||
virtual ~TrayIconObserver() {}
|
||||
|
|
|
@ -6,10 +6,12 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "atom/common/native_mate_converters/value_converter.h"
|
||||
#include "atom/common/options_switches.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "content/public/common/web_preferences.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "net/base/filename_util.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
|
@ -36,12 +38,16 @@ const char* kWebRuntimeFeatures[] = {
|
|||
|
||||
WebContentsPreferences::WebContentsPreferences(
|
||||
content::WebContents* web_contents,
|
||||
base::DictionaryValue* web_preferences) {
|
||||
web_preferences_.Swap(web_preferences);
|
||||
web_contents->SetUserData(UserDataKey(), this);
|
||||
const mate::Dictionary& web_preferences) {
|
||||
v8::Isolate* isolate = web_preferences.isolate();
|
||||
mate::Dictionary copied(isolate, web_preferences.GetHandle()->Clone());
|
||||
// Following fields should not be stored.
|
||||
copied.Delete("embedder");
|
||||
copied.Delete("isGuest");
|
||||
copied.Delete("session");
|
||||
|
||||
// The "isGuest" is not a preferences field.
|
||||
web_preferences_.Remove("isGuest", nullptr);
|
||||
mate::ConvertFromV8(isolate, copied.GetHandle(), &web_preferences_);
|
||||
web_contents->SetUserData(UserDataKey(), this);
|
||||
}
|
||||
|
||||
WebContentsPreferences::~WebContentsPreferences() {
|
||||
|
@ -135,21 +141,21 @@ void WebContentsPreferences::OverrideWebkitPrefs(
|
|||
prefs->images_enabled = b;
|
||||
if (self->web_preferences_.GetBoolean("java", &b))
|
||||
prefs->java_enabled = b;
|
||||
if (self->web_preferences_.GetBoolean("text-areas-are-resizable", &b))
|
||||
if (self->web_preferences_.GetBoolean("textAreasAreResizable", &b))
|
||||
prefs->text_areas_are_resizable = b;
|
||||
if (self->web_preferences_.GetBoolean("webgl", &b))
|
||||
prefs->experimental_webgl_enabled = b;
|
||||
if (self->web_preferences_.GetBoolean("webaudio", &b))
|
||||
prefs->webaudio_enabled = b;
|
||||
if (self->web_preferences_.GetBoolean("web-security", &b)) {
|
||||
if (self->web_preferences_.GetBoolean("webSecurity", &b)) {
|
||||
prefs->web_security_enabled = b;
|
||||
prefs->allow_displaying_insecure_content = !b;
|
||||
prefs->allow_running_insecure_content = !b;
|
||||
}
|
||||
if (self->web_preferences_.GetBoolean("allow-displaying-insecure-content",
|
||||
if (self->web_preferences_.GetBoolean("allowDisplayingInsecureContent",
|
||||
&b))
|
||||
prefs->allow_displaying_insecure_content = b;
|
||||
if (self->web_preferences_.GetBoolean("allow-running-insecure-content", &b))
|
||||
if (self->web_preferences_.GetBoolean("allowRunningInsecureContent", &b))
|
||||
prefs->allow_running_insecure_content = b;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,10 @@ namespace content {
|
|||
struct WebPreferences;
|
||||
}
|
||||
|
||||
namespace mate {
|
||||
class Dictionary;
|
||||
}
|
||||
|
||||
namespace atom {
|
||||
|
||||
// Stores and applies the preferences of WebContents.
|
||||
|
@ -31,7 +35,7 @@ class WebContentsPreferences
|
|||
content::WebContents* web_contents, content::WebPreferences* prefs);
|
||||
|
||||
WebContentsPreferences(content::WebContents* web_contents,
|
||||
base::DictionaryValue* web_preferences);
|
||||
const mate::Dictionary& web_preferences);
|
||||
~WebContentsPreferences() override;
|
||||
|
||||
// $.extend(|web_preferences_|, |new_web_preferences|).
|
||||
|
|
|
@ -17,51 +17,80 @@ const char kX[] = "x";
|
|||
const char kY[] = "y";
|
||||
const char kWidth[] = "width";
|
||||
const char kHeight[] = "height";
|
||||
const char kMinWidth[] = "min-width";
|
||||
const char kMinHeight[] = "min-height";
|
||||
const char kMaxWidth[] = "max-width";
|
||||
const char kMaxHeight[] = "max-height";
|
||||
const char kMinWidth[] = "minWidth";
|
||||
const char kMinHeight[] = "minHeight";
|
||||
const char kMaxWidth[] = "maxWidth";
|
||||
const char kMaxHeight[] = "maxHeight";
|
||||
const char kResizable[] = "resizable";
|
||||
const char kFullscreen[] = "fullscreen";
|
||||
|
||||
// Whether the window should show in taskbar.
|
||||
const char kSkipTaskbar[] = "skip-taskbar";
|
||||
const char kSkipTaskbar[] = "skipTaskbar";
|
||||
|
||||
// Start with the kiosk mode, see Opera's page for description:
|
||||
// http://www.opera.com/support/mastering/kiosk/
|
||||
const char kKiosk[] = "kiosk";
|
||||
|
||||
// Make windows stays on the top of all other windows.
|
||||
const char kAlwaysOnTop[] = "always-on-top";
|
||||
|
||||
const char kNodeIntegration[] = "node-integration";
|
||||
const char kAlwaysOnTop[] = "alwaysOnTop";
|
||||
|
||||
// Enable the NSView to accept first mouse event.
|
||||
const char kAcceptFirstMouse[] = "accept-first-mouse";
|
||||
const char kAcceptFirstMouse[] = "acceptFirstMouse";
|
||||
|
||||
// Whether window size should include window frame.
|
||||
const char kUseContentSize[] = "use-content-size";
|
||||
const char kUseContentSize[] = "useContentSize";
|
||||
|
||||
// The requested title bar style for the window
|
||||
const char kTitleBarStyle[] = "title-bar-style";
|
||||
|
||||
// The WebPreferences.
|
||||
const char kWebPreferences[] = "web-preferences";
|
||||
|
||||
// The factor of which page should be zoomed.
|
||||
const char kZoomFactor[] = "zoom-factor";
|
||||
const char kTitleBarStyle[] = "titleBarStyle";
|
||||
|
||||
// The menu bar is hidden unless "Alt" is pressed.
|
||||
const char kAutoHideMenuBar[] = "auto-hide-menu-bar";
|
||||
const char kAutoHideMenuBar[] = "autoHideMenuBar";
|
||||
|
||||
// Enable window to be resized larger than screen.
|
||||
const char kEnableLargerThanScreen[] = "enable-larger-than-screen";
|
||||
const char kEnableLargerThanScreen[] = "enableLargerThanScreen";
|
||||
|
||||
// Forces to use dark theme on Linux.
|
||||
const char kDarkTheme[] = "dark-theme";
|
||||
const char kDarkTheme[] = "darkTheme";
|
||||
|
||||
// Enable DirectWrite on Windows.
|
||||
const char kDirectWrite[] = "direct-write";
|
||||
// Whether the window should be transparent.
|
||||
const char kTransparent[] = "transparent";
|
||||
|
||||
// Window type hint.
|
||||
const char kType[] = "type";
|
||||
|
||||
// Disable auto-hiding cursor.
|
||||
const char kDisableAutoHideCursor[] = "disableAutoHideCursor";
|
||||
|
||||
// Use the OS X's standard window instead of the textured window.
|
||||
const char kStandardWindow[] = "standardWindow";
|
||||
|
||||
// Default browser window background color.
|
||||
const char kBackgroundColor[] = "backgroundColor";
|
||||
|
||||
// The WebPreferences.
|
||||
const char kWebPreferences[] = "webPreferences";
|
||||
|
||||
// The factor of which page should be zoomed.
|
||||
const char kZoomFactor[] = "zoomFactor";
|
||||
|
||||
// Script that will be loaded by guest WebContents before other scripts.
|
||||
const char kPreloadScript[] = "preload";
|
||||
|
||||
// Like --preload, but the passed argument is an URL.
|
||||
const char kPreloadUrl[] = "preloadUrl";
|
||||
|
||||
// Enable the node integration.
|
||||
const char kNodeIntegration[] = "nodeIntegration";
|
||||
|
||||
// Instancd ID of guest WebContents.
|
||||
const char kGuestInstanceID[] = "guestInstanceId";
|
||||
|
||||
// Web runtime features.
|
||||
const char kExperimentalFeatures[] = "experimentalFeatures";
|
||||
const char kExperimentalCanvasFeatures[] = "experimentalCanvasFeatures";
|
||||
const char kOverlayScrollbars[] = "overlayScrollbars";
|
||||
const char kOverlayFullscreenVideo[] = "overlayFullscreenVideo";
|
||||
const char kSharedWorker[] = "sharedWorker";
|
||||
|
||||
// Enable plugins.
|
||||
const char kEnablePlugins[] = "enable-plugins";
|
||||
|
@ -72,43 +101,15 @@ const char kPpapiFlashPath[] = "ppapi-flash-path";
|
|||
// Ppapi Flash version.
|
||||
const char kPpapiFlashVersion[] = "ppapi-flash-version";
|
||||
|
||||
// Instancd ID of guest WebContents.
|
||||
const char kGuestInstanceID[] = "guest-instance-id";
|
||||
// Set page visiblity to always visible.
|
||||
const char kPageVisibility[] = "page-visibility";
|
||||
|
||||
// Script that will be loaded by guest WebContents before other scripts.
|
||||
const char kPreloadScript[] = "preload";
|
||||
|
||||
// Like --preload, but the passed argument is an URL.
|
||||
const char kPreloadUrl[] = "preload-url";
|
||||
|
||||
// Whether the window should be transparent.
|
||||
const char kTransparent[] = "transparent";
|
||||
|
||||
// Window type hint.
|
||||
const char kType[] = "type";
|
||||
|
||||
// Disable auto-hiding cursor.
|
||||
const char kDisableAutoHideCursor[] = "disable-auto-hide-cursor";
|
||||
|
||||
// Use the OS X's standard window instead of the textured window.
|
||||
const char kStandardWindow[] = "standard-window";
|
||||
|
||||
// Default browser window background color.
|
||||
const char kBackgroundColor[] = "background-color";
|
||||
// Enable DirectWrite on Windows.
|
||||
const char kDirectWrite[] = "direct-write";
|
||||
|
||||
// Path to client certificate.
|
||||
const char kClientCertificate[] = "client-certificate";
|
||||
|
||||
// Web runtime features.
|
||||
const char kExperimentalFeatures[] = "experimental-features";
|
||||
const char kExperimentalCanvasFeatures[] = "experimental-canvas-features";
|
||||
const char kOverlayScrollbars[] = "overlay-scrollbars";
|
||||
const char kOverlayFullscreenVideo[] = "overlay-fullscreen-video";
|
||||
const char kSharedWorker[] = "shared-worker";
|
||||
|
||||
// Set page visiblity to always visible.
|
||||
const char kPageVisibility[] = "page-visibility";
|
||||
|
||||
// Disable HTTP cache.
|
||||
const char kDisableHttpCache[] = "disable-http-cache";
|
||||
|
||||
|
|
|
@ -27,41 +27,42 @@ extern const char kFullscreen[];
|
|||
extern const char kSkipTaskbar[];
|
||||
extern const char kKiosk[];
|
||||
extern const char kAlwaysOnTop[];
|
||||
extern const char kNodeIntegration[];
|
||||
extern const char kAcceptFirstMouse[];
|
||||
extern const char kUseContentSize[];
|
||||
extern const char kTitleBarStyle[];
|
||||
extern const char kWebPreferences[];
|
||||
extern const char kZoomFactor[];
|
||||
extern const char kAutoHideMenuBar[];
|
||||
extern const char kEnableLargerThanScreen[];
|
||||
extern const char kDarkTheme[];
|
||||
extern const char kDirectWrite[];
|
||||
extern const char kEnablePlugins[];
|
||||
extern const char kPpapiFlashPath[];
|
||||
extern const char kPpapiFlashVersion[];
|
||||
extern const char kGuestInstanceID[];
|
||||
extern const char kPreloadScript[];
|
||||
extern const char kPreloadUrl[];
|
||||
extern const char kTransparent[];
|
||||
extern const char kType[];
|
||||
extern const char kDisableAutoHideCursor[];
|
||||
extern const char kStandardWindow[];
|
||||
extern const char kBackgroundColor[];
|
||||
extern const char kClientCertificate[];
|
||||
extern const char kWebPreferences[];
|
||||
|
||||
// WebPreferences.
|
||||
extern const char kZoomFactor[];
|
||||
extern const char kPreloadScript[];
|
||||
extern const char kPreloadUrl[];
|
||||
extern const char kNodeIntegration[];
|
||||
extern const char kGuestInstanceID[];
|
||||
extern const char kExperimentalFeatures[];
|
||||
extern const char kExperimentalCanvasFeatures[];
|
||||
extern const char kOverlayScrollbars[];
|
||||
extern const char kOverlayFullscreenVideo[];
|
||||
extern const char kSharedWorker[];
|
||||
extern const char kPageVisibility[];
|
||||
extern const char kDirectWrite[];
|
||||
|
||||
// Following are actually command line switches, should be moved to other files.
|
||||
extern const char kEnablePlugins[];
|
||||
extern const char kPpapiFlashPath[];
|
||||
extern const char kPpapiFlashVersion[];
|
||||
extern const char kClientCertificate[];
|
||||
extern const char kDisableHttpCache[];
|
||||
extern const char kRegisterStandardSchemes[];
|
||||
extern const char kSSLVersionFallbackMin[];
|
||||
extern const char kCipherSuiteBlacklist[];
|
||||
|
||||
extern const char kAppUserModelId[];
|
||||
|
||||
} // namespace switches
|
||||
|
|
|
@ -25,10 +25,10 @@ v8Util.setHiddenValue global, 'ipc', new events.EventEmitter
|
|||
# Process command line arguments.
|
||||
nodeIntegration = 'false'
|
||||
for arg in process.argv
|
||||
if arg.indexOf('--guest-instance-id=') == 0
|
||||
if arg.indexOf('--guestInstanceId=') == 0
|
||||
# This is a guest web view.
|
||||
process.guestInstanceId = parseInt arg.substr(arg.indexOf('=') + 1)
|
||||
else if arg.indexOf('--node-integration=') == 0
|
||||
else if arg.indexOf('--nodeIntegration=') == 0
|
||||
nodeIntegration = arg.substr arg.indexOf('=') + 1
|
||||
else if arg.indexOf('--preload=') == 0
|
||||
preloadScript = arg.substr arg.indexOf('=') + 1
|
||||
|
|
|
@ -60,12 +60,6 @@ window.open = (url, frameName='', features='') ->
|
|||
|
||||
(options[name] = parseInt(options[name], 10) if options[name]?) for name in ints
|
||||
|
||||
# Inherit the node-integration option of current window.
|
||||
unless options['node-integration']?
|
||||
for arg in process.argv when arg.indexOf('--node-integration=') is 0
|
||||
options['node-integration'] = arg.substr(-4) is 'true'
|
||||
break
|
||||
|
||||
guestId = ipc.sendSync 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', url, frameName, options
|
||||
if guestId
|
||||
new BrowserWindowProxy(guestId)
|
||||
|
|
|
@ -33,20 +33,20 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
|||
* `height` Integer - Window's height.
|
||||
* `x` Integer - Window's left offset from screen.
|
||||
* `y` Integer - Window's top offset from screen.
|
||||
* `use-content-size` Boolean - The `width` and `height` would be used as web
|
||||
* `useContentSize` Boolean - The `width` and `height` would be used as web
|
||||
page's size, which means the actual window's size will include window
|
||||
frame's size and be slightly larger.
|
||||
* `center` Boolean - Show window in the center of the screen.
|
||||
* `min-width` Integer - Window's minimum width.
|
||||
* `min-height` Integer - Window's minimum height.
|
||||
* `max-width` Integer - Window's maximum width.
|
||||
* `max-height` Integer - Window's maximum height.
|
||||
* `minWidth` Integer - Window's minimum width.
|
||||
* `minHeight` Integer - Window's minimum height.
|
||||
* `maxWidth` Integer - Window's maximum width.
|
||||
* `maxHeight` Integer - Window's maximum height.
|
||||
* `resizable` Boolean - Whether window is resizable.
|
||||
* `always-on-top` Boolean - Whether the window should always stay on top of
|
||||
* `alwaysOnTop` Boolean - Whether the window should always stay on top of
|
||||
other windows.
|
||||
* `fullscreen` Boolean - Whether the window should show in fullscreen. When
|
||||
set to `false` the fullscreen button will be hidden or disabled on OS X.
|
||||
* `skip-taskbar` Boolean - Whether to show the window in taskbar.
|
||||
* `skipTaskbar` Boolean - Whether to show the window in taskbar.
|
||||
* `kiosk` Boolean - The kiosk mode.
|
||||
* `title` String - Default window title.
|
||||
* `icon` [NativeImage](native-image.md) - The window icon, when omitted on
|
||||
|
@ -54,24 +54,24 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
|||
* `show` Boolean - Whether window should be shown when created.
|
||||
* `frame` Boolean - Specify `false` to create a
|
||||
[Frameless Window](frameless-window.md).
|
||||
* `accept-first-mouse` Boolean - Whether the web view accepts a single
|
||||
* `acceptFirstMouse` Boolean - Whether the web view accepts a single
|
||||
mouse-down event that simultaneously activates the window.
|
||||
* `disable-auto-hide-cursor` Boolean - Whether to hide cursor when typing.
|
||||
* `auto-hide-menu-bar` Boolean - Auto hide the menu bar unless the `Alt`
|
||||
* `disableAutoHideCursor` Boolean - Whether to hide cursor when typing.
|
||||
* `autoHideMenuBar` Boolean - Auto hide the menu bar unless the `Alt`
|
||||
key is pressed.
|
||||
* `enable-larger-than-screen` Boolean - Enable the window to be resized larger
|
||||
* `enableLargerThanScreen` Boolean - Enable the window to be resized larger
|
||||
than screen.
|
||||
* `background-color` String - Window's background color as Hexadecimal value,
|
||||
* `backgroundColor` String - Window's background color as Hexadecimal value,
|
||||
like `#66CD00` or `#FFF`. This is only implemented on Linux and Windows.
|
||||
* `dark-theme` Boolean - Forces using dark theme for the window, only works on
|
||||
* `darkTheme` Boolean - Forces using dark theme for the window, only works on
|
||||
some GTK+3 desktop environments.
|
||||
* `transparent` Boolean - Makes the window [transparent](frameless-window.md).
|
||||
* `type` String - Specifies the type of the window, possible types are
|
||||
`desktop`, `dock`, `toolbar`, `splash`, `notification`. This only works on
|
||||
Linux.
|
||||
* `standard-window` Boolean - Uses the OS X's standard window instead of the
|
||||
* `standardWindow` Boolean - Uses the OS X's standard window instead of the
|
||||
textured window. Defaults to `true`.
|
||||
* `title-bar-style` String, OS X - specifies the style of window title bar.
|
||||
* `titleBarStyle` String, OS X - specifies the style of window title bar.
|
||||
This option is supported on OS X 10.10 Yosemite and newer. There are three
|
||||
possible values:
|
||||
* `default` or not specified results in the standard gray opaque Mac title
|
||||
|
@ -81,8 +81,8 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
|||
the top left.
|
||||
* `hidden-inset` results in a hidden title bar with an alternative look
|
||||
where the traffic light buttons are slightly more inset from the window edge.
|
||||
* `web-preferences` Object - Settings of web page's features, properties:
|
||||
* `node-integration` Boolean - Whether node integration is enabled. Default
|
||||
* `webPreferences` Object - Settings of web page's features, properties:
|
||||
* `nodeIntegration` Boolean - Whether node integration is enabled. Default
|
||||
is `true`.
|
||||
* `preload` String - Specifies a script that will be loaded before other
|
||||
scripts run in the page. This script will always have access to node APIs
|
||||
|
@ -94,31 +94,31 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
|||
prefix, the page will use an in-memory session. By assigning the same
|
||||
`partition`, multiple pages can share the same session. If the `partition`
|
||||
is unset then default session of the app will be used.
|
||||
* `zoom-factor` Number - The default zoom factor of the page, `3.0` represents
|
||||
* `zoomFactor` Number - The default zoom factor of the page, `3.0` represents
|
||||
`300%`.
|
||||
* `javascript` Boolean
|
||||
* `web-security` Boolean - When setting `false`, it will disable the
|
||||
* `webSecurity` Boolean - When setting `false`, it will disable the
|
||||
same-origin policy (Usually using testing websites by people), and set
|
||||
`allow_displaying_insecure_content` and `allow_running_insecure_content` to
|
||||
`allowDisplayingInsecureContent` and `allowRunningInsecureContent` to
|
||||
`true` if these two options are not set by user.
|
||||
* `allow-displaying-insecure-content` Boolean - Allow an https page to display
|
||||
* `allowDisplayingInsecureContent` Boolean - Allow an https page to display
|
||||
content like images from http URLs.
|
||||
* `allow-running-insecure-content` Boolean - Allow a https page to run
|
||||
* `allowRunningInsecureContent` Boolean - Allow a https page to run
|
||||
JavaScript, CSS or plugins from http URLs.
|
||||
* `images` Boolean
|
||||
* `java` Boolean
|
||||
* `text-areas-are-resizable` Boolean
|
||||
* `textAreasAreResizable` Boolean
|
||||
* `webgl` Boolean
|
||||
* `webaudio` Boolean
|
||||
* `plugins` Boolean - Whether plugins should be enabled.
|
||||
* `experimental-features` Boolean
|
||||
* `experimental-canvas-features` Boolean
|
||||
* `overlay-scrollbars` Boolean
|
||||
* `overlay-fullscreen-video` Boolean
|
||||
* `shared-worker` Boolean
|
||||
* `direct-write` Boolean - Whether the DirectWrite font rendering system on
|
||||
* `experimentalFeatures` Boolean
|
||||
* `experimentalCanvasFeatures` Boolean
|
||||
* `overlayScrollbars` Boolean
|
||||
* `overlayFullscreenVideo` Boolean
|
||||
* `sharedWorker` Boolean
|
||||
* `directWrite` Boolean - Whether the DirectWrite font rendering system on
|
||||
Windows is enabled.
|
||||
* `page-visibility` Boolean - Page would be forced to be always in visible
|
||||
* `pageVisibility` Boolean - Page would be forced to be always in visible
|
||||
or hidden state once set, instead of reflecting current window's
|
||||
visibility. Users can set it to `true` to prevent throttling of DOM
|
||||
timers.
|
||||
|
|
|
@ -33,8 +33,10 @@ Enables remote debugging over HTTP on the specified `port`.
|
|||
|
||||
## --proxy-server=`address:port`
|
||||
|
||||
Use a specified proxy server, which overrides the system setting. This switch only
|
||||
affects HTTP and HTTPS requests.
|
||||
Use a specified proxy server, which overrides the system setting. This switch
|
||||
only affects requests with HTTP protocol, including HTTPS and WebSocket
|
||||
requests. It is also noteworthy that not all proxy servers support HTTPS and
|
||||
WebSocket requests.
|
||||
|
||||
## --proxy-pac-url=`url`
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ a renderer will be emitted to this module.
|
|||
## Sending Messages
|
||||
|
||||
It is also possible to send messages from the main process to the renderer
|
||||
process, see [WebContents.send][webcontents-send] for more information.
|
||||
process, see [webContents.send][webcontents-send] for more information.
|
||||
|
||||
* When sending a message, the event name is the `channel`.
|
||||
* To reply a synchronous message, you need to set `event.returnValue`.
|
||||
|
@ -66,6 +66,6 @@ Set this to the value to be returned in a synchronous message.
|
|||
|
||||
Returns the `webContents` that sent the message, you can call
|
||||
`event.sender.send` to reply to the asynchronous message, see
|
||||
[WebContents.send][webcontents-send] for more information.
|
||||
[webContents.send][webcontents-send] for more information.
|
||||
|
||||
[webcontents-send]: web-contents.md#webcontentssendchannel-args
|
||||
|
|
|
@ -112,6 +112,10 @@ Emitted when the tray balloon is clicked.
|
|||
Emitted when the tray balloon is closed because of timeout or user manually
|
||||
closes it.
|
||||
|
||||
### Event: 'drop' _OS X_
|
||||
|
||||
Emitted when any dragged items are dropped on the tray icon.
|
||||
|
||||
### Event: 'drop-files' _OS X_
|
||||
|
||||
* `event`
|
||||
|
@ -119,6 +123,18 @@ closes it.
|
|||
|
||||
Emitted when dragged files are dropped in the tray icon.
|
||||
|
||||
### Event: 'drag-enter' _OS X_
|
||||
|
||||
Emitted when a drag operation enters the tray icon.
|
||||
|
||||
### Event: 'drag-leave' _OS X_
|
||||
|
||||
Emitted when a drag operation exits the tray icon.
|
||||
|
||||
### Event: 'drag-end' _OS X_
|
||||
|
||||
Emitted when a drag operation ends on the tray or ends at another location.
|
||||
|
||||
## Methods
|
||||
|
||||
The `Tray` module has the following methods:
|
||||
|
|
|
@ -46,9 +46,12 @@ var webdriver = require('selenium-webdriver');
|
|||
var driver = new webdriver.Builder()
|
||||
// The "9515" is the port opened by chrome driver.
|
||||
.usingServer('http://localhost:9515')
|
||||
.withCapabilities({chromeOptions: {
|
||||
.withCapabilities({
|
||||
chromeOptions: {
|
||||
// Here is the path to your Electron binary.
|
||||
binary: '/Path-to-Your-App.app/Contents/MacOS/Atom'}})
|
||||
binary: '/Path-to-Your-App.app/Contents/MacOS/Atom',
|
||||
}
|
||||
})
|
||||
.forBrowser('electron')
|
||||
.build();
|
||||
|
||||
|
@ -96,7 +99,10 @@ var options = {
|
|||
port: 9515, // "9515" is the port opened by chrome driver.
|
||||
desiredCapabilities: {
|
||||
browserName: 'chrome',
|
||||
chromeOptions: {binary: '/Path-to-Your-App.app/Electron'} // Path to your Electron binary.
|
||||
chromeOptions: {
|
||||
binary: '/Path-to-Your-App/electron', // Path to your Electron binary.
|
||||
args: [/* cli arguments */] // Optional, perhaps 'app=' + /path/to/your/app/
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -119,4 +125,8 @@ To test your application without rebuilding Electron, simply
|
|||
[place](https://github.com/atom/electron/blob/master/docs/tutorial/application-distribution.md)
|
||||
your app source into Electron's resource directory.
|
||||
|
||||
Alternatively, pass an argument to run with your electron binary that points to
|
||||
your app's folder. This eliminates the need to copy-paste your app into
|
||||
Electron's resource directory.
|
||||
|
||||
[chrome-driver]: https://sites.google.com/a/chromium.org/chromedriver/
|
||||
|
|
|
@ -138,10 +138,10 @@ describe 'browser-window module', ->
|
|||
w.setResizable not w.isResizable()
|
||||
assert.deepEqual s, w.getSize()
|
||||
|
||||
describe '"use-content-size" option', ->
|
||||
describe '"useContentSize" option', ->
|
||||
it 'make window created with content size when used', ->
|
||||
w.destroy()
|
||||
w = new BrowserWindow(show: false, width: 400, height: 400, 'use-content-size': true)
|
||||
w = new BrowserWindow(show: false, width: 400, height: 400, useContentSize: true)
|
||||
contentSize = w.getContentSize()
|
||||
assert.equal contentSize[0], 400
|
||||
assert.equal contentSize[1], 400
|
||||
|
@ -153,7 +153,7 @@ describe 'browser-window module', ->
|
|||
|
||||
it 'works for framless window', ->
|
||||
w.destroy()
|
||||
w = new BrowserWindow(show: false, frame: false, width: 400, height: 400, 'use-content-size': true)
|
||||
w = new BrowserWindow(show: false, frame: false, width: 400, height: 400, useContentSize: true)
|
||||
contentSize = w.getContentSize()
|
||||
assert.equal contentSize[0], 400
|
||||
assert.equal contentSize[1], 400
|
||||
|
@ -167,22 +167,22 @@ describe 'browser-window module', ->
|
|||
|
||||
it 'creates browser window with hidden title bar', ->
|
||||
w.destroy()
|
||||
w = new BrowserWindow(show: false, width: 400, height: 400, 'title-bar-style': 'hidden')
|
||||
w = new BrowserWindow(show: false, width: 400, height: 400, titleBarStyle: 'hidden')
|
||||
contentSize = w.getContentSize()
|
||||
assert.equal contentSize[1], 400
|
||||
|
||||
it 'creates browser window with hidden inset title bar', ->
|
||||
w.destroy()
|
||||
w = new BrowserWindow(show: false, width: 400, height: 400, 'title-bar-style': 'hidden-inset')
|
||||
w = new BrowserWindow(show: false, width: 400, height: 400, titleBarStyle: 'hidden-inset')
|
||||
contentSize = w.getContentSize()
|
||||
assert.equal contentSize[1], 400
|
||||
|
||||
describe '"enable-larger-than-screen" option', ->
|
||||
describe '"enableLargerThanScreen" option', ->
|
||||
return if process.platform is 'linux'
|
||||
|
||||
beforeEach ->
|
||||
w.destroy()
|
||||
w = new BrowserWindow(show: true, width: 400, height: 400, 'enable-larger-than-screen': true)
|
||||
w = new BrowserWindow(show: true, width: 400, height: 400, enableLargerThanScreen: true)
|
||||
|
||||
it 'can move the window out of screen', ->
|
||||
w.setPosition -10, -10
|
||||
|
@ -212,7 +212,7 @@ describe 'browser-window module', ->
|
|||
w.destroy()
|
||||
w = new BrowserWindow
|
||||
show: false
|
||||
'web-preferences':
|
||||
webPreferences:
|
||||
preload: preload
|
||||
w.loadUrl 'file://' + path.join(fixtures, 'api', 'preload.html')
|
||||
|
||||
|
@ -225,9 +225,9 @@ describe 'browser-window module', ->
|
|||
w.destroy()
|
||||
w = new BrowserWindow
|
||||
show: false
|
||||
'web-preferences':
|
||||
webPreferences:
|
||||
preload: preload
|
||||
'node-integration': false
|
||||
nodeIntegration: false
|
||||
w.loadUrl 'file://' + path.join(fixtures, 'api', 'blank.html')
|
||||
|
||||
describe 'beforeunload handler', ->
|
||||
|
|
|
@ -24,10 +24,15 @@ describe 'crash-reporter module', ->
|
|||
|
||||
it 'should send minidump when renderer crashes', (done) ->
|
||||
@timeout 120000
|
||||
called = false
|
||||
server = http.createServer (req, res) ->
|
||||
server.close()
|
||||
form = new multiparty.Form()
|
||||
form.parse req, (error, fields, files) ->
|
||||
# This callback can be called for twice sometimes.
|
||||
return if called
|
||||
called = true
|
||||
|
||||
assert.equal fields['prod'], 'Electron'
|
||||
assert.equal fields['ver'], process.versions['electron']
|
||||
assert.equal fields['process_type'], 'renderer'
|
||||
|
|
|
@ -70,7 +70,7 @@ describe 'chromium feature', ->
|
|||
b.close()
|
||||
done()
|
||||
window.addEventListener 'message', listener
|
||||
b = window.open "file://#{fixtures}/pages/window-opener-node.html", '', 'node-integration=no,show=no'
|
||||
b = window.open "file://#{fixtures}/pages/window-opener-node.html", '', 'nodeIntegration=no,show=no'
|
||||
|
||||
it 'inherit options of parent window', (done) ->
|
||||
listener = (event) ->
|
||||
|
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 4e069f1806efe5da9a965e61f329b19b7791104a
|
||||
Subproject commit 10ea3c5207dc18b3103aaf6e457193f8454becf1
|
2
vendor/native_mate
vendored
2
vendor/native_mate
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 21cda4e7fcff592f33f989c1fea575658281711d
|
||||
Subproject commit 93984941005bab194a2d47aff655d525c064efcb
|
Loading…
Add table
Reference in a new issue