Merge branch 'master' into chrome44

This commit is contained in:
Cheng Zhao 2015-08-21 19:29:34 +08:00
commit 9212a1db8e
47 changed files with 885 additions and 2234 deletions

View file

@ -97,7 +97,7 @@ wrapWebContents = (webContents) ->
printingSetting.marginsType = options.marginsType
if options.printSelectionOnly
printingSetting.shouldPrintSelectionOnly = options.printSelectionOnly
if options.printBackgrounds
if options.printBackground
printingSetting.shouldPrintBackgrounds = options.printBackground
if options.pageSize and PDFPageSize[options.pageSize]

View file

@ -38,7 +38,7 @@ process.on 'uncaughtException', (error) ->
# Show error in GUI.
stack = error.stack ? "#{error.name}: #{error.message}"
message = "Uncaught Exception:\n#{stack}"
require('dialog').showErrorBox 'A JavaScript error occured in the main process', message
require('dialog').showErrorBox 'A JavaScript error occurred in the main process', message
# Emit 'exit' event on quit.
app = require 'app'

View file

@ -17,7 +17,7 @@
<key>CFBundleIconFile</key>
<string>atom.icns</string>
<key>CFBundleVersion</key>
<string>0.30.4</string>
<string>0.30.5</string>
<key>LSMinimumSystemVersion</key>
<string>10.8.0</string>
<key>NSMainNibFile</key>

View file

@ -56,8 +56,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,30,4,0
PRODUCTVERSION 0,30,4,0
FILEVERSION 0,30,5,0
PRODUCTVERSION 0,30,5,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -74,12 +74,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "GitHub, Inc."
VALUE "FileDescription", "Electron"
VALUE "FileVersion", "0.30.4"
VALUE "FileVersion", "0.30.5"
VALUE "InternalName", "electron.exe"
VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved."
VALUE "OriginalFilename", "electron.exe"
VALUE "ProductName", "Electron"
VALUE "ProductVersion", "0.30.4"
VALUE "ProductVersion", "0.30.5"
VALUE "SquirrelAwareVersion", "1"
END
END

View file

@ -39,6 +39,16 @@ NotifyIcon::NotifyIcon(NotifyIconHost* host,
base::MD5Sum(explicit_app_id,
sizeof(wchar_t) * wcslen(explicit_app_id),
reinterpret_cast<base::MD5Digest*>(&tray_app_id_hash_));
// Set the GUID to version 4 as described in RFC 4122, section 4.4.
// The format of GUID version 4 must be like
// xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx, where y is one of [8, 9, A, B].
tray_app_id_hash_.Data3 &= 0x0fff;
tray_app_id_hash_.Data3 |= 0x4000;
// Set y to one of [8, 9, A, B].
tray_app_id_hash_.Data4[0] = 1;
has_tray_app_id_hash_ = true;
CoTaskMemFree(explicit_app_id);
}

View file

@ -11,6 +11,7 @@
#include "atom/common/native_mate_converters/file_path_converter.h"
#include "atom/common/native_mate_converters/gfx_converter.h"
#include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/node_includes.h"
#include "base/base64.h"
#include "base/strings/string_util.h"
#include "native_mate/dictionary.h"
@ -23,7 +24,11 @@
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_util.h"
#include "atom/common/node_includes.h"
#if defined(OS_WIN)
#include "atom/common/asar/archive.h"
#include "base/win/scoped_gdi_object.h"
#include "ui/gfx/icon_util.h"
#endif
namespace atom {
@ -119,6 +124,33 @@ bool IsTemplateFilename(const base::FilePath& path) {
}
#endif
#if defined(OS_WIN)
bool ReadImageSkiaFromICO(gfx::ImageSkia* image, const base::FilePath& path) {
// If file is in asar archive, we extract it to a temp file so LoadImage can
// load it.
base::FilePath asar_path, relative_path;
base::FilePath image_path(path);
if (asar::GetAsarArchivePath(image_path, &asar_path, &relative_path)) {
std::shared_ptr<asar::Archive> archive =
asar::GetOrCreateAsarArchive(asar_path);
if (archive)
archive->CopyFileOut(relative_path, &image_path);
}
// Load the icon from file.
base::win::ScopedHICON icon(static_cast<HICON>(
LoadImage(NULL, image_path.value().c_str(), IMAGE_ICON, 0, 0,
LR_DEFAULTSIZE | LR_LOADFROMFILE)));
if (!icon)
return false;
// Convert the icon from the Windows specific HICON to gfx::ImageSkia.
scoped_ptr<SkBitmap> bitmap(IconUtil::CreateSkBitmapFromHICON(icon));
image->AddRepresentation(gfx::ImageSkiaRep(*bitmap, 1.0f));
return true;
}
#endif
v8::Persistent<v8::ObjectTemplate> template_;
} // namespace
@ -219,7 +251,13 @@ mate::Handle<NativeImage> NativeImage::CreateFromJPEG(
mate::Handle<NativeImage> NativeImage::CreateFromPath(
v8::Isolate* isolate, const base::FilePath& path) {
gfx::ImageSkia image_skia;
PopulateImageSkiaRepsFromPath(&image_skia, path);
if (path.MatchesExtension(FILE_PATH_LITERAL(".ico"))) {
#if defined(OS_WIN)
ReadImageSkiaFromICO(&image_skia, path);
#endif
} else {
PopulateImageSkiaRepsFromPath(&image_skia, path);
}
gfx::Image image(image_skia);
mate::Handle<NativeImage> handle = Create(isolate, image);
#if defined(OS_MACOSX)

View file

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

View file

@ -22,37 +22,26 @@ NodeBindingsWin::~NodeBindingsWin() {
}
void NodeBindingsWin::PollEvents() {
// Unlike Unix, in which we can just rely on one backend fd to determine
// whether we should iterate libuv loop, on Window, IOCP is just one part
// of the libuv loop, we should also check whether we have other types of
// events.
bool block = uv_loop_->idle_handles == NULL &&
uv_loop_->pending_reqs_tail == NULL &&
uv_loop_->endgame_handles == NULL &&
!uv_loop_->stop_flag &&
(uv_loop_->active_handles > 0 ||
!QUEUE_EMPTY(&uv_loop_->active_reqs));
// If there are other kinds of events pending, uv_backend_timeout will
// instruct us not to wait.
DWORD bytes, timeout;
ULONG_PTR key;
OVERLAPPED* overlapped;
// When there is no other types of events, we block on the IOCP.
if (block) {
DWORD bytes, timeout;
ULONG_PTR key;
OVERLAPPED* overlapped;
timeout = uv_backend_timeout(uv_loop_);
timeout = uv_backend_timeout(uv_loop_);
GetQueuedCompletionStatus(uv_loop_->iocp,
&bytes,
&key,
&overlapped,
timeout);
GetQueuedCompletionStatus(uv_loop_->iocp,
&bytes,
&key,
&overlapped,
timeout);
// Give the event back so libuv can deal with it.
if (overlapped != NULL)
PostQueuedCompletionStatus(uv_loop_->iocp,
bytes,
key,
overlapped);
}
// Give the event back so libuv can deal with it.
if (overlapped != NULL)
PostQueuedCompletionStatus(uv_loop_->iocp,
bytes,
key,
overlapped);
}
// static