Merge branch 'master' into native-window-open

This commit is contained in:
Ryohei Ikegami 2017-04-04 20:54:37 +09:00
commit 61fa8693d2
105 changed files with 2439 additions and 907 deletions

View file

@ -7,7 +7,7 @@
#define ATOM_MAJOR_VERSION 1
#define ATOM_MINOR_VERSION 6
#define ATOM_PATCH_VERSION 4
#define ATOM_PATCH_VERSION 5
#define ATOM_VERSION_IS_RELEASE 1

View file

@ -179,7 +179,7 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
google_breakpad::ExceptionHandler::HANDLER_ALL,
kSmallDumpType,
pipe_name.c_str(),
GetCustomInfo(product_name, version, company_name)));
GetCustomInfo(product_name, version, company_name, upload_to_server)));
if (!breakpad_->IsOutOfProcess())
LOG(ERROR) << "Cannot initialize out-of-process crash handler";
@ -238,14 +238,19 @@ bool CrashReporterWin::MinidumpCallback(const wchar_t* dump_path,
google_breakpad::CustomClientInfo* CrashReporterWin::GetCustomInfo(
const std::string& product_name,
const std::string& version,
const std::string& company_name) {
const std::string& company_name,
bool upload_to_server) {
custom_info_entries_.clear();
custom_info_entries_.reserve(2 + upload_parameters_.size());
custom_info_entries_.reserve(3 + upload_parameters_.size());
custom_info_entries_.push_back(google_breakpad::CustomInfoEntry(
L"prod", L"Electron"));
custom_info_entries_.push_back(google_breakpad::CustomInfoEntry(
L"ver", base::UTF8ToWide(version).c_str()));
if (!upload_to_server) {
custom_info_entries_.push_back(google_breakpad::CustomInfoEntry(
L"skip_upload", L"1"));
}
for (StringMap::const_iterator iter = upload_parameters_.begin();
iter != upload_parameters_.end(); ++iter) {

View file

@ -56,7 +56,8 @@ class CrashReporterWin : public CrashReporter {
google_breakpad::CustomClientInfo* GetCustomInfo(
const std::string& product_name,
const std::string& version,
const std::string& company_name);
const std::string& company_name,
bool upload_to_server);
// Custom information to be passed to crash handler.
std::vector<google_breakpad::CustomInfoEntry> custom_info_entries_;

View file

@ -391,7 +391,7 @@ void CrashService::OnClientDumpRequest(void* context,
LOG(ERROR) << "could not write custom info file";
}
if (!self->sender_)
if (!self->sender_ || map.find(L"skip_upload") != map.end())
return;
// Send the crash dump using a worker thread. This operation has retry

View file

@ -168,11 +168,13 @@ v8::Local<v8::Value> Converter<content::PermissionType>::ToV8(
break;
}
if (val == (content::PermissionType)(PermissionType::POINTER_LOCK))
if (val == static_cast<content::PermissionType>(PermissionType::POINTER_LOCK))
return StringToV8(isolate, "pointerLock");
else if (val == (content::PermissionType)(PermissionType::FULLSCREEN))
else if (val ==
static_cast<content::PermissionType>(PermissionType::FULLSCREEN))
return StringToV8(isolate, "fullscreen");
else if (val == (content::PermissionType)(PermissionType::OPEN_EXTERNAL))
else if (val ==
static_cast<content::PermissionType>(PermissionType::OPEN_EXTERNAL))
return StringToV8(isolate, "openExternal");
return StringToV8(isolate, "unknown");

View file

@ -232,6 +232,12 @@ void NodeBindings::RunMessageLoop() {
void NodeBindings::UvRunOnce() {
node::Environment* env = uv_env();
// When doing navigation without restarting renderer process, it may happen
// that the node environment is destroyed but the message loop is still there.
// In this case we should not run uv loop.
if (!env)
return;
// Use Locker in browser process.
mate::Locker locker(env->isolate());
v8::HandleScope handle_scope(env->isolate());

View file

@ -51,6 +51,9 @@ const char kZoomToPageWidth[] = "zoomToPageWidth";
// The requested title bar style for the window
const char kTitleBarStyle[] = "titleBarStyle";
// Tabbing identifier for the window if native tabs are enabled on macOS.
const char kTabbingIdentifier[] = "tabbingIdentifier";
// The menu bar is hidden unless "Alt" is pressed.
const char kAutoHideMenuBar[] = "autoHideMenuBar";

View file

@ -36,6 +36,7 @@ extern const char kAcceptFirstMouse[];
extern const char kUseContentSize[];
extern const char kZoomToPageWidth[];
extern const char kTitleBarStyle[];
extern const char kTabbingIdentifier[];
extern const char kAutoHideMenuBar[];
extern const char kEnableLargerThanScreen[];
extern const char kDarkTheme[];

View file

@ -7,7 +7,9 @@
#include <stdio.h>
#include "base/cancelable_callback.h"
#include "base/environment.h"
#include "base/files/file_util.h"
#include "base/nix/xdg_util.h"
#include "base/process/kill.h"
#include "base/process/launch.h"
#include "url/gurl.h"
@ -100,7 +102,18 @@ bool MoveItemToTrash(const base::FilePath& full_path) {
if (getenv(ELECTRON_TRASH) != NULL) {
trash = getenv(ELECTRON_TRASH);
} else {
trash = ELECTRON_DEFAULT_TRASH;
// Determine desktop environment and set accordingly.
std::unique_ptr<base::Environment> env(base::Environment::Create());
base::nix::DesktopEnvironment desktop_env(
base::nix::GetDesktopEnvironment(env.get()));
if (desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE4 ||
desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE5) {
trash = "kioclient5";
} else if (desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE3) {
trash = "kioclient";
} else {
trash = ELECTRON_DEFAULT_TRASH;
}
}
std::vector<std::string> argv;

View file

@ -11,6 +11,7 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/mac/foundation_util.h"
#include "base/mac/mac_logging.h"
#include "base/mac/scoped_aedesc.h"
#include "base/strings/stringprintf.h"
@ -71,10 +72,10 @@ std::string MessageForOSStatus(OSStatus status, const char* default_message) {
// thread safe, including LSGetApplicationForURL (> 10.2) and
// NSWorkspace#openURLs.
std::string OpenURL(NSURL* ns_url, bool activate) {
CFURLRef openingApp = NULL;
OSStatus status = LSGetApplicationForURL((CFURLRef)ns_url,
CFURLRef openingApp = nullptr;
OSStatus status = LSGetApplicationForURL(base::mac::NSToCFCast(ns_url),
kLSRolesAll,
NULL,
nullptr,
&openingApp);
if (status != noErr)
return MessageForOSStatus(status, "Failed to open");
@ -156,7 +157,7 @@ bool OpenItem(const base::FilePath& full_path) {
// Create the list of files (only ever one) to open.
base::mac::ScopedAEDesc<AEDescList> fileList;
status = AECreateList(NULL, // factoringPtr
status = AECreateList(nullptr, // factoringPtr
0, // factoredSize
false, // isRecord
fileList.OutPointer()); // resultList
@ -167,7 +168,8 @@ bool OpenItem(const base::FilePath& full_path) {
// Add the single path to the file list. C-style cast to avoid both a
// static_cast and a const_cast to get across the toll-free bridge.
CFURLRef pathURLRef = (CFURLRef)[NSURL fileURLWithPath:path_string];
CFURLRef pathURLRef = base::mac::NSToCFCast(
[NSURL fileURLWithPath:path_string]);
FSRef pathRef;
if (CFURLGetFSRef(pathURLRef, &pathRef)) {
status = AEPutPtr(fileList.OutPointer(), // theAEDescList
@ -202,8 +204,8 @@ bool OpenItem(const base::FilePath& full_path) {
kAENoReply + kAEAlwaysInteract, // sendMode
kAENormalPriority, // sendPriority
kAEDefaultTimeout, // timeOutInTicks
NULL, // idleProc
NULL); // filterProc
nullptr, // idleProc
nullptr); // filterProc
if (status != noErr) {
OSSTATUS_LOG(WARNING, status)
<< "Could not send AE to Finder in OpenItem()";